WIFI2680: Revert inactivefw if sysupgrade fails

Signed-off-by: Owen Anderson <owenthomasanderson@gmail.com>
This commit is contained in:
Owen Anderson 2021-06-18 16:03:37 -04:00 committed by Rick Sommerville
parent d6d45ba609
commit 78b1f77a53

View File

@ -34,11 +34,14 @@ fi
# Set the current version as inactive before the upgrade
FW_VERSION=`sed -n 's/FW_IMAGE_ACTIVE:\(.*\)/\1/p' < /usr/opensync/.versions`
FW_BACKUP=$(uci get system.tip.inactivefw)
uci set system.tip.inactivefw="${FW_VERSION}"
uci commit
uci commit system
/sbin/sysupgrade $IMGFILE
if [ "$?" != "0" ] ; then
uci set system.tip.inactivefw="${FW_BACKUP}"
uci commit system
echo "$0: Sysupgrade failed."
rm /tmp/sysupgrade.meta
rm /tmp/upgrade.*