From 6ea927e3b995202da00262e28cbf4601b8c10012 Mon Sep 17 00:00:00 2001 From: AngeD Date: Tue, 14 Mar 2023 22:09:05 +0100 Subject: [PATCH] feat: bootctl instead of grub to handle crypt --- base.sh | 36 +++++++++++-------- rootfs/boot/loader/entries/arch-fallback.conf | 4 +++ rootfs/boot/loader/entries/arch.conf | 4 +++ rootfs/boot/loader/loader.conf | 1 + 4 files changed, 30 insertions(+), 15 deletions(-) create mode 100755 rootfs/boot/loader/entries/arch-fallback.conf create mode 100755 rootfs/boot/loader/entries/arch.conf create mode 100755 rootfs/boot/loader/loader.conf diff --git a/base.sh b/base.sh index a28fad9..e8417f8 100755 --- a/base.sh +++ b/base.sh @@ -20,7 +20,16 @@ echo "LANG=$lang.UTF-8" > /etc/locale.conf echo "$hostname" > /etc/hostname # Packages -$PACMAN "${pkg[@]}" +case "$(lscpu | grep Vendor)" in + *AuthenticAMD*) + cpu=amd + ;; + *GenuineIntel*) + cpu=intel + ;; +esac + +$PACMAN "${pkg[@]}" "$cpu-ucode" systemctl enable \ NetworkManager \ docker.socket \ @@ -42,26 +51,23 @@ sed -i '/^# %wheel\s\+ALL=(ALL:ALL)\s\+ALL/s/^#\s*//' /etc/sudoers # drivers sed -i '/^HOOKS=(/s/filesystems/encrypt filesystems/' /etc/mkinitcpio.conf -case "$(lscpu | grep Vendor)" in - *AuthenticAMD*) - $PACMAN amd-ucode - ;; - *GenuineIntel*) - $PACMAN intel-ucode - ;; -esac ./gpu.sh # Bootloader -sed -i '/GRUB_DISABLE_OS_PROBER=/s/.*/GRUB_DISABLE_OS_PROBER=false/' /etc/default/grub +bootctl install -if [ -n "$grub_timeout" ]; then - sed -i "/GRUB_TIMEOUT=/s/.*/GRUB_TIMEOUT=$grub_timeout/" /etc/default/grub +root="$(findmnt -nr -o source /)" +cryptdev="$(cryptsetup status "$root" | grep device | awk '{print $2}' || true)" +if "$cryptdev"; then + uuid="$(blkid | grep /dev/nvme0n1p2 | awk '{print $2}')" + options="cryptdevice=$uuid:$(basename "$root") " fi -mkdir -p /boot/efi/ -grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB -grub-mkconfig -o /boot/grub/grub.cfg +options="${options}root=$root" + +find /boot/loader/entries/ | while read -r e; do + echo "options $options rw" >> "$e" +done echo -e "${BOLD}${GREEN}DONE. You can install a desktop environment \ (see README.md). Then, you can Ctrl+D, umount -R /mnt and reboot${NORMAL}" diff --git a/rootfs/boot/loader/entries/arch-fallback.conf b/rootfs/boot/loader/entries/arch-fallback.conf new file mode 100755 index 0000000..e54af09 --- /dev/null +++ b/rootfs/boot/loader/entries/arch-fallback.conf @@ -0,0 +1,4 @@ +title Arch Linux (fallback) +linux /vmlinuz-linux +initrd /initramfs-linux-fallback.img +initrd /$cpu-ucode.img diff --git a/rootfs/boot/loader/entries/arch.conf b/rootfs/boot/loader/entries/arch.conf new file mode 100755 index 0000000..ff38931 --- /dev/null +++ b/rootfs/boot/loader/entries/arch.conf @@ -0,0 +1,4 @@ +title Arch Linux +linux /vmlinuz-linux +initrd /initramfs-linux.img +initrd /$cpu-ucode.img diff --git a/rootfs/boot/loader/loader.conf b/rootfs/boot/loader/loader.conf new file mode 100755 index 0000000..1f7cd7e --- /dev/null +++ b/rootfs/boot/loader/loader.conf @@ -0,0 +1 @@ +default arch