瀏覽代碼

Backport sysupgrade patches preventing hangs on certain sysupgrade failures

Matthias Schiffer 7 年之前
父節點
當前提交
808723b9fb

+ 8 - 6
patches/lede/0012-procd-switch-to-master-branch.patch → patches/lede/0012-procd-switch-to-latest-master.patch

@@ -1,19 +1,21 @@
 From: Matthias Schiffer <mschiffer@universe-factory.net>
 Date: Sat, 8 Jul 2017 14:44:00 +0200
-Subject: procd: switch to master branch
+Subject: procd: switch to latest master
 
 diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile
-index 70515958cd5002841fd9698b7a7f4aec01ddfb3b..cead3b9b7a5f83879a1aee08ab0463049dd228f4 100644
+index 70515958cd5002841fd9698b7a7f4aec01ddfb3b..2a1fed4e6e2388806ee4230af2872b4bcc8f1613 100644
 --- a/package/system/procd/Makefile
 +++ b/package/system/procd/Makefile
-@@ -13,8 +13,8 @@ PKG_RELEASE:=1
+@@ -12,9 +12,9 @@ PKG_RELEASE:=1
+ 
  PKG_SOURCE_PROTO:=git
  PKG_SOURCE_URL=$(LEDE_GIT)/project/procd.git
- PKG_SOURCE_DATE:=2017-06-19
+-PKG_SOURCE_DATE:=2017-06-19
 -PKG_SOURCE_VERSION:=89918c8cb78e651ee0922f13a96b7f25fc2f285a
 -PKG_MIRROR_HASH:=fad1a37227f85070f6a49a37ea1e98c22c066c91f16ad26898152972eb0c6a91
-+PKG_SOURCE_VERSION:=453116e08e6a9349374bbff427b75f57ce5387c9
-+PKG_MIRROR_HASH:=a0d5c1ddbd2ba63d52125fa5a815d48a3bfb1b1e0a6b85f3335af8a873ed58fc
++PKG_SOURCE_DATE:=2017-07-13
++PKG_SOURCE_VERSION:=d749b2a3507517ff0fe39f7dac69f44ce20c56a2
++PKG_MIRROR_HASH:=388c9f8ac28c922bb8f7889d5bfe11d9afd1bee96243bb5b77897dd1a13b3a43
  CMAKE_INSTALL:=1
  
  PKG_LICENSE:=GPL-2.0

+ 1 - 1
patches/lede/0016-procd-remove-procd-nand-package.patch

@@ -435,7 +435,7 @@ index 0000000000000000000000000000000000000000..6bd2005344c081df20e5a330a69e49e3
 +	nand_upgrade_stage1
 +}
 diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile
-index cead3b9b7a5f83879a1aee08ab0463049dd228f4..2a42db1fc034b554860393cfd9b17ed8423d7bc4 100644
+index 2a1fed4e6e2388806ee4230af2872b4bcc8f1613..ac0e525aed8f72b52cac892b360b3be1edcd7e1d 100644
 --- a/package/system/procd/Makefile
 +++ b/package/system/procd/Makefile
 @@ -22,11 +22,9 @@ PKG_LICENSE_FILES:=

+ 33 - 0
patches/lede/0031-base-files-upgrade-correctly-handle-nand_do_upgrade-argument-passed-from-preupgrade.patch

@@ -0,0 +1,33 @@
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Mon, 10 Jul 2017 10:35:19 +0200
+Subject: base-files: upgrade: correctly handle nand_do_upgrade argument passed from preupgrade
+
+Fixes: 30f61a34b4cf "base-files: always use staged sysupgrade"
+Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
+
+diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh
+index fc59bf2323498d332159b00eb7ab443bfe6b147e..c8b71015c2e44210696a4e28a5b7babbd0233184 100644
+--- a/package/base-files/files/lib/upgrade/common.sh
++++ b/package/base-files/files/lib/upgrade/common.sh
+@@ -211,7 +211,7 @@ default_do_upgrade() {
+ do_upgrade_stage2() {
+ 	v "Performing system upgrade..."
+ 	if [ -n "$do_upgrade" ]; then
+-		$do_upgrade "$IMAGE"
++		eval "$do_upgrade"
+ 	elif type 'platform_do_upgrade' >/dev/null 2>/dev/null; then
+ 		platform_do_upgrade "$IMAGE"
+ 	else
+diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh
+index 1e69c8f9657b39adf2a2c33bd9bac9303bcbc3d7..72f0fe0e10312e74ce085ad53f0adceb921fd013 100644
+--- a/package/base-files/files/lib/upgrade/nand.sh
++++ b/package/base-files/files/lib/upgrade/nand.sh
+@@ -289,7 +289,7 @@ nand_do_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
++		export do_upgrade="nand_do_upgrade '$1'"
+ 		return
+ 	fi
+ 

+ 42 - 0
patches/lede/0032-base-files-upgrade-don-t-loop-forever-trying-to-kill-processes.patch

@@ -0,0 +1,42 @@
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Thu, 13 Jul 2017 00:19:32 +0200
+Subject: base-files: upgrade: don't loop forever trying to kill processes
+
+When processes don't die on SIGKILL (usually because of kernel bugs), it's
+better to give up instead of looping forever.
+
+upgraded will trigger a reboot in this case (and if this fails, a hardware
+watchdog will eventually time out and reset the system, if present).
+
+Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
+
+diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2
+index bdbb8926643287f48a4ae62c5d1d4b4a29130859..097ad63adfecdd70019acaa5b652d2056e774c3f 100755
+--- a/package/base-files/files/lib/upgrade/stage2
++++ b/package/base-files/files/lib/upgrade/stage2
+@@ -87,6 +87,8 @@ switch_to_ramfs() {
+ }
+ 
+ kill_remaining() { # [ <signal> [ <loop> ] ]
++	local loop_limit=10
++
+ 	local sig="${1:-TERM}"
+ 	local loop="${2:-0}"
+ 	local run=true
+@@ -117,8 +119,15 @@ kill_remaining() { # [ <signal> [ <loop> ] ]
+ 
+ 			[ $loop -eq 1 ] && run=true
+ 		done
++
++		let loop_limit--
++		[ $loop_limit -eq 0 ] && {
++			echo
++			echo "Failed to kill all processes."
++			exit 1
++		}
+ 	done
+-	echo ""
++	echo
+ }
+ 
+