system/skeleton: make nsswitch install conditional
authorGustavo Zacarias <gustavo@zacarias.com.ar>
Mon, 20 Oct 2014 12:28:05 +0000 (09:28 -0300)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sat, 25 Oct 2014 10:48:17 +0000 (12:48 +0200)
Don't blindly install the /etc/nsswitch.conf file, it's useless for
toolchains that aren't (e)glibc-based and misleading.
Make the installation conditional on a (e)glibc toolchain.

[Thomas: use $(INSTALL) instead of cp.]

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/glibc/nsswitch.conf [new file with mode: 0644]
system/skeleton/etc/nsswitch.conf [deleted file]
toolchain/toolchain.mk

diff --git a/package/glibc/nsswitch.conf b/package/glibc/nsswitch.conf
new file mode 100644 (file)
index 0000000..d81e2f0
--- /dev/null
@@ -0,0 +1,17 @@
+# /etc/nsswitch.conf
+#
+# Example configuration of GNU Name Service Switch functionality.
+# If you have the `glibc-doc-reference' and `info' packages installed, try:
+# `info libc "Name Service Switch"' for information about this file.
+
+passwd:         files
+group:          files
+shadow:         files
+hosts:          files dns
+networks:       files
+
+protocols:      files
+services:       files
+ethers:         files
+rpc:            files
+
diff --git a/system/skeleton/etc/nsswitch.conf b/system/skeleton/etc/nsswitch.conf
deleted file mode 100644 (file)
index d81e2f0..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-# /etc/nsswitch.conf
-#
-# Example configuration of GNU Name Service Switch functionality.
-# If you have the `glibc-doc-reference' and `info' packages installed, try:
-# `info libc "Name Service Switch"' for information about this file.
-
-passwd:         files
-group:          files
-shadow:         files
-hosts:          files dns
-networks:       files
-
-protocols:      files
-services:       files
-ethers:         files
-rpc:            files
-
index 8fe06ffa5bd1f1b5400e0258a75dc2580d2d42b9..3f9900ba185c87f064a2c0628eef266d98c4a428 100644 (file)
@@ -3,6 +3,16 @@
 # TARGET_FINALIZE_HOOKS, to be applied just after all packages
 # have been built.
 
+# Install default nsswitch.conf file if the skeleton doesn't provide it
+ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)
+define GLIBC_COPY_NSSWITCH_FILE
+       $(Q)if [ ! -f "$(TARGET_DIR)/etc/nsswitch.conf" ]; then \
+               $(INSTALL) -D -m 0644 package/glibc/nsswitch.conf $(TARGET_DIR)/etc/nsswitch.conf ; \
+       fi
+endef
+TARGET_FINALIZE_HOOKS += GLIBC_COPY_NSSWITCH_FILE
+endif
+
 # Install the gconv modules
 ifeq ($(BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY),y)
 GCONV_LIBS = $(call qstrip,$(BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_LIST))