improve install script

This commit is contained in:
Maximilian Keßler 2022-07-29 14:00:06 +02:00
parent 3ed4ba6aae
commit 17fb5251eb

View file

@ -67,6 +67,11 @@ exec 2> >(tee "stderr.log")
timedatectl set-ntp true
# Set up custom repo signing key
pacman-key --init
pacman-key --add /opt/mkessler/signing-key/signing_key
pacman-key --lsign-key B419CDA93D7544F8214B3216A23D90C2433DAFBC
### update mirrors
echo "Running reflector to update mirrors"
reflector
@ -163,21 +168,29 @@ sed -i 's/^\#\s%wheel\sALL=(ALL:ALL)\sNOPASSWD:\sALL$/%wheel ALL=(ALL:ALL) NOPAS
echo "${user}:${user_password}" | chpasswd --root /mnt
echo "root:${user_password}" | chpasswd --root /mnt
echo "Installing grub bootloader"
# install grub (but not main configuration file)
arch-chroot /mnt grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
echo 'Configuring HOOKS in /etc/mkinitcpio.conf and regenerating initramfs'
sed -i 's/^HOOKS=(base .* fsck)$/HOOKS=(base udev autodetect keyboard keymap consolefont modconf block encrypt lvm2 filesystems resume fsck)/' /mnt/etc/mkinitcpio.conf
arch-chroot /mnt mkinitcpio -P
echo "Installing grub bootloader"
arch-chroot /mnt grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
# Getting UUIDs of relevant devices
grub_resume="resume=UUID=$(lsblk -dno UUID ${part_swap})"
grub_cryptdevice="cryptdevice=UUID=$(lsblk -dno UUID ${part_luks}):${cryptlvm}"
grub_root="root=UUID=$(lsblk -dno UUID ${part_root})"
# Set boot parameters in grub configfor device mapping and resume hook
sed -i "s/^GRUB_CMDLINE_LINUX=\"\"$/GRUB_CMDLINE_LINUX=\"${grub_cryptdevice} ${grub_root} ${grub_resume}\"/" /mnt/etc/default/grub
echo "Generating main GRUB configuration file"
arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg
cat <<EOF
---------------------
Installed basic packages and setup in /mnt
Manual configuration is still needed for the following
- configure grub parameters for cryptvolume and resume hook
- generate main grub.cfg with grub-mkconfig -o /boot/grub/grub.cfg
You should be able to reboot now and enjoy a fresh arch installation.
---------------------
EOF