aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2014-09-11 12:27:49 +0000
committerJohn Crispin <blogic@openwrt.org>2014-09-11 12:27:49 +0000
commit3caa9395b5c994b945767c8e528a2afdf24df35e (patch)
treed9ae4715ae0f048afe4f6bd6a501d7e9e00f34e1 /include
parentca5a47c6d5778c5de8e3ed4bd3780bc19fae7fb3 (diff)
downloadmaster-187ad058-3caa9395b5c994b945767c8e528a2afdf24df35e.tar.gz
master-187ad058-3caa9395b5c994b945767c8e528a2afdf24df35e.tar.bz2
master-187ad058-3caa9395b5c994b945767c8e528a2afdf24df35e.zip
ipkg: add a default postinst/prerm script
the postinst script enables/starts the init.d scripts upon package installation and installs the users required by the package. the prerm script stops and disables the init.d scripts. Signed-off-by: John Crispin <blogic@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@42470 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'include')
-rw-r--r--include/package-ipkg.mk17
1 files changed, 14 insertions, 3 deletions
diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index 1caeaa25b6..494444613a 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -16,7 +16,7 @@ IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/opkg
define BuildIPKGVariable
ifdef Package/$(1)/$(2)
$(call shexport,Package/$(1)/$(2))
- $(1)_COMMANDS += var2file "$(call shvar,Package/$(1)/$(2))" $(2);
+ $(1)_COMMANDS += var2file "$(call shvar,Package/$(1)/$(2))" $(2)$(3);
endif
endef
@@ -117,8 +117,8 @@ ifeq ($(DUMP),)
$(eval $(call BuildIPKGVariable,$(1),conffiles))
$(eval $(call BuildIPKGVariable,$(1),preinst))
- $(eval $(call BuildIPKGVariable,$(1),postinst))
- $(eval $(call BuildIPKGVariable,$(1),prerm))
+ $(eval $(call BuildIPKGVariable,$(1),postinst,-pkg))
+ $(eval $(call BuildIPKGVariable,$(1),prerm,-pkg))
$(eval $(call BuildIPKGVariable,$(1),postrm))
$(STAGING_DIR_ROOT)/stamp/.$(1)_installed: $(STAMP_BUILT)
@@ -174,6 +174,17 @@ ifeq ($(DUMP),)
echo -n "Description: "; $(SH_FUNC) getvar $(call shvar,Package/$(1)/description) | sed -e 's,^[[:space:]]*, ,g'; \
) > $$(IDIR_$(1))/CONTROL/control
chmod 644 $$(IDIR_$(1))/CONTROL/control
+ ( \
+ echo "#!/bin/sh"; \
+ echo ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
+ echo "default_postinst \$$$$0 \$$$$@"; \
+ ) > $$(IDIR_$(1))/CONTROL/postinst
+ ( \
+ echo "#!/bin/sh"; \
+ echo ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
+ echo "default_prerm \$$$$0 \$$$$@"; \
+ ) > $$(IDIR_$(1))/CONTROL/prerm
+ chmod 0755 $$(IDIR_$(1))/CONTROL/prerm
$(SH_FUNC) (cd $$(IDIR_$(1))/CONTROL; \
$($(1)_COMMANDS) \
)