diff --git a/script/common/_confirmation.sh b/script/common/confirmation.sh similarity index 94% rename from script/common/_confirmation.sh rename to script/common/confirmation.sh index edb0c40..82dd0ff 100644 --- a/script/common/_confirmation.sh +++ b/script/common/confirmation.sh @@ -1,7 +1,10 @@ +#!/bin/bash # ******************************************************************************* # Confirmation and Passphrase setting # ******************************************************************************* +function confirmation(){ + # Sanity check for volume group name if echo ${VGNAME} | grep "-" -i > /dev/null ; then # "-" is found in the volume group name. cat <&2 @@ -11,7 +14,7 @@ Check passphrase and config.txt Installation terminated. HEREDOC - return + return 1 fi # "-" is found in the volume group name. # Sanity check for root volume name @@ -23,7 +26,7 @@ Check passphrase and config.txt Installation terminated. HEREDOC - return + return 1 fi # "-" is found in the volume name. # Sanity check for swap volume name @@ -35,7 +38,7 @@ Check passphrase and config.txt Installation terminated. HEREDOC - return + return 1 fi # "-" is found in the volume name. # For surre ask the config.sh is edited @@ -51,7 +54,7 @@ if [ ${YESNO} != "Y" -a ${YESNO} != "y" ] ; then Installation terminated. HEREDOC - return + return 1 fi # if YES # For sure ask ready to erase. @@ -64,7 +67,7 @@ Check config.sh. The variable ERASEALL is ${ERASEALL}. Installation terminated. HEREDOC - return + return 1 fi # if YES fi # if erase all @@ -81,7 +84,12 @@ read -sr PASSPHRASE_C if [ ${PASSPHRASE} != ${PASSPHRASE_C} ] ; then cat <&2 ***** ERROR : Passphrase doesn't match ***** + Installation terminated. HEREDOC - return + return 1 fi # passphrase validation + +# succesfull return +return 0 +} diff --git a/script/common/_parainstall.sh b/script/common/parainstall.sh similarity index 89% rename from script/common/_parainstall.sh rename to script/common/parainstall.sh index 37b7502..8ecca23 100644 --- a/script/common/_parainstall.sh +++ b/script/common/parainstall.sh @@ -1,7 +1,10 @@ +#!/bin/bash # ******************************************************************************* # Common part of para-install # ******************************************************************************* +function parainstall() { + # While the /etc/default/grub in the install target is NOT existing, keep sleeping. # If installer terminated without file copy, this script also terminates. while [ ! -e ${TARGETMOUNTPOINT}/etc/default/grub ] @@ -15,7 +18,7 @@ The installer terminated unexpectedly. Installation process terminated. HEREDOC - return + return 1 fi done # while @@ -26,7 +29,7 @@ sleep 1 # 1sec. # Make target GRUB aware to the crypt partition # This must do it after start of the file copy by installer, but before the end of the file copy. # If the environment is not GUI, keep quiet not to bother the TUI installer. -if [ $PARINSTMSG -eq 1 ]; then +if [ ${PARAINSTMSG} -eq 1 ]; then echo "...Add GRUB_ENABLE_CRYPTODISK entry to ${TARGETMOUNTPOINT}/etc/default/grub " fi echo "GRUB_ENABLE_CRYPTODISK=y" >> ${TARGETMOUNTPOINT}/etc/default/grub @@ -34,7 +37,12 @@ echo "GRUB_ENABLE_CRYPTODISK=y" >> ${TARGETMOUNTPOINT}/etc/default/grub # And then, wait for the end of installer process # If the environment is not GUI, keep quiet not to bother the TUI installer. -if [ $PARAINSTMSG -eq 1 ]; then +if [ ${PARAINSTMSG} -eq 1 ]; then echo "...Waiting for the end of GUI/TUI installer." fi wait $installer_pid + +# succesfull return +return 0 + +} # para install diff --git a/script/common/_parainstall_msg.sh b/script/common/parainstall_msg.sh similarity index 94% rename from script/common/_parainstall_msg.sh rename to script/common/parainstall_msg.sh index 4f910d1..6d46e32 100644 --- a/script/common/_parainstall_msg.sh +++ b/script/common/parainstall_msg.sh @@ -1,3 +1,7 @@ +#!/bin/bash + +function parainstall_msg() { + cat </dev/null) && sourced=1 || sourced=0 if [ $sourced -eq 0 ] ; then @@ -46,21 +52,28 @@ fi # "Ubuntu" is not found in the OS name. # ******************************************************************************* # Common part of the parameter confirmation -source common/_confirmation.sh +if ! confirmation ; then + return 1 +fi # ******************************************************************************* # Pre-install stage # ******************************************************************************* # Common part of the pre-install stage -source common/_preinstall.sh +if ! pre_install ; then + return 1 +fi + # ******************************************************************************* # Para-install stage # ******************************************************************************* # Show common message to let the operator focus on the critical part -source common/_parainstall_msg.sh +if ! parainstall ; then + return 1 +fi # Ubuntu dependent message cat </dev/null) && sourced=1 || sourced=0 if [ $sourced -eq 0 ] ; then @@ -46,7 +52,9 @@ fi # "Void" is not found in the OS name. # ******************************************************************************* # Common part of the parameter confirmation -source common/_confirmation.sh +if ! confirmation ; then + return 1 +fi # ******************************************************************************* # Pre-install stage @@ -61,7 +69,9 @@ else fi # Common part of the pre-install stage -source common/_preinstall.sh +if ! pre_install ; then + return 1 +fi # 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. @@ -75,7 +85,9 @@ 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 common/_parainstall_msg.sh +if ! parainstall ; then + return 1 +fi # Ubuntu dependent message cat <