Remove old backup OS image before moving new OS image to reduce disk space requirements.

This commit is contained in:
jumperfly 2016-11-19 02:45:35 +00:00 committed by Sam Liddell
parent 8b704ea70f
commit 4ee6e24687

View file

@ -42,6 +42,9 @@ if findfs $NEWIMG_DEVICE &> /dev/null; then
# Mount device containing current image RW and replace with updated image
echo "Detected a new OS image, copying to image partition..."
mount -t ext4 $IMG_DEVICE /mnt/img
if [[ -e /mnt/img/$OS_IMAGE-old ]]; then
rm -f /mnt/img/$OS_IMAGE-old
fi
mv -f /mnt/newimg/$OS_IMAGE /mnt/img/$OS_IMAGE-new
mv -f /mnt/img/$OS_IMAGE /mnt/img/$OS_IMAGE-old
mv /mnt/img/$OS_IMAGE-new /mnt/img/$OS_IMAGE