From 9d3e1d137cf72d9277f181e48144deacd3114071 Mon Sep 17 00:00:00 2001 From: Suikan <26223147+suikan4github@users.noreply.github.com> Date: Sat, 3 Jul 2021 12:46:42 +0900 Subject: [PATCH] Add restroration of /etac/default/tab --- script/void-kaiten-yaki.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/script/void-kaiten-yaki.sh b/script/void-kaiten-yaki.sh index e076fd7..c5a4cdc 100644 --- a/script/void-kaiten-yaki.sh +++ b/script/void-kaiten-yaki.sh @@ -43,19 +43,21 @@ function main() { # Anyway, without this modification, Void Linux doesn't boot. # Refer https://wiki.voidlinux.org/Install_LVM_LUKS#Installation_using_void-installer # This modification is guaratnteed once only. To allow re-trying the installation after unexpected GUI/TUI installer quit. - grub_additional_parameters="rd.auto=1 cryptdevice=${DEV}${CRYPTPARTITION}:${CRYPTPARTNAME} root=/dev/mapper/${VGNAME}-${LVROOTNAME}" - if grep "$grub_additional_parameters" /etc/default/grub ; then # Is additonal parameter already added? + export GRUB_ADDITIONAL_PARAMETERS="rd.auto=1 cryptdevice=${DEV}${CRYPTPARTITION}:${CRYPTPARTNAME} root=/dev/mapper/${VGNAME}-${LVROOTNAME}" + if grep "$GRUB_ADDITIONAL_PARAMETERS" /etc/default/grub ; then # Is additonal parameter already added? # Yes echo ".../etc/default/grub already modified. OK, skipping to modiy." else # Not yet. Let's add. echo "...Modify /etc/default/grub." - sed -i "s#loglevel=4#loglevel=4 ${grub_additional_parameters}#" /etc/default/grub + sed -i "s#loglevel=4#loglevel=4 ${GRUB_ADDITIONAL_PARAMETERS}#" /etc/default/grub fi # Common part of the pre-install stage if ! pre_install ; then + echo "...restoring modified /etc/default/grub." + sed -i "s#loglevel=4 ${GRUB_ADDITIONAL_PARAMETERS}#loglevel=4#" /etc/default/grub return 1 # with error status fi @@ -118,6 +120,8 @@ function para_install_local() { # If exist, the grub was not modifyed -> void-installer termianted unexpectedly # Delete the nwe volume if overwrite install, and close all on_unexpected_installer_quit + echo "...restoring modified /etc/default/grub." + sed -i "s#loglevel=4 ${GRUB_ADDITIONAL_PARAMETERS}#loglevel=4#" /etc/default/grub return 1 # with error status fi