log "Update FINISHED"
log "---------------------------------------------"
else
- log "---------------------------------------------"
- log "Update FAILED"
- log "---------------------------------------------"
+ log_err "---------------------------------------------"
+ log_err "Update FAILED"
+ log_err "---------------------------------------------"
mkdir -p /mnt/log 2> /dev/null
if mount /dev/mmcblk0p1 /mnt/log
then
status_uimage="missing"
status_rootfs="missing"
+cleanup()
+{
+ cd /tmp
+ if [ -n "$finalize_mpoint" ]
+ then
+ umount $finalize_mpoint 2> /dev/null || true
+ fi
+ if [ -n "$rootfs_mpoint" ]
+ then
+ umount $rootfs_mpoint 2> /dev/null || true
+ fi
+}
+
mkdir /mnt/ubifs 2> /dev/null || true
if [ ! -e /dev/mmcblk0p1 ]
continue;
fi
+ if [ -x $mpoint/initialize.sh ]
+ then
+ log ""
+ log "running init script.."
+ cd $mpoint
+ if ! ./initialize.sh
+ then
+ log "initialize.sh failed."
+ cleanup
+ false
+ fi
+ log "done."
+ cd /tmp
+ fi
+
for bf in $bootfiles
do
if [ -e $mpoint/$bf ]
log $real_md5
else
log "INCORRECT"
+ cleanup
false
fi
if ! ./finalize.sh
then
log "finalize.sh failed."
+ cleanup
false
fi
log "done."
- cd /tmp
- umount $finalize_mpoint
fi
-if [ -n "$rootfs_mpoint" ]
-then
- umount $rootfs_mpoint 2> /dev/null || true
-fi
+cleanup
exit 0