aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2018-03-06 08:25:32 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2018-03-07 08:49:39 +0100
commit6ed389da85a9259c688aac91c859c804e29c485b (patch)
tree8eda9a47b5f03c0e8cd26af7de6d85e50d87c56a /package/base-files/files
parentd84ac78d6aae9218fe3cc8ffc0d73291c633841a (diff)
downloadupstream-6ed389da85a9259c688aac91c859c804e29c485b.tar.gz
upstream-6ed389da85a9259c688aac91c859c804e29c485b.tar.bz2
upstream-6ed389da85a9259c688aac91c859c804e29c485b.zip
base-files: sysupgrade: do not rely on opkg to list changed conffiles
Many packages use the opkg conffiles field to list configuration files that are to be retained on upgrades. Make this work on systems without opkg. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Diffstat (limited to 'package/base-files/files')
-rwxr-xr-xpackage/base-files/files/sbin/sysupgrade21
1 files changed, 20 insertions, 1 deletions
diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade
index c747c4eaad..bf5428af25 100755
--- a/package/base-files/files/sbin/sysupgrade
+++ b/package/base-files/files/sbin/sysupgrade
@@ -96,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
}