add checks to add encryption settings only once

merge-requests/273/head
Chrysostomus 7 years ago
parent 2de19bb48a
commit 083a91c198

@ -648,20 +648,20 @@ boot_encrypted_setting() {
#There is no separate /boot parition #There is no separate /boot parition
# Check if root is encrypted # Check if root is encrypted
if $(lsblk | grep "/mnt$" | grep -q 'crypt' ); then if $(lsblk | grep "/mnt$" | grep -q 'crypt' ); then
echo "GRUB_ENABLE_CRYPTODISK=y" >> /mnt/etc/default/grub grep -q "GRUB_ENABLE_CRYPTODISK=y" /mnt/etc/default/grub || echo "GRUB_ENABLE_CRYPTODISK=y" >> /mnt/etc/default/grub
setup_luks_keyfile setup_luks_keyfile
# Check if root is on encrypted lvm volume # Check if root is on encrypted lvm volume
elif $(lsblk -i | tac | sed -n -e "/$root_name/,/disk/p" | awk '{print $6}' | grep -q crypt); then elif $(lsblk -i | tac | sed -n -e "/$root_name/,/disk/p" | awk '{print $6}' | grep -q crypt); then
echo "GRUB_ENABLE_CRYPTODISK=y" >> /mnt/etc/default/grub grep -q "GRUB_ENABLE_CRYPTODISK=y" /mnt/etc/default/grub || echo "GRUB_ENABLE_CRYPTODISK=y" >> /mnt/etc/default/grub
setup_luks_keyfile setup_luks_keyfile
# Check if root is on encrypted lvm volume # Check if root is on encrypted lvm volume
elif $(lsblk -i | tac | sed -n -e "/$root_name/,/disk/p" | awk '{print $6}' | grep -q crypt); then elif $(lsblk -i | tac | sed -n -e "/$root_name/,/disk/p" | awk '{print $6}' | grep -q crypt); then
echo "GRUB_ENABLE_CRYPTODISK=y" >> /mnt/etc/default/grub grep -q "GRUB_ENABLE_CRYPTODISK=y" /mnt/etc/default/grub || echo "GRUB_ENABLE_CRYPTODISK=y" >> /mnt/etc/default/grub
fi fi
else else
# There is a separate /boot. Check if it is encrypted # There is a separate /boot. Check if it is encrypted
if $(lsblk | grep '/mnt/boot' | grep -q 'crypt' ); then if $(lsblk | grep '/mnt/boot' | grep -q 'crypt' ); then
echo "GRUB_ENABLE_CRYPTODISK=y" >> /mnt/etc/default/grub grep -q "GRUB_ENABLE_CRYPTODISK=y" /mnt/etc/default/grub || echo "GRUB_ENABLE_CRYPTODISK=y" >> /mnt/etc/default/grub
setup_luks_keyfile setup_luks_keyfile
fi fi
fi fi

Loading…
Cancel
Save