X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/768e3f0496554d89a23b312eb2d50d9af5c2ce62..ff70f4cf192a562c664400e6c20d202b83aa1c14:/package/base-files/files/sbin/sysupgrade diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade index 1210e6e50..cf79114cb 100755 --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -10,6 +10,7 @@ export SAVE_CONFIG=1 export SAVE_OVERLAY=0 export DELAY= export CONF_IMAGE= +export HELP=0 # parse options while [ -n "$1" ]; do @@ -21,6 +22,7 @@ while [ -n "$1" ]; do -n) export SAVE_CONFIG=0;; -c) export SAVE_OVERLAY=1;; -f) export CONF_IMAGE="$2"; shift;; + -h|--help) export HELP=1; break;; -*) echo "Invalid option: $1" exit 1 @@ -36,7 +38,7 @@ export CONF_TAR=/tmp/sysupgrade.tgz export ARGV="$*" export ARGC="$#" -[ -z "$ARGV" ] && { +[ -z "$ARGV" -o $HELP -gt 0 ] && { cat < @@ -48,6 +50,7 @@ Options: -n do not save configuration over reflash -q less verbose -v more verbose + -h / --help display this help EOF exit 1 @@ -55,8 +58,9 @@ EOF add_uci_conffiles() { local file="$1" - ( find /etc/config /etc/passwd /etc/group /etc/dropbear \ - /etc/firewall.user /etc/rc.local -type f; + ( find $(sed -ne '/^[[:space:]]*$/d; /^#/d; p' \ + /etc/sysupgrade.conf /lib/upgrade/keep.d/* 2>/dev/null) \ + -type f 2>/dev/null; opkg list-changed-conffiles ) | sort -u > "$file" return 0 } @@ -123,8 +127,13 @@ elif ask_bool $SAVE_CONFIG "Keep config files over reflash"; then else export SAVE_CONFIG=0 fi + run_hooks "" $sysupgrade_pre_upgrade +kill_remaining TERM +sleep 3 +kill_remaining KILL + if [ -n "$(rootfs_type)" ]; then v "Switching to ramdisk..." run_ramfs '. /etc/functions.sh; include /lib/upgrade; do_upgrade'