build: fix opkg flags in rootfs
authorJustin Klaassen <justin@tidylabs.app>
Thu, 18 Jan 2024 15:36:22 +0000 (15:36 +0000)
committerRobert Marko <robimarko@gmail.com>
Fri, 16 Feb 2024 09:01:19 +0000 (10:01 +0100)
By default opkg sets the "user" flag when a package is installed,
which resulted in most packages in the rootfs having this flag
set incorrectly. This patch removes the "user" flag from all
installed packages when preparing the rootfs image.

Fixes: #14427
Signed-off-by: Justin Klaassen <justin@tidylabs.app>
include/rootfs.mk

index f2ed648d2f3eb51a31115d4d3d22dc4982959d97..2128aefc2abda82d6f36bf7278a580ddb3922655 100644 (file)
@@ -87,6 +87,11 @@ define prepare_rootfs
                        fi; \
                done || true \
        )
+       awk -i inplace \
+               '/^Status:/ { \
+                       if ($$3 == "user") { $$3 = "ok" } \
+                       else { sub(/,\<user\>|\<user\>,/, "", $$3) } \
+               }1' $(1)/usr/lib/opkg/status
        $(if $(SOURCE_DATE_EPOCH),sed -i "s/Installed-Time: .*/Installed-Time: $(SOURCE_DATE_EPOCH)/" $(1)/usr/lib/opkg/status)
        @-find $(1) -name CVS -o -name .svn -o -name .git -o -name '.#*' | $(XARGS) rm -rf
        rm -rf \