From 788571364e5c9198f08c17d5786fafd4edfb7d98 Mon Sep 17 00:00:00 2001 From: AngeD Date: Tue, 14 Mar 2023 18:49:40 +0100 Subject: [PATCH] feat: better driver support, grub --- base_install.sh | 28 +++++++++++++------ config | 7 +++-- gpu.sh | 4 ++- nvidia.hook | 3 +- rootfs/etc/pacman.d/hooks/95-grub.hook | 10 +++++++ .../etc/pacman.d/hooks/95-systemd-boot.hook | 9 ------ 6 files changed, 37 insertions(+), 24 deletions(-) create mode 100644 rootfs/etc/pacman.d/hooks/95-grub.hook delete mode 100644 rootfs/etc/pacman.d/hooks/95-systemd-boot.hook diff --git a/base_install.sh b/base_install.sh index 6e83d54..3b8fdc0 100755 --- a/base_install.sh +++ b/base_install.sh @@ -9,18 +9,18 @@ GREEN='\e[32m' PACMAN='pacman --needed -Syu' # System config +cp -rf rootfs/ / ln -sf "/usr/share/zoneinfo/$tz" /etc/localtime hwclock --systohc -timedatectl set-ntp true +timedatectl set-ntp true # TODO after system reboot? for l in "${locales[@]}"; do - sed -i "/#\s*$l/s/^#\s*//" /etc/locale.gen # todo test + sed -i "/#\s*$l/s/^#\s*//" /etc/locale.gen done locale-gen -echo "LANG=$lang" > /etc/locale.conf +echo "LANG=$lang.UTF-8" > /etc/locale.conf echo "$hostname" > /etc/hostname # Packages -cp -rf rootfs/ / $PACMAN "${pkg[@]}" systemctl enable NetworkManager systemctl enable reflector.timer @@ -35,9 +35,13 @@ echo "root:$root_passwd" | chpasswd useradd -mG wheel "$username" echo "$username:$user_passwd" | chpasswd -sed -i '/%wheel\s\+ALL=(ALL)\s\+ALL/s/^#\s*//' /etc/sudoers +sed -i '/^# %wheel\s\+ALL=(ALL:ALL)\s\+ALL/s/^#\s*//' /etc/sudoers + +# drivers +if blkid | grep -q LUKS; then + sed -i '/^HOOKS=(/s/filesystems/encrypt filesystems/' /etc/mkinitcpio.conf +fi -# Bootloader case "$(lscpu | grep Vendor)" in *AuthenticAMD*) $PACMAN amd-ucode @@ -46,10 +50,16 @@ case "$(lscpu | grep Vendor)" in $PACMAN intel-ucode ;; esac +./gpu.sh -bootctl install -cp loader/ /boot/loader # TODO +# Bootloader +sed -i '/GRUB_DISABLE_OS_PROBER=/s/.*/GRUB_DISABLE_OS_PROBER=true/' /etc/default/grub -mkinitcpio -P +if [ -n "$grub_timeout" ]; then + sed -i "/GRUB_TIMEOUT=/s/.*/GRUB_TIMEOUT=$grub_timeout/" /etc/default/grub +fi + +grub-install --target=x86_64-efi --efi-directory="$esp" --bootloader-id=GRUB +grub-mkconfig -o /boot/grub/grub.cfg echo -e "${BOLD}${GREEN}DONE. Ctrl+D, umount -R /mnt and reboot${NORMAL}" diff --git a/config b/config index e62c5c1..d292a3d 100644 --- a/config +++ b/config @@ -9,18 +9,19 @@ hostname="$username-pc" tz='Europe/Paris' locales=( - 'en_US.UTF-8' + 'en_US' ) lang="${locales[0]}" -esp="$(lsblk -f | grep vfat | grep -o '/boot.\+')" +esp="$(lsblk -f | grep vfat | grep -o '/boot.*')" +grub_timeout=1 pkg=( base-devel docker{,-compose} - efibootmgr fuse git + grub efibootmgr os-prober htop man-{db,pages} mpv diff --git a/gpu.sh b/gpu.sh index ff8c23f..22456b9 100755 --- a/gpu.sh +++ b/gpu.sh @@ -29,4 +29,6 @@ esac sed -i "s/^MODULES=(/MODULES=($modules/" /etc/mkinitcpio.conf -echo -e "${BOLD}${GREEN}DONE. You can reboot.${NORMAL}" +mkinitcpio -P + +echo -e "${BOLD}${GREEN}GPU drivers install finished.${NORMAL}" diff --git a/nvidia.hook b/nvidia.hook index 620cfa8..325ec7c 100644 --- a/nvidia.hook +++ b/nvidia.hook @@ -4,8 +4,7 @@ Operation=Upgrade Operation=Remove Type=Package Target=nvidia -Target=linux -# Change the linux part above and in the Exec line if a different kernel is used +Target=linux* [Action] Description=Update NVIDIA module in initcpio diff --git a/rootfs/etc/pacman.d/hooks/95-grub.hook b/rootfs/etc/pacman.d/hooks/95-grub.hook new file mode 100644 index 0000000..ca4acb2 --- /dev/null +++ b/rootfs/etc/pacman.d/hooks/95-grub.hook @@ -0,0 +1,10 @@ +[Trigger] +Type = Package +Operation = Install +Operation = Upgrade +Target = linux* + +[Action] +Description = Update grub config +When = PostTransaction +Exec = /usr/bin/grub-mkconfig -o /boot/grub/grub.cfg diff --git a/rootfs/etc/pacman.d/hooks/95-systemd-boot.hook b/rootfs/etc/pacman.d/hooks/95-systemd-boot.hook deleted file mode 100644 index d65c027..0000000 --- a/rootfs/etc/pacman.d/hooks/95-systemd-boot.hook +++ /dev/null @@ -1,9 +0,0 @@ -[Trigger] -Type = Package -Operation = Upgrade -Target = systemd - -[Action] -Description = Gracefully upgrading systemd-boot... -When = PostTransaction -Exec = /usr/bin/systemctl restart systemd-boot-update.service