projects
/
lede.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
libubox: fix host build on macOS
[lede.git]
/
package
/
base-files
/
files
/
sbin
/
sysupgrade
diff --git
a/package/base-files/files/sbin/sysupgrade
b/package/base-files/files/sbin/sysupgrade
index 56e9a92424556d8a981e3f313561becaf6228e3e..c095ca81c50c71021af2dc04a561ac22f6b7442b 100755
(executable)
--- a/
package/base-files/files/sbin/sysupgrade
+++ b/
package/base-files/files/sbin/sysupgrade
@@
-1,5
+1,6
@@
#!/bin/sh
. /lib/functions.sh
#!/bin/sh
. /lib/functions.sh
+. /lib/functions/system.sh
# initialize defaults
RAMFS_COPY_BIN="" # extra programs for temporary ramfs root
# initialize defaults
RAMFS_COPY_BIN="" # extra programs for temporary ramfs root
@@
-9,6
+10,7
@@
export INTERACTIVE=0
export VERBOSE=1
export SAVE_CONFIG=1
export SAVE_OVERLAY=0
export VERBOSE=1
export SAVE_CONFIG=1
export SAVE_OVERLAY=0
+export SAVE_PARTITIONS=1
export DELAY=
export CONF_IMAGE=
export CONF_BACKUP_LIST=0
export DELAY=
export CONF_IMAGE=
export CONF_BACKUP_LIST=0
@@
-28,6
+30,7
@@
while [ -n "$1" ]; do
-q) export VERBOSE="$(($VERBOSE - 1))";;
-n) export SAVE_CONFIG=0;;
-c) export SAVE_OVERLAY=1;;
-q) export VERBOSE="$(($VERBOSE - 1))";;
-n) export SAVE_CONFIG=0;;
-c) export SAVE_OVERLAY=1;;
+ -p) export SAVE_PARTITIONS=0;;
-b|--create-backup) export CONF_BACKUP="$2" NEED_IMAGE=1; shift;;
-r|--restore-backup) export CONF_RESTORE="$2" NEED_IMAGE=1; shift;;
-l|--list-backup) export CONF_BACKUP_LIST=1; break;;
-b|--create-backup) export CONF_BACKUP="$2" NEED_IMAGE=1; shift;;
-r|--restore-backup) export CONF_RESTORE="$2" NEED_IMAGE=1; shift;;
-l|--list-backup) export CONF_BACKUP_LIST=1; break;;
@@
-61,6
+64,7
@@
upgrade-option:
-i interactive mode
-c attempt to preserve all changed files in /etc/
-n do not save configuration over reflash
-i interactive mode
-c attempt to preserve all changed files in /etc/
-n do not save configuration over reflash
+ -p do not attempt to restore the partition table after flash.
-T | --test
Verify image and config .tar.gz but do not actually flash.
-F | --force
-T | --test
Verify image and config .tar.gz but do not actually flash.
-F | --force
@@
-101,14
+105,20
@@
add_uci_conffiles() {
local file="$1"
( find $(sed -ne '/^[[:space:]]*$/d; /^#/d; p' \
/etc/sysupgrade.conf /lib/upgrade/keep.d/* 2>/dev/null) \
local file="$1"
( find $(sed -ne '/^[[:space:]]*$/d; /^#/d; p' \
/etc/sysupgrade.conf /lib/upgrade/keep.d/* 2>/dev/null) \
- -type f 2>/dev/null;
+ -type f
-o -type l
2>/dev/null;
opkg list-changed-conffiles ) | sort -u > "$file"
return 0
}
add_overlayfiles() {
local file="$1"
opkg list-changed-conffiles ) | sort -u > "$file"
return 0
}
add_overlayfiles() {
local file="$1"
- find /overlay/etc/ -type f | sed \
+ if [ -d /overlay/upper ]; then
+ local overlaydir="/overlay/upper"
+ else
+ local overlaydir="/overlay"
+ fi
+ find $overlaydir/etc/ -type f -o -type l | sed \
+ -e 's,^/overlay\/upper/,/,' \
-e 's,^/overlay/,/,' \
-e '\,/META_[a-zA-Z0-9]*$,d' \
-e '\,/functions.sh$,d' \
-e 's,^/overlay/,/,' \
-e '\,/META_[a-zA-Z0-9]*$,d' \
-e '\,/functions.sh$,d' \
@@
-118,13
+128,16
@@
add_overlayfiles() {
}
# hooks
}
# hooks
-sysupgrade_image_check="platform_check_image"
+sysupgrade_image_check="fwtool_check_image platform_check_image"
+sysupgrade_pre_upgrade="fwtool_pre_upgrade"
[ $SAVE_OVERLAY = 0 -o ! -d /overlay/etc ] && \
sysupgrade_init_conffiles="add_uci_conffiles" || \
sysupgrade_init_conffiles="add_overlayfiles"
include /lib/upgrade
[ $SAVE_OVERLAY = 0 -o ! -d /overlay/etc ] && \
sysupgrade_init_conffiles="add_uci_conffiles" || \
sysupgrade_init_conffiles="add_overlayfiles"
include /lib/upgrade
+[ "$1" = "nand" ] && nand_upgrade_stage2 $@
+
do_save_conffiles() {
local conf_tar="${1:-$CONF_TAR}"
do_save_conffiles() {
local conf_tar="${1:-$CONF_TAR}"
@@
-207,12
+220,22
@@
fi
run_hooks "" $sysupgrade_pre_upgrade
run_hooks "" $sysupgrade_pre_upgrade
+# Some platforms/devices may want different sysupgrade process, e.g. without
+# killing processes yet or calling ubus system upgrade method.
+# This is needed e.g. on NAND devices where we just want to trigger stage1 at
+# this point.
+if type 'platform_pre_upgrade' >/dev/null 2>/dev/null; then
+ platform_pre_upgrade "$ARGV"
+fi
+
ubus call system upgrade
touch /tmp/sysupgrade
ubus call system upgrade
touch /tmp/sysupgrade
-kill_remaining TERM
-sleep 3
-kill_remaining KILL
+if [ ! -f /tmp/failsafe ] ; then
+ kill_remaining TERM
+ sleep 3
+ kill_remaining KILL
+fi
if [ -n "$(rootfs_type)" ]; then
v "Switching to ramdisk..."
if [ -n "$(rootfs_type)" ]; then
v "Switching to ramdisk..."