diff --git a/README.md b/README.md index 416f28d..be9669c 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ These scripts are tested with following environment. - Ubuntu Mate 20.04.2 amd64 desktop - void-live-x86_64-20210218-mate.iso - void-live-x86_64-musl-20210218-mate.iso +- void-live-x86_64-20210218.iso # Installation Start the PC with the LiveCD/LiveUSB of the distribution to install. Download this repository from github, and expand it. @@ -40,8 +41,6 @@ If you install two or more Void Linux in to the EFI system, only the last one ca # Variants considerations Ubuntu has several variants ( flavors ). While I have tested only MATE flavor, other flavor may work correctly as far as it uses Ubiquity installer. -Void Linux has "base" variant which doesn't have GUI. Kaiten-yaki can't run correctly without GUI. - # Acknowledgments These scripts are based on the script shared on the [myn's diary](https://myn.hatenablog.jp/entry/install-ubuntu-focal-with-lvm-on-luks). That page contains rich information, hint and techniques around the encrypted volume and Ubiquity installer. diff --git a/script/void-kaiten-yaki.sh b/script/void-kaiten-yaki.sh index bee312a..7e0517d 100644 --- a/script/void-kaiten-yaki.sh +++ b/script/void-kaiten-yaki.sh @@ -7,7 +7,7 @@ function main() { # Load functions source lib/confirmation.sh source lib/preinstall.sh - source lib/parainstall.sh + # source lib/parainstall.sh # we have customized parainstall source lib/parainstall_msg.sh @@ -48,7 +48,7 @@ function main() { # ******************************************************************************* # Install essential packages. - xbps-install -y -Su xbps gptfdisk xterm + xbps-install -y -Su xbps gptfdisk # Common part of the pre-install stage if ! pre_install ; then @@ -83,19 +83,38 @@ function main() { # waitfor a console input read dummy_var - # Start void-installer in the separate window - xterm -fa monospace -fs ${XTERMFONTSIZE} -e void-installer & - - # Record the PID of the installer. - export INSTALLER_PID=$! + # Start the background target/etc/default/grub cheker. + # The definition of this function is down below. + grub_check_and_modify & - # Common part of the para-install. - # Record the install PID, modify the /etc/default/grub of the target, - # and then, wait for the end of sintaller. - if ! parainstall ; then + # Record the PID of the background checker. + grub_check_and_modify_id=$! + + # Start void-installer + void-installer + + # Check if background checker still exist + if ps $grub_check_and_modify_id > /dev/null ; then # If exists + # If exist, the grub was not modifyed -> void-installer termianted unexpectedly + cat <<-HEREDOC 1>&2 + ***** ERROR : The GUI/TUI installer terminated unexpectedly. ***** + ...Deleting the new logical volume "${VGNAME}-${LVROOTNAME}". + HEREDOC + lvremove -f /dev/mapper/${VGNAME}-${LVROOTNAME} + echo "...Deactivating all logical volumes in volume group \"${VGNAME}\"." + vgchange -a n ${VGNAME} + echo "...Closing LUKS volume \"${CRYPTPARTNAME}\"." + cryptsetup close ${CRYPTPARTNAME} + cat <<-HEREDOC 1>&2 + + ...The new logical volume has been deleted. You can retry Kaiten-yaki again. + ...Installation process terminated. + HEREDOC return 1 # with error status fi + # At here, the installation was successful. + # ******************************************************************************* # Post-install stage # ******************************************************************************* @@ -164,5 +183,29 @@ function main() { return 0 } + +# This function will be executed in the background context, to watch the TUI installer. +function grub_check_and_modify() { + + # 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 ] + do + sleep 1 # 1sec. + done # while + + # Perhaps, too neuvous. Wait 1 more sectond to avoid the rece condition. + 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. + echo "...Adding GRUB_ENABLE_CRYPTODISK entry to ${TARGETMOUNTPOINT}/etc/default/grub " + echo "GRUB_ENABLE_CRYPTODISK=y" >> ${TARGETMOUNTPOINT}/etc/default/grub + + # succesfull return + return 0 + +} # para install + # Execute main \ No newline at end of file