system-image: check that the mksquashfs command actually succeeded before overwriting the old image

master
BodgeMaster 2026-03-22 04:34:08 +01:00
parent a84cb829dd
commit 8b98b2e160
1 changed files with 8 additions and 4 deletions

View File

@ -97,10 +97,14 @@ if $DONT_ASK || yesno; then
echo_tty "Building image..." echo_tty "Building image..."
mksquashfs / /run/void-usb/container/new_squashfs.img -b 1M -comp xz -progress -noappend -pf /run/void-usb/system-image-pseudo -ef /run/void-usb/system-image-excludes > $TTY_OR_CONSOLE mksquashfs / /run/void-usb/container/new_squashfs.img -b 1M -comp xz -progress -noappend -pf /run/void-usb/system-image-pseudo -ef /run/void-usb/system-image-excludes > $TTY_OR_CONSOLE
if [ "$?" -ne 0 ]; then
echo_tty "An error ocurred while generating the image. It will be discarded."
sleep 5
else
echo_tty -n "Moving new image in place... " echo_tty -n "Moving new image in place... "
mv /run/void-usb/container/new_squashfs.img /run/void-usb/container/squashfs.img mv /run/void-usb/container/new_squashfs.img /run/void-usb/container/squashfs.img
echo_tty "done" echo_tty "done"
fi
else else
echo_tty "Discarding system changes." echo_tty "Discarding system changes."
fi fi