summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuiz Angelo Daros de Luca2025-02-03 23:01:11 +0000
committerHauke Mehrtens2026-04-12 23:29:04 +0000
commit714240997d56f5c7cc3a553280c850ec95bc7437 (patch)
tree80bbd543a117889a98e708ef11102f22bd506762
parent8ab67441c5cc46b95907dd17e9f2b34c88168d65 (diff)
downloadopenwrt-714240997d56f5c7cc3a553280c850ec95bc7437.tar.gz
base-files: sysupgrade: -u option was broken with apk
The check of files from packages was only checking opkg files. Check for apk as well and fail if both are missing. Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com> Link: https://github.com/openwrt/openwrt/pull/17847 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> (cherry picked from commit 37c5aade23a415a15f829c80ce6cdc36a2e13396)
-rwxr-xr-xpackage/base-files/files/sbin/sysupgrade12
1 files changed, 10 insertions, 2 deletions
diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade
index a5004de476..12575e0b1f 100755
--- a/package/base-files/files/sbin/sysupgrade
+++ b/package/base-files/files/sbin/sysupgrade
@@ -201,12 +201,17 @@ build_list_of_backup_overlay_files() {
# do not backup files from packages, except those listed
# in conffiles and keep.d
- {
+ if [ -f /usr/lib/opkg/status ]; then
find /usr/lib/opkg/info -type f -name "*.list" -exec cat {} \;
find /usr/lib/opkg/info -type f -name "*.control" -exec sed \
-ne '/^Alternatives/{s/^Alternatives: //;s/, /\n/g;p}' {} \; |
cut -f2 -d:
- } | grep -v -x -F -f $conffiles |
+ elif [ -d /lib/apk/packages ]; then
+ find /lib/apk/packages -type f -name "*.list" -exec cat {} \;
+ find /lib/apk/packages -type f -name "*.alternatives" -exec cat {} \; |
+ tr ' ' '\n' |
+ cut -f2 -d:
+ fi | grep -v -x -F -f $conffiles |
grep -v -x -F -f $keepfiles | sort -u > "$packagesfiles"
rm -f "$keepfiles" "$conffiles"
fi
@@ -302,6 +307,9 @@ create_backup_archive() {
\( -exec test -f /overlay/upper/{} \; -exec echo {} overlay \; \) -o \
\( -exec echo {} unknown \; \) \
\) | sed -e 's,.*/,,;s/\.list /\t/')" || ret=1
+ else
+ echo "Failed to detect installed packages metadata files." >&2
+ ret=1
fi
fi
fi