[OpenWrt-Devel] [PATCH] base-files: exit if mtd write command fails during sysupgrade

Rafał Miłecki zajec5 at gmail.com
Mon Jun 11 06:52:42 EDT 2018


From: Rafał Miłecki <rafal at milecki.pl>

It avoids confusing situations like:
> Could not get image magic
> Image check failed.
> Upgrade completed
> Rebooting system...

Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
 package/base-files/files/lib/upgrade/common.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh
index 5f5c9dc8a3..2305bbea19 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() {
-- 
2.13.7


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/listinfo/openwrt-devel


More information about the openwrt-devel mailing list