diff --git a/src/init b/src/init index 49727e3..14b8ef6 100755 --- a/src/init +++ b/src/init @@ -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