busybox: Install udhcpc script only if enabled
authorMaxime Hadjinlian <maxime.hadjinlian@gmail.com>
Sat, 11 Jul 2015 15:51:05 +0000 (17:51 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sat, 11 Jul 2015 15:56:04 +0000 (17:56 +0200)
It doesn't make sense to install such a scripts if UDHCPC was not
selected.
Also remove the entry from BUSYBOX_PERMISSIONS as the install command
does the same job.

Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/busybox/busybox.mk

index 51b35bc8fd50f5f395c108b46fc09f6c37eb7762..92874cd4db301157e47669c0955d0fdb6ce92dad 100644 (file)
@@ -52,7 +52,6 @@ BUSYBOX_KCONFIG_OPTS = $(BUSYBOX_MAKE_OPTS)
 
 define BUSYBOX_PERMISSIONS
        /bin/busybox                     f 4755 0  0 - - - - -
-       /usr/share/udhcpc/default.script f 755  0  0 - - - - -
 endef
 
 # If mdev will be used for device creation enable it and copy S10mdev to /etc/init.d
@@ -127,6 +126,15 @@ define BUSYBOX_INTERNAL_SHADOW_PASSWORDS
 endef
 endif
 
+define BUSYBOX_INSTALL_UDHCPC_SCRIPT
+       if grep -q CONFIG_UDHCPC=y $(@D)/.config; then \
+               $(INSTALL) -m 0755 -D package/busybox/udhcpc.script \
+                       $(TARGET_DIR)/usr/share/udhcpc/default.script; \
+               $(INSTALL) -m 0755 -d \
+                       $(TARGET_DIR)/usr/share/udhcpc/default.script.d; \
+       fi
+endef
+
 ifeq ($(BR2_INIT_BUSYBOX),y)
 define BUSYBOX_SET_INIT
        $(call KCONFIG_ENABLE_OPT,CONFIG_INIT,$(BUSYBOX_BUILD_CONFIG))
@@ -189,10 +197,7 @@ endef
 
 define BUSYBOX_INSTALL_TARGET_CMDS
        $(BUSYBOX_MAKE_ENV) $(MAKE) $(BUSYBOX_MAKE_OPTS) -C $(@D) install
-       $(INSTALL) -m 0755 -D package/busybox/udhcpc.script \
-               $(TARGET_DIR)/usr/share/udhcpc/default.script
-       $(INSTALL) -m 0755 -d \
-               $(TARGET_DIR)/usr/share/udhcpc/default.script.d
+       $(BUSYBOX_INSTALL_UDHCPC_SCRIPT)
        $(BUSYBOX_INSTALL_MDEV_CONF)
 endef