diff --git a/archlinux/create-efi-kernel.sh b/archlinux/create-efi-kernel.sh index 0d6b8e7..d2f837f 100755 --- a/archlinux/create-efi-kernel.sh +++ b/archlinux/create-efi-kernel.sh @@ -42,7 +42,7 @@ export DEBUG ## Default values for Unified kernel readonly ROOT_UUID_DEFAULT=$(findmnt --kernel --noheadings --output UUID -- /) readonly ROOT_FSTYPE_DEFAULT=$(findmnt --kernel --noheadings --output FSTYPE -- /) -readonly CRYPT_PART_UUID_DEFAULT=$(blkid | sed --silent 's;/dev/.*_crypt.*UUID="\(.*\)".*TYPE=.*;\1;p') +readonly CRYPT_PART_UUID_DEFAULT=$(blkid | sed --silent 's;/dev/.*: UUID="\(.*\)" TYPE="crypto_LUKS".*;\1;p') readonly UEFI_BOOT_STUB_FILE_DEFAULT="/usr/lib/systemd/boot/efi/linuxx64.efi.stub" ## Default values for UEFI entry @@ -97,6 +97,11 @@ Unified kernel OPTIONSĀ : (default: ${ROOT_UUID_DEFAULT}) Thanks to command : findmnt --kernel --noheadings --output UUID -- / + -c,--crypt,--crypt-uuid + Define a different LUKS partition's UUID. + (default: ${CRYPT_PART_UUID_DEFAULT}) + Thanks to command : blkid | sed --silent 's;/dev/.*crypto_LUKS.*UUID="\(.*\)";\1;p' + -k,--kernel,--kernel-cmd Define the kernel command line to use. (default: build with root-fs|root-uuid + ro options) @@ -152,6 +157,18 @@ define_vars() { # {{{ readonly root_fstype="${ROOT_FSTYPE_DEFAULT}" fi # }}} + # If crypt_part_uuid wasn't defined (argument) {{{ + if [ -z "${crypt_part_uuid-}" ]; then + ## Use default value + readonly crypt_part_uuid="${CRYPT_PART_UUID_DEFAULT}" + fi + # }}} + # If a LUKS partition exists AND if kernel_command_line wasn't defined (argument) {{{ + if $(blkid | grep --silent -- "LUKS") && [ -z "${kernel_command_line-}" ]; then + ## Use default value for encrypted LVM + readonly kernel_command_line="root=UUID=${root_uuid} rootfstype=${root_fstype} ro cryptdevice=UUID=${crypt_part_uuid}:lvm" + fi + # }}} # If kernel_command_line wasn't defined (argument) {{{ if [ -z "${kernel_command_line-}" ]; then ## Use default value