diff --git a/package/Makefile b/package/Makefile
index e0bd75b..7feb05e 100644
--- a/package/Makefile
+++ b/package/Makefile
@@ -27,6 +27,26 @@ ifneq ($(IGNORE_ERRORS),)
   $(curdir)/builddirs-ignore-host-compile := $(package-ignore-subdirs)
 endif
 
+ifeq ($(PKG_RECURSE_BULD),1)
+define PreInstallHooks
+endef
+
+define AddPreInstallHook
+	PreInstallHooks+=$$(newline)$($(1))$$(newline)
+endef
+
+define PostInstallHooks
+endef
+
+define AddPostInstallHook
+	PostInstallHooks+=$$(newline)$($(1))$$(newline)
+endef
+
+# a hook file may invoke AddPreInstallHook and/or AddPostInstallHook
+-include $(TOPDIR)/local/*-hook.mk
+endif
+
+
 ifdef CONFIG_USE_MKLIBS
   define mklibs
 	rm -rf $(TMP_DIR)/mklibs-progs $(TMP_DIR)/mklibs-out
@@ -109,6 +129,7 @@ $(curdir)/install: $(TMP_DIR)/.build $(curdir)/system/opkg/host/install
 	@if [ -d $(TOPDIR)/files ]; then \
 		$(call file_copy,$(TOPDIR)/files/.,$(TARGET_DIR)); \
 	fi
+	-$(MAKE) -f $(TOPDIR)/$(curdir)/Makefile -C $(TARGET_DIR) pre-install-hooks PKG_RECURSE_BUILD=1
 	@mkdir -p $(TARGET_DIR)/etc/rc.d
 	@( \
 		cd $(TARGET_DIR); \
@@ -120,6 +141,7 @@ $(curdir)/install: $(TMP_DIR)/.build $(curdir)/system/opkg/host/install
 			IPKG_INSTROOT=$(TARGET_DIR) $$(which bash) ./etc/rc.common $$script enable; \
 		done || true \
 	)
+	-$(MAKE) -f $(TOPDIR)/$(curdir)/Makefile -C $(TARGET_DIR) post-install-hooks PKG_RECURSE_BUILD=1
 	$(if $(SOURCE_DATE_EPOCH),sed -i "s/Installed-Time: .*/Installed-Time: $(SOURCE_DATE_EPOCH)/" $(TARGET_DIR)/usr/lib/opkg/status)
 	@-find $(TARGET_DIR) -name CVS   | $(XARGS) rm -rf
 	@-find $(TARGET_DIR) -name .svn  | $(XARGS) rm -rf
@@ -184,6 +206,18 @@ endif
 endif
 endif
 
+$(info PKG_RECURSE_BUILD=$(PKG_RECURSE_BUILD))
+
+ifeq ($(PKG_RECURSE_BUILD),1)
+pre-install-hooks:
+	@echo "Running pre-install-hooks"
+	$(call PreInstallHooks)
+
+post-install-hooks:
+	@echo "Running post-install-hooks"
+	$(call PostInstallHooks)
+endif
+
 $(curdir)/preconfig:
 
 $(curdir)/flags-install:= -j1
diff --git a/local/003-sshd-hook.mk b/local/003-sshd-hook.mk
--- a/local/003-sshd-hook.mk	2017-02-01 18:26:38.860000000 -0700
+++ b/local/003-sshd-hook.mk	2017-02-13 14:07:17.975409913 -0700
@@ -0,0 +1,10 @@
+#
+# disable sshd from being run at startup
+#
+
+define PostInstall/sshd
+	rm -f etc/rc.d/S??sshd
+endef
+
+$(eval $(call AddPostInstallHook,PostInstall/sshd))
+
