feat: better driver support, grub

This commit is contained in:
AngeD 2023-03-14 18:49:40 +01:00
parent 2724a43e07
commit 788571364e
6 changed files with 37 additions and 24 deletions

View File

@ -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}"

7
config
View File

@ -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

4
gpu.sh
View File

@ -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}"

View File

@ -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

View File

@ -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

View File

@ -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