Revert "apk: limit CONFIG_IPK_FILES_CHECKSUMS config to OPKG"
authorChristian Marangi <ansuelsmth@gmail.com>
Thu, 20 Jun 2024 03:49:21 +0000 (05:49 +0200)
committerChristian Marangi <ansuelsmth@gmail.com>
Thu, 20 Jun 2024 03:52:05 +0000 (05:52 +0200)
This reverts commit 25bbefcdd9424ed1b6ef35a39e84420fc4cce322.

Only the Config-build.in change needed to be merged and this contains
leftover from previous revision of the feature.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
config/Config-build.in
include/package-pack.mk
package/base-files/files/sbin/pkg_check

index 02931a87c6b2cd3c419e58242594908b2813423d..fbeaf89fcd884c1348c0290c27667887819d72b2 100644 (file)
@@ -114,7 +114,6 @@ menu "Global build settings"
        config IPK_FILES_CHECKSUMS
                bool
                prompt "Record files checksums in package metadata"
-               depends on !USE_APK
                help
                  This makes file checksums part of package metadata. It increases size
                  but provides you with pkg_check command to check for flash corruptions.
index 33247be0245ebc9c2876243c7f271a4713ad4a4d..26a32788343c42b90bceaab74cdd4d9ca576a461 100644 (file)
@@ -226,6 +226,15 @@ endif
 
        $(RSTRIP) $$(IDIR_$(1))
 
+    ifneq ($$(CONFIG_IPK_FILES_CHECKSUMS),)
+       (cd $$(IDIR_$(1)); \
+               ( \
+                       find . -type f \! -path ./CONTROL/\* -exec $(MKHASH) sha256 -n \{\} \; 2> /dev/null | \
+                       sed 's|\([[:blank:]]\)\./| \1/|' > $$(IDIR_$(1))/CONTROL/files-sha256sum \
+               ) || true \
+       )
+    endif
+
     ifneq ($$(KEEP_$(1)),)
                @( \
                        keepfiles=""; \
@@ -320,10 +329,6 @@ else
                rm -rf $$(IDIR_$(1))/CONTROL/conffiles; \
        fi
 
-    ifneq ($$(CONFIG_IPK_FILES_CHECKSUMS),)
-       if [ -f $$(IDIR_$(1))/CONTROL/files-sha256sum ]; then mv -f $$(IDIR_$(1))/CONTROL/files-sha256sum $$(IDIR_$(1))/lib/apk/packages/$(1).files-sha256sum; fi
-    endif
-
        if [ -z "$$$$(ls -A $$(IDIR_$(1))/CONTROL 2>/dev/null)" ]; then \
                rm -rf $$(IDIR_$(1))/CONTROL; \
        else \
index dcddbebc7dbebee46e9b62356031827841769589..28e87925aefd476dea7e3accfb0b23eed85eead2 100755 (executable)
@@ -23,13 +23,6 @@ MISSING=""
 SUMMARY=""
 NL="
 "
-if [ -d /usr/lib/opkg ]; then
-       IPKG_INFO_DIR=/usr/lib/opkg/info
-elif [ -d /lib/apk ];
-       IPKG_INFO_DIR=/lib/apk/packages
-else
-       exti 1
-fi
 
 # Arguments parsing
 while expr "x$1" : "x-" > /dev/null; do
@@ -56,12 +49,12 @@ done
 
 # Check all packages by default
 if [ -z "$1" ]; then
-       set $(cd $IPKG_INFO_DIR; for i in *.files-sha256sum; do basename $i .files-sha256sum; done)
+       set $(cd /usr/lib/opkg/info/; for i in *.files-sha256sum; do basename $i .files-sha256sum; done)
 fi
 
 # Iterate over packages
 while [ "$1" ]; do
-       if [ \! -f "$IPKG_INFO_DIR/$1.files-sha256sum" ]; then
+       if [ \! -f "/usr/lib/opkg/info/$1.files-sha256sum" ]; then
                if [ "$ERRFATAL" = no ]; then
                        echo " * No checksums for $1 - skipping"
                        echo
@@ -79,13 +72,13 @@ while [ "$1" ]; do
        fi
        [ $QUIET = yes ] || echo " * Checking package $1:"
        ERR=""
-       CHECK="$(sha256sum -c $IPKG_INFO_DIR/$1.files-sha256sum 2> /dev/null)"
+       CHECK="$(sha256sum -c /usr/lib/opkg/info/$1.files-sha256sum 2> /dev/null)"
 
        # Are the changed files config files?
-       if [ $? -ne 0 ] && [ "$(cat "$IPKG_INFO_DIR/$1.files-sha256sum")" ]; then
+       if [ $? -ne 0 ] && [ "$(cat "/usr/lib/opkg/info/$1.files-sha256sum")" ]; then
                NEWCHECK="$(echo "$CHECK" | grep '^.*: OK$')"
                for i in $(echo "$CHECK" | sed -n 's|^\(.*\): FAILED$|\1|p'); do
-                       if [ "$(grep "^$i\$" "$IPKG_INFO_DIR/$1.conffiles" 2> /dev/null)" ] || \
+                       if [ "$(grep "^$i\$" "/usr/lib/opkg/info/$1.conffiles" 2> /dev/null)" ] || \
                           [ "$(echo "$i" | grep "^/etc/uci-defaults/")" ]; then
                                NEWCHECK="${NEWCHECK}${NL}${i}: CONFIGURED"
                        else
@@ -98,7 +91,7 @@ while [ "$1" ]; do
 
        # Do we have changed files or not?
        if [ -z "$ERR" ]; then
-               [ $QUIET = yes ] || [ ! -s "$IPKG_INFO_DIR/$1.files-sha256sum" ] || echo "$CHECK" | sed 's|^|   - |'
+               [ $QUIET = yes ] || [ ! -s "/usr/lib/opkg/info/$1.files-sha256sum" ] || echo "$CHECK" | sed 's|^|   - |'
                [ $QUIET = yes ] || echo " * Package $1 is ok"
                [ $QUIET = yes ] || echo
        else