summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Marko <robimarko@gmail.com>2024-11-21 14:34:03 +0100
committerRobert Marko <robimarko@gmail.com>2024-11-21 17:20:43 +0100
commitfc2ba101089117d72903f9464269da73763ded42 (patch)
tree614173412e3573e424d516649669596bfde1cebc
parent5b6f8353fe2af6c270a30dc8c38791cf03fd265d (diff)
downloadopenwrt-fc2ba101089117d72903f9464269da73763ded42.tar.gz
openwrt-fc2ba101089117d72903f9464269da73763ded42.tar.bz2
openwrt-fc2ba101089117d72903f9464269da73763ded42.zip
include/package-pack: add support for postrm with APK
Currently, postrm scripts are not being executed when package is removed with APK since they are not being included at all. So, lets use APK-s support for post-deinstall scripts and ship our postrm scripts if packages define them. Fixes: d788ab376f85 ("build: add APK package build capabilities") Link: https://github.com/openwrt/openwrt/pull/17023 Signed-off-by: Robert Marko <robimarko@gmail.com>
-rw-r--r--include/package-pack.mk10
1 files changed, 8 insertions, 2 deletions
diff --git a/include/package-pack.mk b/include/package-pack.mk
index 1f1b8c73f9..a36d690901 100644
--- a/include/package-pack.mk
+++ b/include/package-pack.mk
@@ -110,6 +110,13 @@ endif
IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1)
ADIR_$(1):=$(PKG_BUILD_DIR)/apk-$(PKGARCH)/$(1)
KEEP_$(1):=$(strip $(call Package/$(1)/conffiles))
+ APK_SCRIPTS_$(1):=\
+ --script "post-install:$$(ADIR_$(1))/post-install" \
+ --script "pre-deinstall:$$(ADIR_$(1))/pre-deinstall"
+
+ ifdef Package/$(1)/postrm
+ APK_SCRIPTS_$(1)+=--script "post-deinstall:$$(ADIR_$(1))/postrm"
+ endif
TARGET_VARIANT:=$$(if $(ALL_VARIANTS),$$(if $$(VARIANT),$$(filter-out *,$$(VARIANT)),$(firstword $(ALL_VARIANTS))))
ifeq ($(BUILD_VARIANT),$$(if $$(TARGET_VARIANT),$$(TARGET_VARIANT),$(BUILD_VARIANT)))
@@ -360,8 +367,7 @@ else
), \
$$(prov) )" \
$(if $(DEFAULT_VARIANT),--info "provider-priority:100",$(if $(PROVIDES),--info "provider-priority:1")) \
- --script "post-install:$$(ADIR_$(1))/post-install" \
- --script "pre-deinstall:$$(ADIR_$(1))/pre-deinstall" \
+ $$(APK_SCRIPTS_$(1)) \
--info "depends:$$(foreach depends,$$(subst $$(comma),$$(space),$$(subst $$(space),,$$(subst $$(paren_right),,$$(subst $$(paren_left),,$$(Package/$(1)/DEPENDS))))),$$(depends))" \
--files "$$(IDIR_$(1))" \
--output "$$(PACK_$(1))" \