diff --git a/install-stage1.sh b/install-stage1.sh index 6a32583..7e6d504 100644 --- a/install-stage1.sh +++ b/install-stage1.sh @@ -460,7 +460,6 @@ The installer will now create a system image and reboot the computer. press_any_key echo "Creating system image..." -#TODO: make this work without user interaction -run_in_target /opt/void-usb/system-image +run_in_target /opt/void-usb/system-image --yes reboot # diff --git a/opt/system-image b/opt/system-image index b4dda03..ae94c03 100644 --- a/opt/system-image +++ b/opt/system-image @@ -39,22 +39,27 @@ function yesno { #TODO: refuse to run if system is running -#TODO: add a way to force a new system image without asking (for example a file in /run/void-usb) +if [ "$1" = "--yes" ]; then + DONT_ASK="true" +else + DONT_ASK="false" + + echo_tty "Create a new system image?" + echo_tty + echo_tty "This will replace the existing system image with a snapshot of the currently" + echo_tty "running system. Choosing no here will discard any newly installed programs," + echo_tty "updates, system configuration changes, etc." + echo_tty + echo_tty "This should not affect your files in /home as they are stored to disk directly." + echo_tty "Check /TODO/README.txt for more information." + echo_tty + echo_tty "Creating a new system image will take some time." + echo_tty +fi #TODO: colors (bright white / light gray for readability) -echo_tty "Create a new system image? -This will replace the existing system image with a snapshot of the currently -running system. Choosing no here will discard any newly installed programs, -updates, system configuration changes, etc. - -This should not affect your files in /home as they are stored to disk directly. -Check /TODO/README.txt for more information. - -Creating a new system image will take some time. -" - -if yesno; then +if $DONT_ASK || yesno; then echo_tty -n "Generating exclusion list... " # cutting off the leading slash allows us to just ignore empty lines below readarray -t MOUNT_LIST <<< "$(findmnt --output TARGET --noheadings --raw | sed -e 's|^/||' | sort)"