From: Rafał Miłecki Date: Mon, 11 Jun 2018 10:52:42 +0000 (+0200) Subject: base-files: exit if mtd write command fails during sysupgrade X-Git-Tag: v18.06.2~233 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=21bcc90b1021d6137b89ebd02454c871f34ecd5d;p=openwrt%2Fstaging%2Fpepe2k.git base-files: exit if mtd write command fails during sysupgrade It avoids confusing situations like: > Could not get image magic > Image check failed. > Upgrade completed > Rebooting system... Signed-off-by: Rafał Miłecki (backported from 5b2e20807d2b38de1cc4185d15bb4320b8bd743a) --- diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index 38056fd346..0cbd2ab3a6 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -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() {