blob: 64ed8054d81556bb102692d9c37ef96ffa35e6b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#!/bin/sh
if [ $(id -u) -ne 0 ]
then echo "Please run as root"
exit
fi
SCRIPTPATH=$(dirname "$(readlink -f "$0")")
if [ -z $1 ]; then
echo "Which drive?"
read DRIVE
else
export DRIVE=$1
fi
export BASE=$(basename $DRIVE)
export PART="/dev/$(basename $(echo /sys/class/block/$BASE/$BASE* | \
xargs -n1 echo | sed 1q | rev | cut -c 2- | rev ))"
# List all partitions of device, get first one, remove last char.
sudo umount $DRIVE*
if [ ! -e installed ]; then
fdisk $DRIVE <<EOF
g
n
1
+512M
t
1
n
2
+20G
w
EOF
yes | mkfs.vfat ${PART}1
yes | mkfs.ext4 ${PART}2
mount ${PART}2 /mnt
mkdir /mnt/efi
mount ${PART}1 /mnt/efi
pacstrap /mnt base || exit 1
genfstab -U /mnt >> /mnt/etc/fstab
cp -r . /mnt
touch installed
else
mount ${PART}2 /mnt
mount ${PART}1 /mnt/efi
fi
arch-chroot /mnt << EOF
cd dotfiles
sh build.sh
EOF
echo "DONE! You should set passwords, move around ssh keys, etc."
|