Update postinst

This commit is contained in:
Ward Nakchbandi (Cosmic Fusion) 2023-08-31 13:32:01 +03:00 committed by GitHub
parent cc72d4dc4d
commit 2dc2cd6107
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

24
debian/postinst vendored
View File

@ -25,16 +25,24 @@ ln -sf /usr/lib/x86_64-linux-gnu/libdevmapper-event.so.1.02.1 /usr/lib/libdevmap
touch /etc/vconsole.conf
# 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="
# Check if there are entries in crypttab
if [[ $(cat /etc/crypttab | grep -v '^#') ]]
then
if cat /boot/refind_linux.conf | grep -i 'rd.luks'
then
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
# Do nothing
true
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
# 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
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