forked from peterstace/archvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
79 lines (65 loc) · 2.31 KB
/
install.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/bash
set -eu
echo "Checking UEFI boot mode"
test -d /sys/firmware/efi/efivars
echo "Updating system clock"
timedatectl set-timezone Europe/Paris
timedatectl set-ntp true
echo "Preparing disk"
for dev in /dev/vda1 /dev/vda2; do
if grep $dev /etc/mtab -q; then
umount $dev
fi
done
sgdisk -o -Z -n 1:0:+500M -t 1:ef00 -n 2:0:0 -t 2:8304 /dev/vda
mkfs.fat -F 32 /dev/vda1
mkfs.xfs -f -m bigtime=1,rmapbt=1 /dev/vda2
mount /dev/vda2 /mnt
mkdir /mnt/boot
mount /dev/vda1 /mnt/boot
echo "Fetching chroot script"
# Done as early as possible (after preparing the location to save it to) in
# case internet connectivity is not working.
src="https://raw.githubusercontent.com/neitsab/archvm/master/chroot.sh"
dst="/mnt/chroot.sh"
curl "$src" > "$dst"
chmod +x "$dst"
echo "Configuring mirrorlist"
# disable reflector service to prevent it from overwriting our manual settings
systemctl disable --now reflector
cat << 'EOF' > /etc/pacman.d/mirrorlist
################################################################################
################# Arch Linux mirrorlist generated by hand ######################
################################################################################
# With: La mano
# When: 2022-03-11 15:46:33 UTC
# From: https://archlinux.org/mirrors/status/#successful
Server = https://mirror.f4st.host/archlinux/$repo/os/$arch
Server = https://archlinux.mailtunnel.eu/$repo/os/$arch
Server = https://mirror.cyberbits.eu/archlinux/$repo/os/$arch
EOF
echo "Installing base"
pacstrap /mnt \
base linux efibootmgr \
micro terminus-font \
grml-zsh-config zsh-completions zsh-syntax-highlighting \
xfsprogs dosfstools \
sudo
echo "Preparing system with systemd-firstboot"
systemd-firstboot --root=/mnt \
--locale=fr_FR.UTF-8 \
--keymap=fr-latin9 \
--timezone=Europe/Paris \
--hostname=archvm \
--root-shell=/usr/bin/zsh \
--force
echo "Set up systemd-resolved symlink"
ln -sf /run/systemd/resolve/stub-resolv.conf /mnt/etc/resolv.conf
echo "Run chroot script"
arch-chroot /mnt /chroot.sh
echo "Unmounting virtual drive"
umount -R /mnt
echo "Installation complete. You can now:"
echo " - Shutdown the VM using \`poweroff\`"
echo " - Remove the installation media"
echo " - restart the VM"