basefiles: Reword sysupgrade message
[openwrt/staging/chunkeey.git] / package / base-files / files / sbin / sysupgrade
index 3fd612c37572aaf3884ccfb23f7592dbdd66b9f6..482be068d9d9be3d740989f03c54df01719e7a90 100755 (executable)
@@ -55,7 +55,6 @@ Usage: $0 [<upgrade-option>...] <image file or URL>
        $0 [-q] [-i] <backup-command> <file>
 
 upgrade-option:
-       -d <delay>   add a delay before rebooting
        -f <config>  restore configuration from .tar.gz (file or url)
        -i           interactive mode
        -c           attempt to preserve all changed files in /etc/
@@ -97,12 +96,31 @@ EOF
 # prevent messages from clobbering the tarball when using stdout
 [ "$CONF_BACKUP" = "-" ] && export VERBOSE=0
 
+
+list_conffiles() {
+       awk '
+               BEGIN { conffiles = 0 }
+               /^Conffiles:/ { conffiles = 1; next }
+               !/^ / { conffiles = 0; next }
+               conffiles == 1 { print }
+       ' /usr/lib/opkg/status
+}
+
+list_changed_conffiles() {
+       # Cannot handle spaces in filenames - but opkg cannot either...
+       list_conffiles | while read file csum; do
+               [ -r "$file" ] || continue
+
+               echo "${csum}  ${file}" | sha256sum -sc - || echo "$file"
+       done
+}
+
 add_uci_conffiles() {
        local file="$1"
        ( find $(sed -ne '/^[[:space:]]*$/d; /^#/d; p' \
                /etc/sysupgrade.conf /lib/upgrade/keep.d/* 2>/dev/null) \
                -type f -o -type l 2>/dev/null;
-         opkg list-changed-conffiles ) | sort -u > "$file"
+         list_changed_conffiles ) | sort -u > "$file"
        return 0
 }
 
@@ -249,7 +267,7 @@ fi
 run_hooks "" $sysupgrade_pre_upgrade
 
 install_bin /sbin/upgraded
-v "Commencing upgrade. All shell sessions will be closed now."
+v "Commencing upgrade. Closing all shell sessions."
 
 COMMAND='. /lib/functions.sh; include /lib/upgrade; do_upgrade_stage2'