base-files: bring back nand_do_upgrade_success
authorDaniel Golle <daniel@makrotopia.org>
Sun, 30 Oct 2022 20:22:06 +0000 (20:22 +0000)
committerDaniel Golle <daniel@makrotopia.org>
Sun, 30 Oct 2022 20:26:12 +0000 (20:26 +0000)
Several Broadcom targets were using the nand_do_upgrade_success
shell function which has been removed by commit e25e6d8e54
("base-files: fix and clean up nand sysupgrade code"). Refactor the
new nand_do_upgrade to bring back nand_do_upgrade_success with the
behavior expected by those users.

Fixes: e25e6d8e54 ("base-files: fix and clean up nand sysupgrade code")
Reported-by: Chen Minqiang <ptpt52@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
package/base-files/files/lib/upgrade/nand.sh

index d9cfeede9c98bb360f59cd543f98962245db2b60..1019b9927c0287d09f3a2ed45225436c38018eee 100644 (file)
@@ -418,12 +418,20 @@ nand_do_upgrade() {
        local file="$1"
 
        sync
-       if nand_do_flash_file "$file" && nand_do_restore_config && sync; then
+       nand_do_flash_file "$file" && nand_do_upgrade_success
+       nand_do_upgrade_failed
+}
+
+nand_do_upgrade_success() {
+       if nand_do_restore_config && sync; then
                echo "sysupgrade successful"
                umount -a
                reboot -f
        fi
+       nand_do_upgrade_failed
+}
 
+nand_do_upgrade_failed() {
        sync
        echo "sysupgrade failed"
        # Should we reboot or bring up some failsafe mode instead?