base-files: exit if mtd write command fails during sysupgrade
authorRafał Miłecki <rafal@milecki.pl>
Mon, 11 Jun 2018 10:52:42 +0000 (12:52 +0200)
committerJo-Philipp Wich <jo@mein.io>
Tue, 18 Dec 2018 08:43:59 +0000 (09:43 +0100)
It avoids confusing situations like:
> Could not get image magic
> Image check failed.
> Upgrade completed
> Rebooting system...

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(backported from 5b2e20807d2b38de1cc4185d15bb4320b8bd743a)

package/base-files/files/lib/upgrade/common.sh

index 38056fd..0cbd2ab 100644 (file)
@@ -222,6 +222,7 @@ default_do_upgrade() {
        else
                get_image "$1" "$2" | mtd write - "${PART_NAME:-image}"
        fi
+       [ $? -ne 0 ] && exit 1
 }
 
 do_upgrade_stage2() {