[OpenWrt-Devel] [PATCH][RFT ar71xx] procd: get rid of /tmp/sysupgrade-nand-path magic

Rafał Miłecki zajec5 at gmail.com
Wed Apr 8 17:39:25 EDT 2015


Signed-off-by: Rafał Miłecki <zajec5 at gmail.com>
---
 package/system/procd/files/nand.sh | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/package/system/procd/files/nand.sh b/package/system/procd/files/nand.sh
index 0ed1b63..dfa1ee6 100644
--- a/package/system/procd/files/nand.sh
+++ b/package/system/procd/files/nand.sh
@@ -312,17 +312,15 @@ nand_upgrade_stage2() {
 	}
 }
 
+# $(1): file to be used for upgrade
 nand_upgrade_stage1() {
-	[ -f /tmp/sysupgrade-nand-path ] && {
-		path="$(cat /tmp/sysupgrade-nand-path)"
-		[ "$SAVE_CONFIG" != 1 -a -f "$CONF_TAR" ] &&
-			rm $CONF_TAR
+	local path="$1"
+	[ "$SAVE_CONFIG" != 1 -a -f "$CONF_TAR" ] &&
+		rm $CONF_TAR
 
-		ubus call system nandupgrade "{\"path\": \"$path\" }"
-		exit 0
-	}
+	ubus call system nandupgrade "{\"path\": \"$path\" }"
+	exit 0
 }
-append sysupgrade_pre_upgrade nand_upgrade_stage1
 
 # Check if passed file is a valid one for NAND sysupgrade. Currently it accepts
 # 3 types of files:
@@ -348,9 +346,6 @@ nand_do_platform_check() {
 		return 1
 	}
 
-	echo -n $2 > /tmp/sysupgrade-nand-path
-	cp /sbin/upgraded /tmp/
-
 	return 0
 }
 
@@ -358,7 +353,6 @@ nand_do_platform_check() {
 #
 # $(1): file to be used for upgrade
 nand_do_upgrade() {
-	echo -n $1 > /tmp/sysupgrade-nand-path
 	cp /sbin/upgraded /tmp/
-	nand_upgrade_stage1
+	nand_upgrade_stage1 "$1"
 }
-- 
1.8.4.5
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list