From 555bf5a38e064e66bef370ffd3012a7c4c2f80a2 Mon Sep 17 00:00:00 2001 From: Suikan <26223147+suikan4github@users.noreply.github.com> Date: Tue, 10 May 2022 22:22:30 +0900 Subject: [PATCH] Refactor the closing sequence. All closing sequence is gathered to the post-install(). --- script/lib/common.sh | 19 ++++++++++++++++++- script/ubuntu-kaiten-yaki.sh | 16 ---------------- script/void-kaiten-yaki.sh | 16 ---------------- 3 files changed, 18 insertions(+), 33 deletions(-) diff --git a/script/lib/common.sh b/script/lib/common.sh index 829cbb4..e9d5ec9 100644 --- a/script/lib/common.sh +++ b/script/lib/common.sh @@ -395,12 +395,29 @@ function post_install() { echo "...Unmounting all." umount -R -l "${TARGETMOUNTPOINT}" + echo "...Post install process finished." + + # Free LUKS volume as swap volume. + echo "...Disabling swap to release the LUKS volume." + swapoff -a + + # Close LUKS echo "...Deactivating all logical volumes in volume group \"${VGNAME}\"." vgchange -a n "${VGNAME}" echo "...Closing LUKS volume \"${CRYPTPARTNAME}\"." cryptsetup close "${CRYPTPARTNAME}" - echo "...Post install process finished." + # Deleting the passphrase information. + echo "...Deleting passphrase information." + PASSPHRASE="" + export PASSPHRASE + + # Finishing message + cat <<- HEREDOC + ****************** Install process finished ****************** + + ...Ready to reboot. + HEREDOC return 0 diff --git a/script/ubuntu-kaiten-yaki.sh b/script/ubuntu-kaiten-yaki.sh index 93952a6..adfbbdd 100644 --- a/script/ubuntu-kaiten-yaki.sh +++ b/script/ubuntu-kaiten-yaki.sh @@ -66,22 +66,6 @@ function main() { # The script is parameterized by env-variable to fit to the distribution post_install - # Free LUKS volume as swap volume. - echo "...Disabling swap to release the LUKS volume." - swapoff -a - - # Deleting the passphrase information. - echo "...Deleting passphrase information." - PASSPHRASE="" - export PASSPHRASE - - # Finishing message - cat <<- HEREDOC - ****************** Install process finished ****************** - - ...Ready to reboot. - HEREDOC - # Normal end return 0 diff --git a/script/void-kaiten-yaki.sh b/script/void-kaiten-yaki.sh index 4a9c899..c63f906 100644 --- a/script/void-kaiten-yaki.sh +++ b/script/void-kaiten-yaki.sh @@ -81,22 +81,6 @@ function main() { # The script is parameterized by env-variable to fit to the distribution post_install - # Free LUKS volume as swap volume. - echo "...Disabling swap to release the LUKS volume." - swapoff -a - - # Deleting the passphrase information. - echo "...Deleting passphrase information." - PASSPHRASE="" - export PASSPHRASE - - # Finishing message - cat <<- HEREDOC - ****************** Install process finished ****************** - - ...Ready to reboot. - HEREDOC - # Normal end return 0