init script cleanup, use /etc/rc.d/ for enabled scripts, /etc/init.d/<pkgname> (enable|disable) manages symlinks
[openwrt.org/openwrt.git] / package / Makefile
blob:a/package/Makefile -> blob:b/package/Makefile
--- a/package/Makefile
+++ b/package/Makefile
@@ -55,6 +55,13 @@
 install:
 	rm -rf $(BUILD_DIR)/root
 	$(MAKE) install-targets
+	@( \
+		cd $(BUILD_DIR)/root; \
+		for script in ./etc/init.d/*; do \
+			grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \
+			IPKG_INSTROOT=$(BUILD_DIR)/root $(which bash) ./etc/rc.common $$script enable; \
+		done; \
+	)
 
 index: $(PACKAGE_DIR)/Packages
 

comments