aboutsummaryrefslogtreecommitdiffstats
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 10:01:14 +0100
commit17c0362178caf837680a4631b8d0de94e5393448 (patch)
tree0bf837dafa9c4a8bdcf3d4071c30d94d0303491f
parent2ae9ebf374023dec22dc5c0a97e170db6287587c (diff)
downloadupstream-17c0362178caf837680a4631b8d0de94e5393448.tar.gz
upstream-17c0362178caf837680a4631b8d0de94e5393448.tar.bz2
upstream-17c0362178caf837680a4631b8d0de94e5393448.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>
-rw-r--r--package/base-files/Makefile2
-rwxr-xr-xpackage/base-files/files/sbin/sysupgrade21
2 files changed, 21 insertions, 2 deletions
diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index 3fcf20a844..38d72fd452 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/version.mk
PKG_NAME:=base-files
-PKG_RELEASE:=173.3
+PKG_RELEASE:=173.4
PKG_FLAGS:=nonshared
PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade
index c095ca81c5..71c7faa6db 100755
--- a/package/base-files/files/sbin/sysupgrade
+++ b/package/base-files/files/sbin/sysupgrade
@@ -101,12 +101,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
}