booster/debian/postinst

60 lines
2.7 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:24:30 +02:00
ln -sf /usr/lib/x86_64-linux-gnu/libaio.so.1 /usr/lib/libaio.so.1
ln -sf /usr/lib/x86_64-linux-gnu/libblkid.so.1 /usr/lib/libblkid.so.1
ln -sf /usr/lib/x86_64-linux-gnu/liblz4.so.1 /usr/lib/liblz4.so.1
ln -sf /usr/lib/x86_64-linux-gnu/libzstd.so.1 /usr/lib/libzstd.so.1
ln -sf /usr/lib/x86_64-linux-gnu/libpthread.so.0 /usr/lib/libpthread.so.0
ln -sf /usr/lib/x86_64-linux-gnu/libgpg-error.so.0 /usr/lib/libgpg-error.so.0
ln -sf /usr/lib/x86_64-linux-gnu/libgcrypt.so.20 /usr/lib/libgcrypt.so.20
ln -sf /usr/lib/x86_64-linux-gnu/libcap.so.2 /usr/lib/libcap.so.2
ln -sf /usr/lib/x86_64-linux-gnu/libsystemd.so.0 /usr/lib/libsystemd.so.0
ln -sf /usr/lib/x86_64-linux-gnu/libmd.so.0 /usr/lib/libmd.so.0
ln -sf /usr/lib/x86_64-linux-gnu/libbsd.so.0 /usr/lib/libbsd.so.0
ln -sf /usr/lib/x86_64-linux-gnu/libtinfo.so.6 /usr/lib/libtinfo.so.6
ln -sf /usr/lib/x86_64-linux-gnu/libedit.so.2 /usr/lib/libedit.so.2
ln -sf /usr/lib/x86_64-linux-gnu/libm.so.6 /usr/lib/libm.so.6
ln -sf /usr/lib/x86_64-linux-gnu/libudev.so.1 /usr/lib/libudev.so.1
ln -sf /usr/lib/x86_64-linux-gnu/libc.so.6 /usr/lib/libc.so.6
ln -sf /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0 /usr/lib/libpcre2-8.so.0
ln -sf /usr/lib/x86_64-linux-gnu/libselinux.so.1 /usr/lib/libselinux.so.1
ln -sf /usr/lib/x86_64-linux-gnu/libdevmapper.so.1.02.1 /usr/lib/libdevmapper.so.1.02.1
ln -sf /usr/lib/x86_64-linux-gnu/libdevmapper-event.so.1.02.1 /usr/lib/libdevmapper-event.so.1.02.1
2023-08-30 22:21:17 +02:00
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:51:51 +02:00
true
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:51:51 +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 (u>
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:51:51 +02:00
2023-08-31 12:10:15 +02:00
# Add nvidia support if an nvidia card is detected
if lspci -k | grep -iEA3 '^[[:alnum:]]{2}:[[:alnum:]]{2}.*VGA|3D|DISPLAY' | grep -i nvidia
then
2023-08-31 12:21:09 +02:00
echo 'modules_force_load: nvidia' >> /etc/booster.yaml
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