save-image: add a lil helper for setting the auto accept marker for system-image
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.master
parent
fdc54e487f
commit
3e5341dc89
|
|
@ -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
|
chmod 744 /mnt/target/lib/dracut/modules.d/90void-usb/overlay.sh >> $LOGFILE 2>&1
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
echo -n "Adding system-image helper... "
|
echo -n "Adding system image helpers... "
|
||||||
mkdir -p /mnt/target/usr/local/sbin >> $LOGFILE 2>&1
|
mkdir -p /mnt/target/usr/local/sbin >> $LOGFILE 2>&1
|
||||||
chmod 755 /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
|
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
|
chmod 744 /mnt/target/usr/local/sbin/system-image >> $LOGFILE 2>&1
|
||||||
echo "
|
echo "
|
||||||
/usr/local/sbin/system-image" >> /mnt/target/etc/rc.shutdown
|
/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 "done"
|
||||||
|
|
||||||
echo "Adding fstab."
|
echo "Adding fstab."
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
Loading…
Reference in New Issue