diff --git a/lib/util-base.sh b/lib/util-base.sh index e316e76..d177023 100644 --- a/lib/util-base.sh +++ b/lib/util-base.sh @@ -409,7 +409,7 @@ install_grub_uefi() { check_for_error "grub-install --target=x86_64-efi" $? fi # If encryption used amend grub - [[ $LUKS_DEV != "" ]] && sed -i "s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"$LUKS_DEV\"~g" ${MOUNTPOINT}/etc/default/grub + [[ $(cat /tmp/.luks_dev) != "" ]] && sed -i "s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"$(cat /tmp/.luks_dev)\"~g" ${MOUNTPOINT}/etc/default/grub # If root is on btrfs volume, amend grub [[ -e /tmp/.btrfsroot ]] && \ @@ -573,7 +573,7 @@ bios_bootloader() { fi # If encryption used amend grub - [[ $LUKS_DEV != "" ]] && sed -i "s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"$LUKS_DEV\"~g" ${MOUNTPOINT}/etc/default/grub + [[ $(cat /tmp/.luks_dev) != "" ]] && sed -i "s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"$(cat /tmp/.luks_dev)\"~g" ${MOUNTPOINT}/etc/default/grub # If root is on btrfs volume, amend grub [[ $(lsblk -lno FSTYPE,MOUNTPOINT | awk '/ \/mnt$/ {print $1}') == btrfs ]] && \ diff --git a/lib/util-disk.sh b/lib/util-disk.sh index a679b49..bb631da 100644 --- a/lib/util-disk.sh +++ b/lib/util-disk.sh @@ -998,7 +998,7 @@ mount_partitions() { get_cryptroot() { # Identify if /mnt or partition is type "crypt" (LUKS on LVM, or LUKS alone) - if $(sblk | awk '/\/mnt$/ {print $6}' | grep -q crypt) || $(lsblk -i | tac | sed -n -e "/\/mnt$/,/part/p" | awk '{print $6}' | grep -q crypt); then + if $(lsblk | awk '/\/mnt$/ {print $6}' | grep -q crypt) || $(lsblk -i | tac | sed -n -e "/\/mnt$/,/part/p" | awk '{print $6}' | grep -q crypt); then LUKS=1 root_name=$(mount | awk '/\/mnt / {print $1}' | sed s~/dev/mapper/~~g | sed s~/dev/~~g) #Get the name of the Luks device @@ -1039,11 +1039,12 @@ get_cryptroot() { fi done fi + echo "$LUKS_DEV" > /tmp/.luks_dev } get_cryptboot(){ # If /boot is encrypted - if $(sblk | awk '/\/mnt\/boot$/ {print $6}' | grep -q crypt) || $(lsblk -i | tac | sed -n -e "/\/mnt\/boot$/,/part/p" | awk '{print $6}' | grep -q crypt); then + if $(lsblk | awk '/\/mnt\/boot$/ {print $6}' | grep -q crypt) || $(lsblk -i | tac | sed -n -e "/\/mnt\/boot$/,/part/p" | awk '{print $6}' | grep -q crypt); then LUKS=1 boot_name=$(mount | awk '/\/mnt\/boot / {print $1}' | sed s~/dev/mapper/~~g | sed s~/dev/~~g) @@ -1069,7 +1070,7 @@ get_cryptboot(){ LUKS_DEV="$LUKS_DEV cryptdevice=UUID=$LUKS_BOOT_UUID:$LUKS_BOOT_NAME" fi fi - + echo "$LUKS_DEV" > /tmp/.luks_dev } btrfs_subvolumes() { #1) save mount options and name of the root partition