-
Notifications
You must be signed in to change notification settings - Fork 4
/
start.sh
53 lines (44 loc) · 1.21 KB
/
start.sh
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
#!/bin/bash
if [ $root ]; then
mkfs.xfs -f $root || exit && mount $root /mnt && mkdir /mnt/boot
else
echo "Root partition not added. Read the README of the github repo."
exit
fi
if [ $boot ]; then
mkfs.fat -F32 $boot || exit && mount $boot /mnt/boot
else
echo "Boot partition not added. Read the README of the github repo."
umount /mnt
exit
fi
if [ $swap ]; then
mkswap $swap || exit && swapon $swap
fi
if [ $home ]; then
mkfs.xfs -f $home || exit && mount $home /mnt/home
fi
if ! [ $kernel ]; then
export kernel=linux
fi
attempts=0
max_attempts=${max_attempts:-5}
while true; do
if pacstrap /mnt base $kernel $kernel-headers linux-firmware xfsprogs; then
break
fi
attempts=$((attempts + 1))
if [ $attempts -ge $max_attempts ]; then
echo "Pacstrap failed after $max_attempts attempts."
exit 1
fi
echo "Pacstrap failed. Retrying... (Attempt: $attempts/$max_attempts)"
done
timedatectl set-ntp true
genfstab -U /mnt >>/mnt/etc/fstab
curl -L https://raw.githubusercontent.com/miguelrcborges/archinstallscript/main/chroot-script.sh -o /mnt/chroot-script.sh
arch-chroot /mnt sh chroot-script.sh
if [ $network == "systemd-networkd" ]; then
cp -r /etc/systemd/network /mnt/etc/systemd/
fi
reboot