diff mbox series

[OpenWrt-Devel] base-files: pass "force" parameter to the "sysupgrade" call

Message ID 20190903124440.11277-1-zajec5@gmail.com
State Accepted
Delegated to: Rafał Miłecki
Headers show
Series [OpenWrt-Devel] base-files: pass "force" parameter to the "sysupgrade" call | expand

Commit Message

Rafał Miłecki Sept. 3, 2019, 12:44 p.m. UTC
From: Rafał Miłecki <rafal@milecki.pl>

This makes sysupgrade work with the most recent procd that validates
firmware before proceeding.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 package/base-files/files/sbin/sysupgrade | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade
index 42f0f6bd22..f106c3c981 100755
--- a/package/base-files/files/sbin/sysupgrade
+++ b/package/base-files/files/sbin/sysupgrade
@@ -360,9 +360,12 @@  if [ -n "$FAILSAFE" ]; then
 	printf '%s\x00%s\x00%s' "$RAM_ROOT" "$IMAGE" "$COMMAND" >/tmp/sysupgrade
 	lock -u /tmp/.failsafe
 else
+	force_attr=""
+	[ $FORCE -eq 1 ] && force_attr="\"force\": true,"
 	ubus call system sysupgrade "{
 		\"prefix\": $(json_string "$RAM_ROOT"),
 		\"path\": $(json_string "$IMAGE"),
+		$force_attr
 		\"command\": $(json_string "$COMMAND"),
 		\"options\": {
 			\"save_config\": $SAVE_CONFIG,