booster/debian/postinst
2023-09-01 16:03:01 +01:00

60 lines
2.8 KiB
Bash

#!/bin/bash
set -e
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/liblzma.so.5 /usr/lib/liblzma.so.5
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
touch /etc/vconsole.conf
# Check if there are entries in crypttab
crypt_check=$(cat /etc/crypttab | grep -v '^#' || true)
if [[ -n $crypt_check ]]
then
# 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="
then
# Check if luks is already configured in refind
if cat /boot/refind_linux.conf | grep -i 'rd.luks'
then
true
else
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
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)"
exit 1
fi
fi
# 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
echo 'modules_force_load: nvidia' >> /etc/booster.yaml
fi
cp -f /usr/lib/booster/update-initramfs /usr/sbin/update-initramfs
chmod +x /usr/sbin/update-initramfs
update-initramfs -c -k all
rm /boot/initrd.img* || true