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)))
), \
$$(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))" \