[openwrt/openwrt] include/package-pack: actually call default_postinist/prerm when using APK

LEDE Commits lede-commits at lists.infradead.org
Thu Nov 21 08:20:48 PST 2024


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/5b6f8353fe2af6c270a30dc8c38791cf03fd265d

commit 5b6f8353fe2af6c270a30dc8c38791cf03fd265d
Author: Robert Marko <robimarko at gmail.com>
AuthorDate: Wed Nov 20 13:51:53 2024 +0100

    include/package-pack: actually call default_postinist/prerm when using APK
    
    Currently, when you install a package that ships uci-defaults scripts they
    are not getting executed during package installation.
    
    For example, if you install a new LuCI theme it ships a uci-defaults script
    to add it to the UCI LuCI config so the theme is actually selectable but
    that does not happen until the device is rebooted so that uci-defaults
    script is actually executed.
    
    It turns out that the recipe for post-install is the issue since it will
    include contents of postinst-pkg before the call to default_postinist.
    This is an issue since postinst-pkg will exit with code 0 before we ever
    reach the call to default_postinist.
    
    So, lets simply make the call to default_postinist before postinst-pkg
    inclusion which is what OPKG based installation does.
    
    The same issue affects pre-deinstall script but its not actually being hit
    since we dont seem to be actually even generating prerm-pkg scripts but
    lets fix this theoretical issue as well.
    
    Fixes: #16987
    Fixes: d788ab376f85 ("build: add APK package build capabilities")
    Link: https://github.com/openwrt/openwrt/pull/17023
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 include/package-pack.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/package-pack.mk b/include/package-pack.mk
index 3ac7a036f9..1f1b8c73f9 100644
--- a/include/package-pack.mk
+++ b/include/package-pack.mk
@@ -294,8 +294,8 @@ else
 		echo 'export root="$$$${IPKG_INSTROOT}"'; \
 		echo 'export pkgname="$(1)"'; \
 		echo "add_group_and_user"; \
-		[ ! -f $$(ADIR_$(1))/postinst-pkg ] || cat "$$(ADIR_$(1))/postinst-pkg"; \
 		echo "default_postinst"; \
+		[ ! -f $$(ADIR_$(1))/postinst-pkg ] || cat "$$(ADIR_$(1))/postinst-pkg"; \
 	) > $$(ADIR_$(1))/post-install;
 
 	( \
@@ -304,8 +304,8 @@ else
 		echo ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
 		echo 'export root="$$$${IPKG_INSTROOT}"'; \
 		echo 'export pkgname="$(1)"'; \
-		[ ! -f $$(ADIR_$(1))/prerm-pkg ] || cat "$$(ADIR_$(1))/prerm-pkg"; \
 		echo "default_prerm"; \
+		[ ! -f $$(ADIR_$(1))/prerm-pkg ] || cat "$$(ADIR_$(1))/prerm-pkg"; \
 	) > $$(ADIR_$(1))/pre-deinstall;
 
 	if [ -n "$(USERID)" ]; then echo $(USERID) > $$(IDIR_$(1))/lib/apk/packages/$(1).rusers; fi;




More information about the lede-commits mailing list