aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/sbin
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2017-04-24 01:31:04 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2017-05-29 23:50:33 +0200
commita5428244d969fda2b32e24b7cda589c2c65cbf7c (patch)
tree25842738cb65cae2a94a53425a72a8fbd394f348 /package/base-files/files/sbin
parentb2adb9a7b50fd4a887b22facf6795d71a2629397 (diff)
downloadupstream-a5428244d969fda2b32e24b7cda589c2c65cbf7c.tar.gz
upstream-a5428244d969fda2b32e24b7cda589c2c65cbf7c.tar.bz2
upstream-a5428244d969fda2b32e24b7cda589c2c65cbf7c.zip
base-files: add support for staged sysupgrades from failsafe mode
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Diffstat (limited to 'package/base-files/files/sbin')
-rwxr-xr-xpackage/base-files/files/sbin/sysupgrade18
1 files changed, 13 insertions, 5 deletions
diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade
index 200a0e520b..809e789f9f 100755
--- a/package/base-files/files/sbin/sysupgrade
+++ b/package/base-files/files/sbin/sysupgrade
@@ -251,8 +251,16 @@ run_hooks "" $sysupgrade_pre_upgrade
install_bin /sbin/upgraded
v "Commencing upgrade. All shell sessions will be closed now."
-ubus call system sysupgrade "{
- \"prefix\": \"$RAM_ROOT\",
- \"path\": $(json_string "$IMAGE"),
- \"command\": \". /lib/functions.sh; include /lib/upgrade; do_upgrade_stage2\"
-}"
+
+COMMAND='. /lib/functions.sh; include /lib/upgrade; do_upgrade_stage2'
+
+if [ -n "$FAILSAFE" ]; then
+ printf '%s\x00%s\x00%s' "$RAM_ROOT" "$IMAGE" "$COMMAND" >/tmp/sysupgrade
+ lock -u /tmp/.failsafe
+else
+ ubus call system sysupgrade "{
+ \"prefix\": $(json_string "$RAM_ROOT"),
+ \"path\": $(json_string "$IMAGE"),
+ \"command\": $(json_string "$COMMAND")
+ }"
+fi