booster/debian/booster.postinst

38 lines
1.4 KiB
Plaintext
Raw Normal View History

2023-08-31 12:00:20 +02:00
#!/bin/bash
2023-08-30 20:48:55 +02:00
set -e
2023-08-30 22:44:09 +02:00
touch /etc/vconsole.conf
2023-08-31 12:32:01 +02:00
# Check if there are entries in crypttab
2023-08-31 12:51:51 +02:00
crypt_check=$(cat /etc/crypttab | grep -v '^#' || true)
if [[ -n $crypt_check ]]
2023-08-31 12:00:20 +02:00
then
2023-08-31 12:32:01 +02:00
# Use the first crypttab entry as luks for booster (valid for calamares and probably most installers)
if cat /etc/crypttab | grep -v '^#' | head -n1 | cut -f2 | grep -i "UUID="
2023-08-31 12:24:18 +02:00
then
2023-08-31 12:32:01 +02:00
# Check if luks is already configured in refind
if cat /boot/refind_linux.conf | grep -i 'rd.luks'
then
2023-08-31 12:54:12 +02:00
true
2023-08-31 12:51:51 +02:00
else
2023-08-31 12:32:01 +02:00
sed -i "s#root=#rd.luks.name="$(cat /etc/crypttab | grep -v '^#' | head -n1 | cut -f2 | sed "s#UUID=##")"="$(cat /etc/crypttab | grep -v '^#' | head -n1 | cut -f1)" root=#" /boot/refind_linux.conf
fi
else
2023-08-31 12:54:12 +02:00
echo -e "ERROR 1: /etc/crypttab is invalid!\nFirst crypttab entry (presumed to be root luks) is not defined via UUID\nPlease make sure to define luks for root as the first entry in /etc/crypttab via UUID (use blkid)"
2023-08-31 12:32:01 +02:00
exit 1
2023-08-31 12:24:18 +02:00
fi
2023-08-31 12:00:20 +02:00
fi
2023-08-31 12:10:15 +02:00
# Add nvidia support if an nvidia card is detected
2023-09-01 20:11:59 +02:00
if lspci -k | grep -iEA3 '^[[:alnum:]]{2}:[[:alnum:]]{2}.*VGA|3D|DISPLAY' | grep -i nvidia && lspci -k | grep -iEA3 '^[[:alnum:]]{2}:[[:alnum:]]{2}.*VGA|3D|DISPLAY' | grep -i -E 'kernel modules|kernel driver' | grep -i nvidia
2023-08-31 12:10:15 +02:00
then
2023-09-04 11:34:30 +02:00
sed -i "s#root=#rd.modules_force_load=nvidia,usbhid root=#" /boot/refind_linux.conf
2023-08-31 12:10:15 +02:00
fi
2023-08-30 20:48:55 +02:00
cp -f /usr/lib/booster/update-initramfs /usr/sbin/update-initramfs
chmod +x /usr/sbin/update-initramfs
update-initramfs -c -k all
2023-08-30 20:54:14 +02:00
rm /boot/initrd.img* || true