[OpenWrt-Devel] [PATCH 2/2] base-files: drop support for NAND upgrade in platform_pre_upgrade()

Rafał Miłecki zajec5 at gmail.com
Tue Jul 2 10:10:57 EDT 2019


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

With bcm53xx switched to the new procedure there is no more need for
keeping that backward compatibility code.

Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
 package/base-files/files/lib/upgrade/common.sh | 4 +---
 package/base-files/files/lib/upgrade/nand.sh   | 9 ---------
 package/base-files/files/lib/upgrade/stage2    | 5 +----
 3 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh
index bbedeefd26..7c4a2af08f 100644
--- a/package/base-files/files/lib/upgrade/common.sh
+++ b/package/base-files/files/lib/upgrade/common.sh
@@ -238,9 +238,7 @@ default_do_upgrade() {
 
 do_upgrade_stage2() {
 	v "Performing system upgrade..."
-	if [ -n "$do_upgrade" ]; then
-		eval "$do_upgrade"
-	elif type 'platform_do_upgrade' >/dev/null 2>/dev/null; then
+	if type 'platform_do_upgrade' >/dev/null 2>/dev/null; then
 		platform_do_upgrade "$IMAGE"
 	else
 		default_do_upgrade "$IMAGE"
diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh
index 99916a4e96..9f258a82c5 100644
--- a/package/base-files/files/lib/upgrade/nand.sh
+++ b/package/base-files/files/lib/upgrade/nand.sh
@@ -280,15 +280,6 @@ nand_upgrade_tar() {
 
 # Recognize type of passed file and start the upgrade process
 nand_do_upgrade() {
-	if [ -n "$IS_PRE_UPGRADE" ]; then
-		# Previously, nand_do_upgrade was called from the platform_pre_upgrade
-		# hook; this piece of code handles scripts that haven't been
-		# updated. All scripts should gradually move to call nand_do_upgrade
-		# from platform_do_upgrade instead.
-		export do_upgrade="nand_do_upgrade '$1'"
-		return
-	fi
-
 	local file_type=$(identify $1)
 
 	if type 'platform_nand_pre_upgrade' >/dev/null 2>/dev/null; then
diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2
index bdc12c7426..05d9214377 100755
--- a/package/base-files/files/lib/upgrade/stage2
+++ b/package/base-files/files/lib/upgrade/stage2
@@ -136,10 +136,7 @@ sleep 1
 
 
 if [ -n "$IMAGE" ] && type 'platform_pre_upgrade' >/dev/null 2>/dev/null; then
-	IS_PRE_UPGRADE=1 platform_pre_upgrade "$IMAGE"
-
-	# Needs to be unset again because of busybox weirdness ...
-	IS_PRE_UPGRADE=
+	platform_pre_upgrade "$IMAGE"
 fi
 
 if [ -n "$(rootfs_type)" ]; then
-- 
2.21.0


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


More information about the openwrt-devel mailing list