Clean up initscript activation code

This commit is contained in:
Matthias Schiffer 2013-02-18 21:16:10 +01:00
parent b2b4ac9093
commit 441d991156

View File

@ -81,16 +81,21 @@ assemble_image: FORCE
$(MAKE) package_postinst $(MAKE) package_postinst
$(MAKE) build_image $(MAKE) build_image
define EnableInitscript
cd $(TARGET_DIR) && ( \
grep '#!/bin/sh /etc/rc.common' $(1) >/dev/null && \
IPKG_INSTROOT=$(TARGET_DIR) $(which bash) ./etc/rc.common $$script enable || \
true \
)
endef
package_install: FORCE package_install: FORCE
@echo
@echo Installing packages...
$(OPKG) install $(PACKAGE_DIR)/libc_*.ipk $(OPKG) install $(PACKAGE_DIR)/libc_*.ipk
$(OPKG) install $(PACKAGE_DIR)/kernel_*.ipk $(OPKG) install $(PACKAGE_DIR)/kernel_*.ipk
$(OPKG) install $(BUILD_PACKAGES) $(OPKG) install $(BUILD_PACKAGES)
rm -f $(TARGET_DIR)/usr/lib/opkg/lists/* rm -f $(TARGET_DIR)/usr/lib/opkg/lists/* $(TARGET_DIR)/tmp/opkg.lock
copy_files: FORCE copy_files: FORCE
@echo
@echo Copying extra files @echo Copying extra files
@( cd $(USER_FILES); find -type f ) | \ @( cd $(USER_FILES); find -type f ) | \
( cd $(TARGET_DIR); while :; do \ ( cd $(TARGET_DIR); while :; do \
@ -103,19 +108,9 @@ copy_files: FORCE
$(CP) $(USER_FILES)/* $(TARGET_DIR)/ $(CP) $(USER_FILES)/* $(TARGET_DIR)/
package_postinst: FORCE package_postinst: FORCE
@echo for script in $(TARGET_DIR)/etc/init.d/*; do \
@echo Cleaning up $(call EnableInitscript,$$script); \
@rm -f $(TARGET_DIR)/tmp/opkg.lock done || true
@echo
@echo Activating init scripts
@( \
cd $(TARGET_DIR); \
for script in ./etc/init.d/*; do \
grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \
IPKG_INSTROOT=$(TARGET_DIR) $(which bash) ./etc/rc.common $$script enable; \
done || true; \
)
$(if $(CONFIG_CLEAN_IPKG),rm -rf $(TARGET_DIR)/usr/lib/opkg)
include $(INCLUDE_DIR)/image.mk include $(INCLUDE_DIR)/image.mk