aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/lib/upgrade/nand.sh
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2017-04-22 00:54:50 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2017-05-29 23:50:32 +0200
commit30f61a34b4cfd2c676fea4a919e089d6a77254e9 (patch)
tree7871075ece4c004f08f90da8f9a4692d11ae782c /package/base-files/files/lib/upgrade/nand.sh
parent393817df5d7046fadf137f9b0a363cb00551d2de (diff)
downloadupstream-30f61a34b4cfd2c676fea4a919e089d6a77254e9.tar.gz
upstream-30f61a34b4cfd2c676fea4a919e089d6a77254e9.tar.bz2
upstream-30f61a34b4cfd2c676fea4a919e089d6a77254e9.zip
base-files: always use staged sysupgrade
Support for the -d and -p options is dropped; it may be added again at some point by adding these flags to the ubus sysupgrade call. A downside of this is that we get a lot less information about the progress of the upgrade: as soon as the actual upgrade starts, all shell sessions are killed to allow unmounting the root filesystem. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Diffstat (limited to 'package/base-files/files/lib/upgrade/nand.sh')
-rw-r--r--package/base-files/files/lib/upgrade/nand.sh60
1 files changed, 10 insertions, 50 deletions
diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh
index 9c831df3b4..894964e178 100644
--- a/package/base-files/files/lib/upgrade/nand.sh
+++ b/package/base-files/files/lib/upgrade/nand.sh
@@ -283,7 +283,16 @@ nand_upgrade_tar() {
}
# Recognize type of passed file and start the upgrade process
-nand_do_upgrade_stage2() {
+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
+ return
+ fi
+
local file_type=$(identify $1)
if type 'platform_nand_pre_upgrade' >/dev/null 2>/dev/null; then
@@ -299,45 +308,6 @@ nand_do_upgrade_stage2() {
esac
}
-nand_upgrade_stage2() {
- [ $1 = "nand" ] && {
- [ -f "$2" ] && {
- touch /tmp/sysupgrade
-
- killall -9 telnetd
- killall -9 dropbear
- killall -9 ash
-
- kill_remaining TERM
- sleep 3
- kill_remaining KILL
-
- sleep 1
-
- if [ -n "$(rootfs_type)" ]; then
- v "Switching to ramdisk..."
- run_ramfs ". /lib/functions.sh; include /lib/upgrade; nand_do_upgrade_stage2 $2"
- else
- nand_do_upgrade_stage2 $2
- fi
- return 0
- }
- echo "Nand upgrade failed"
- exit 1
- }
-}
-
-nand_upgrade_stage1() {
- [ -f /tmp/sysupgrade-nand-path ] && {
- path="$(cat /tmp/sysupgrade-nand-path)"
- [ "$SAVE_CONFIG" != 1 -a -f "$CONF_TAR" ] &&
- rm $CONF_TAR
-
- ubus call system nandupgrade "{\"prefix\": \"$RAM_ROOT\", \"path\": \"$path\" }"
- exit 0
- }
-}
-
# Check if passed file is a valid one for NAND sysupgrade. Currently it accepts
# 3 types of files:
# 1) UBI - should contain an ubinized image, header is checked for the proper
@@ -364,13 +334,3 @@ nand_do_platform_check() {
return 0
}
-
-# Start NAND upgrade process
-#
-# $(1): file to be used for upgrade
-nand_do_upgrade() {
- echo -n $1 > /tmp/sysupgrade-nand-path
- install_bin /sbin/upgraded
- ln -s "$RAM_ROOT"/sbin/upgraded /tmp/upgraded
- nand_upgrade_stage1
-}