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>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user