From 3e5341dc89d9bcc21a6669e64bd41e27387a2c8c Mon Sep 17 00:00:00 2001 From: BodgeMaster <> Date: Thu, 16 Jul 2026 17:48:05 +0200 Subject: [PATCH] save-image: add a lil helper for setting the auto accept marker for system-image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is intended for users that don’t have TTY access, such as SSH sessions. Best used with a script that sets the auto reject marker on boot. There will be a server profile that comes with that by default. --- install-stage1.sh | 4 +++- usr/local/sbin/save-image | 43 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 usr/local/sbin/save-image diff --git a/install-stage1.sh b/install-stage1.sh index c040327..129ca7c 100644 --- a/install-stage1.sh +++ b/install-stage1.sh @@ -386,13 +386,15 @@ wget --output-document=/mnt/target/lib/dracut/modules.d/90void-usb/overlay.sh "$ chmod 744 /mnt/target/lib/dracut/modules.d/90void-usb/overlay.sh >> $LOGFILE 2>&1 echo "done" -echo -n "Adding system-image helper... " +echo -n "Adding system image helpers... " mkdir -p /mnt/target/usr/local/sbin >> $LOGFILE 2>&1 chmod 755 /mnt/target/usr/local/sbin >> $LOGFILE 2>&1 wget --output-document=/mnt/target/usr/local/sbin/system-image "$GIT_REPO_BASE/usr/local/sbin/system-image" >> $LOGFILE 2>&1 chmod 744 /mnt/target/usr/local/sbin/system-image >> $LOGFILE 2>&1 echo " /usr/local/sbin/system-image" >> /mnt/target/etc/rc.shutdown +wget --output-document=/mnt/target/usr/local/sbin/save-image "$GIT_REPO_BASE/usr/local/sbin/save-image" >> $LOGFILE 2>&1 +chmod 744 /mnt/target/usr/local/sbin/save-image >> $LOGFILE 2>&1 echo "done" echo "Adding fstab." diff --git a/usr/local/sbin/save-image b/usr/local/sbin/save-image new file mode 100644 index 0000000..d58a1a8 --- /dev/null +++ b/usr/local/sbin/save-image @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +if [ ! "$(whoami)" = "root" ]; then + echo "$0 needs to run as root!" + exit 1 +fi + +function yesno { + unset DISCARD_ME + while [ -z "$DISCARD_ME" ]; do + read -p "[y/n] " -n1 DISCARD_ME + case "$DISCARD_ME" in + y) + echo "" + return 0 + ;; + n) + echo "" + return 1 + ;; + *) + echo " Please enter y for yes or n for no." + unset DISCARD_ME + ;; + esac + done +} + +if [ "$1" = "--defer" ]; then + touch "/run/void-usb/system-image-auto-confirm-marker" + exit 0 +else + echo "This will cause the system to reboot. Alternatively, you can invoke +$0 with --defer to save the image on next shutdown/reboot. + +Save system image and reboot?" + if yesno; then + touch "/run/void-usb/system-image-auto-confirm-marker" + reboot + else + exit 1 + fi +fi