From 38b3a9f075b91a9140ecc56fdfb2ae0eef98e495 Mon Sep 17 00:00:00 2001
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 5 Apr 2013 20:01:02 +0200
Subject: [PATCH] Simplify service activation

---
 builder/Makefile | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/builder/Makefile b/builder/Makefile
index 3f1ce6840..f05f27af2 100644
--- a/builder/Makefile
+++ b/builder/Makefile
@@ -74,20 +74,11 @@ $(eval $(call merge-lists,GLUON_PACKAGES,GLUON_DEFAULT_PACKAGES GLUON_SITE_PACKA
 
 include $(INCLUDE_DIR)/image.mk
 
-define EnableInitscript
-	( \
-		grep '#!/bin/sh /etc/rc.common' $(1) >/dev/null && \
-		IPKG_INSTROOT=$(TARGET_DIR) $(which bash) ./etc/rc.common $(1) enable || \
-		true \
-	)
-endef
-
-define FileOrigin
-	$(firstword $(shell $(OPKG) search $(1)))
-endef
+EnableInitscript = ! grep -q '\#!/bin/sh /etc/rc.common' $(1) || bash ./etc/rc.common $(1) enable
+FileOrigin = $(firstword $(shell $(OPKG) search $(1)))
 
 enable_initscripts: FORCE
-	cd $(TARGET_DIR) && ( \
+	cd $(TARGET_DIR) && ( export IPKG_INSTROOT=$(TARGET_DIR); \
 		$(foreach script,$(wildcard $(TARGET_DIR)/etc/init.d/*), \
 			$(if $(filter $(ENABLE_INITSCRIPTS_FROM),$(call FileOrigin,$(script))),$(call EnableInitscript,$(script));) \
 		) : \
-- 
GitLab