From 0b392629c98c0842fe22c32b249b213e2563729d Mon Sep 17 00:00:00 2001 From: Suikan <26223147+suikan4github@users.noreply.github.com> Date: Thu, 1 Jul 2021 15:10:12 +0900 Subject: [PATCH] Refactor the structure of the source Common part is moved to common dir --- script/{ => common}/_confirmation.sh | 0 script/{ => common}/_parainstall.sh | 0 script/{ => common}/_parainstall_msg.sh | 0 script/{ => common}/_preinstall.sh | 0 script/ubuntu-kaiten-yaki.sh | 16 +++++++++------- script/void-kaiten-yaki.sh | 9 +++++---- 6 files changed, 14 insertions(+), 11 deletions(-) rename script/{ => common}/_confirmation.sh (100%) rename script/{ => common}/_parainstall.sh (100%) rename script/{ => common}/_parainstall_msg.sh (100%) rename script/{ => common}/_preinstall.sh (100%) diff --git a/script/_confirmation.sh b/script/common/_confirmation.sh similarity index 100% rename from script/_confirmation.sh rename to script/common/_confirmation.sh diff --git a/script/_parainstall.sh b/script/common/_parainstall.sh similarity index 100% rename from script/_parainstall.sh rename to script/common/_parainstall.sh diff --git a/script/_parainstall_msg.sh b/script/common/_parainstall_msg.sh similarity index 100% rename from script/_parainstall_msg.sh rename to script/common/_parainstall_msg.sh diff --git a/script/_preinstall.sh b/script/common/_preinstall.sh similarity index 100% rename from script/_preinstall.sh rename to script/common/_preinstall.sh diff --git a/script/ubuntu-kaiten-yaki.sh b/script/ubuntu-kaiten-yaki.sh index aa56d4b..cf98d48 100644 --- a/script/ubuntu-kaiten-yaki.sh +++ b/script/ubuntu-kaiten-yaki.sh @@ -45,21 +45,21 @@ fi # "Ubuntu" is not found in the OS name. # ******************************************************************************* # Common part of the parameter confirmation -source _confirmation.sh +source common/_confirmation.sh # ******************************************************************************* # Pre-install stage # ******************************************************************************* # Common part of the pre-install stage -source _preinstall.sh +source common/_preinstall.sh # ******************************************************************************* # Para-install stage # ******************************************************************************* # Show common message to let the operator focus on the critical part -source _parainstall_msg.sh +source common/_parainstall_msg.sh # Ubuntu dependent message cat <> /etc/cryptsetup-initramfs/conf-hook -echo "UMASK=0077" >> /etc/initramfs-tools/initramfs.conf # Prepare a key file to embed in to the ramfs. echo "...Prepair key file." @@ -127,6 +124,11 @@ printf %s "${PASSPHRASE}" | cryptsetup luksAddKey -d - "${DEV}${CRYPTPARTITION}" echo "...Add LUKS volume info to /etc/crypttab." echo "${CRYPTPARTNAME} UUID=$(blkid -s UUID -o value ${DEV}${CRYPTPARTITION}) /etc/luks/boot_os.keyfile luks,discard" >> /etc/crypttab +# Putting key file into the ramfs initial image +echo "...Register key file to the ramfs" +echo "KEYFILE_PATTERN=/etc/luks/*.keyfile" >> /etc/cryptsetup-initramfs/conf-hook +echo "UMASK=0077" >> /etc/initramfs-tools/initramfs.conf + # Finally, update the ramfs initial image with the key file. echo "...Upadte initramfs." update-initramfs -uk all diff --git a/script/void-kaiten-yaki.sh b/script/void-kaiten-yaki.sh index 4d3cb14..0108cc6 100644 --- a/script/void-kaiten-yaki.sh +++ b/script/void-kaiten-yaki.sh @@ -45,7 +45,7 @@ fi # "Void" is not found in the OS name. # ******************************************************************************* # Common part of the parameter confirmation -source _confirmation.sh +source common/_confirmation.sh # ******************************************************************************* # Pre-install stage @@ -60,7 +60,7 @@ else fi # Common part of the pre-install stage -source _preinstall.sh +source common/_preinstall.sh # ADD "rd.auto=1 cryptdevice=/dev/sda2:${LUKS_NAME} root=/dev/mapper/${VGNAME}-${ROOTNAME}" to GRUB. # This is magical part. I have not understood why this is required. @@ -74,7 +74,7 @@ sed -i "s#loglevel=4#loglevel=4 rd.auto=1 cryptdevice=/dev/sda2:${LUKS_NAME} roo # ******************************************************************************* # Show common message to let the operator focus on the critical part -source _parainstall_msg.sh +source common/_parainstall_msg.sh # Ubuntu dependent message cat <> /etc/crypttab +# Putting key file into the ramfs initial image echo "...Register key file to the ramfs" echo 'install_items+=" /etc/luks/boot_os.keyfile /etc/crypttab " ' > /etc/dracut.conf.d/10-crypt.conf