diff mbox series

[2/4] glibc: only install nscd if it's been enabled

Message ID 20260708173651.1435387-2-ross.burton@arm.com
State New
Headers show
Series [1/4] glibc: inherit update-rc.d | expand

Commit Message

Ross Burton July 8, 2026, 5:36 p.m. UTC
Whilst the actual nscd binary won't be installed if the PACKAGECONFIG is
disabled, we were still installing the init scripts and configuration
files.  These should be wrapped with PACKAGECONFIG checks.

${localstatedir}/db and makedbs.sh are part of libnss-db not nscd, so
ensure they're still always installed.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/recipes-core/glibc/glibc-package.inc | 41 +++++++++++++----------
 1 file changed, 23 insertions(+), 18 deletions(-)
diff mbox series

Patch

diff --git a/meta/recipes-core/glibc/glibc-package.inc b/meta/recipes-core/glibc/glibc-package.inc
index d4941a21a1..3d721d8f69 100644
--- a/meta/recipes-core/glibc/glibc-package.inc
+++ b/meta/recipes-core/glibc/glibc-package.inc
@@ -98,16 +98,20 @@  do_install() {
 		rm -f ${D}${infodir}/dir
 	fi
 
-	install -d ${D}${sysconfdir}/init.d
-	install -d ${D}${localstatedir}/db/nscd
-	install -m 0755 ${S}/nscd/nscd.init ${D}${sysconfdir}/init.d/nscd
-	install -m 0755 ${S}/nscd/nscd.conf ${D}${sysconfdir}/nscd.conf
+	install -d ${D}${localstatedir}/db
 	install -m 0755 ${UNPACKDIR}/makedbs.sh ${D}${localstatedir}/db
-	sed -i "s%daemon%start-stop-daemon --start --exec%g" ${D}${sysconfdir}/init.d/nscd
-	sed -i "s|\(enable-cache\t\+netgroup\t\+\)yes|\1no|" ${D}${sysconfdir}/nscd.conf
 
-	install -d ${D}${systemd_system_unitdir}
-	install -m 0644 ${S}/nscd/nscd.service ${D}${systemd_system_unitdir}/
+	if ${@bb.utils.contains('PACKAGECONFIG', 'nscd', 'true', 'false', d)}; then
+		install -d ${D}${sysconfdir}/init.d
+		install -d ${D}${localstatedir}/db/nscd
+		install -m 0755 ${S}/nscd/nscd.init ${D}${sysconfdir}/init.d/nscd
+		install -m 0755 ${S}/nscd/nscd.conf ${D}${sysconfdir}/nscd.conf
+		sed -i "s%daemon%start-stop-daemon --start --exec%g" ${D}${sysconfdir}/init.d/nscd
+		sed -i "s|\(enable-cache\t\+netgroup\t\+\)yes|\1no|" ${D}${sysconfdir}/nscd.conf
+
+		install -d ${D}${systemd_system_unitdir}
+		install -m 0644 ${S}/nscd/nscd.service ${D}${systemd_system_unitdir}/
+	fi
 
 	# The dynamic loader will have been installed into
 	# ${base_libdir}. However, if that isn't going to end up being
@@ -132,18 +136,19 @@  def get_libc_fpu_setting(bb, d):
     return ""
 
 do_install:append:class-target() {
-	if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
-		install -d ${D}${nonarch_libdir}/tmpfiles.d
-		echo "d /run/nscd 755 root root -" \
-			> ${D}${nonarch_libdir}/tmpfiles.d/nscd.conf
-	fi
+	if ${@bb.utils.contains('PACKAGECONFIG', 'nscd', 'true', 'false', d)}; then
+		if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+			install -d ${D}${nonarch_libdir}/tmpfiles.d
+			echo "d /run/nscd 755 root root -" \
+				> ${D}${nonarch_libdir}/tmpfiles.d/nscd.conf
+		fi
 
-	if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
-		install -d ${D}${sysconfdir}/default/volatiles
-		echo "d root root 0755 /var/run/nscd none" \
-			> ${D}${sysconfdir}/default/volatiles/98_nscd
+		if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
+			install -d ${D}${sysconfdir}/default/volatiles
+			echo "d root root 0755 /var/run/nscd none" \
+				> ${D}${sysconfdir}/default/volatiles/98_nscd
+		fi
 	fi
-
 }
 do_install:append:aarch64 () {
 	do_install_armmultilib