summaryrefslogtreecommitdiff
path: root/package/base-files/files/lib
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/lib
parentb2adb9a7b50fd4a887b22facf6795d71a2629397 (diff)
downloadmtk-20170518-a5428244d969fda2b32e24b7cda589c2c65cbf7c.zip
mtk-20170518-a5428244d969fda2b32e24b7cda589c2c65cbf7c.tar.gz
mtk-20170518-a5428244d969fda2b32e24b7cda589c2c65cbf7c.tar.bz2
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/lib')
-rw-r--r--package/base-files/files/lib/preinit/40_run_failsafe_hook6
-rw-r--r--package/base-files/files/lib/preinit/99_10_failsafe_login11
2 files changed, 12 insertions, 5 deletions
diff --git a/package/base-files/files/lib/preinit/40_run_failsafe_hook b/package/base-files/files/lib/preinit/40_run_failsafe_hook
index 7301f77..533b0a9 100644
--- a/package/base-files/files/lib/preinit/40_run_failsafe_hook
+++ b/package/base-files/files/lib/preinit/40_run_failsafe_hook
@@ -5,8 +5,12 @@
run_failsafe_hook() {
[ "$pi_preinit_no_failsafe" = "y" ] && return
if [ "$FAILSAFE" = "true" ]; then
+ lock /tmp/.failsafe
boot_run_hook failsafe
- lock -w /tmp/.failsafe
+ while [ ! -e /tmp/sysupgrade ]; do
+ lock -w /tmp/.failsafe
+ done
+ exit
fi
}
diff --git a/package/base-files/files/lib/preinit/99_10_failsafe_login b/package/base-files/files/lib/preinit/99_10_failsafe_login
index 3147cdc..728c63b 100644
--- a/package/base-files/files/lib/preinit/99_10_failsafe_login
+++ b/package/base-files/files/lib/preinit/99_10_failsafe_login
@@ -8,10 +8,13 @@ failsafe_netlogin () {
}
failsafe_shell() {
- lock /tmp/.failsafe
- ash --login
- echo "Please reboot system when done with failsafe network logins"
- while true; do sleep 1; done
+ local console="$(sed -e 's/ /\n/g' /proc/cmdline | grep '^console=' | head -1 | sed -e 's/^console=//' -e 's/,.*//')"
+ [ -n "$console" ] || console=console
+ [ -c "/dev/$console" ] || return 0
+ while true; do
+ ash --login <"/dev/$console" >"/dev/$console" 2>"/dev/$console"
+ sleep 1
+ done &
}
boot_hook_add failsafe failsafe_netlogin