[OE-core] [PATCH] glibc: add systemd support
Li xin
lixin.fnst at cn.fujitsu.com
Wed Jun 24 03:14:42 UTC 2015
add systemd service files nscd.service and nscd.socket
Signed-off-by: Li Xin <lixin.fnst at cn.fujitsu.com>
---
meta/recipes-core/glibc/glibc-package.inc | 2 +-
meta/recipes-core/glibc/glibc.inc | 20 +++++++++++++++++++-
meta/recipes-core/glibc/glibc/nscd.service | 16 ++++++++++++++++
meta/recipes-core/glibc/glibc/nscd.socket | 8 ++++++++
meta/recipes-core/glibc/glibc_2.21.bb | 2 ++
5 files changed, 46 insertions(+), 2 deletions(-)
create mode 100644 meta/recipes-core/glibc/glibc/nscd.service
create mode 100644 meta/recipes-core/glibc/glibc/nscd.socket
diff --git a/meta/recipes-core/glibc/glibc-package.inc b/meta/recipes-core/glibc/glibc-package.inc
index 984362e..4897479 100644
--- a/meta/recipes-core/glibc/glibc-package.inc
+++ b/meta/recipes-core/glibc/glibc-package.inc
@@ -47,7 +47,7 @@ FILES_libsotruss = "${libdir}/audit/sotruss-lib.so"
FILES_SOLIBSDEV = "${libdir}/lib*${SOLIBSDEV}"
FILES_${PN}-dev += "${bindir}/rpcgen ${libdir}/*_nonshared.a ${base_libdir}/*_nonshared.a ${base_libdir}/*.o ${datadir}/aclocal"
FILES_${PN}-staticdev += "${libdir}/*.a ${base_libdir}/*.a"
-FILES_nscd = "${sbindir}/nscd*"
+FILES_nscd = "${sbindir}/nscd* ${sysconfdir}/nscd.conf ${sysconfdir}/init.d/nscd ${localstatedir}/db ${systemd_unitdir}/system/nscd.*"
FILES_${PN}-mtrace = "${bindir}/mtrace"
FILES_tzcode = "${bindir}/tzselect ${sbindir}/zic ${sbindir}/zdump"
FILES_${PN}-utils = "${bindir}/* ${sbindir}/*"
diff --git a/meta/recipes-core/glibc/glibc.inc b/meta/recipes-core/glibc/glibc.inc
index da56bc9..4c28461 100644
--- a/meta/recipes-core/glibc/glibc.inc
+++ b/meta/recipes-core/glibc/glibc.inc
@@ -41,7 +41,7 @@ DEPENDS = "virtual/${TARGET_PREFIX}gcc-initial libgcc-initial linux-libc-headers
#RDEPENDS_${PN} += "${@['','libgcc']['nptl' in '${GLIBC_ADDONS}']}"
PROVIDES = "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc"
PROVIDES += "virtual/libintl virtual/libiconv"
-inherit autotools texinfo distro_features_check
+inherit autotools texinfo distro_features_check systemd
require glibc-options.inc
# The main purpose of setting this variable is to prevent users from accidently
@@ -95,4 +95,22 @@ do_configure_append() {
sed -i 's/^OPTION_EGLIBC_NSSWITCH_FIXED_\(.*\)="\(.*\)"$/OPTION_EGLIBC_NSSWITCH_FIXED_\1=\2/' option-groups.config
}
+do_install_append() {
+ install -d ${D}/${sysconfdir}
+ install -m 0644 ${S}/nscd/nscd.conf ${D}/${sysconfdir}/nscd.conf
+ install -d ${D}/${sysconfdir}/init.d
+ install -m 0755 ${S}/nscd/nscd.init ${D}/${sysconfdir}/init.d/nscd
+ install -m 755 -d ${D}/${localstatedir}/db
+ install -m 755 -d ${D}/${localstatedir}/db/nscd
+
+ install -d ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/nscd.service ${D}${systemd_unitdir}/system/
+ install -m 0644 ${WORKDIR}/nscd.socket ${D}${systemd_unitdir}/system/
+ sed -i -e 's, at localstatedir@,${localstatedir},g' ${D}${systemd_unitdir}/system/*
+ sed -i -e 's, at SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/*
+ sed -i -e 's, at base_bindir@,${base_bindir},g' ${D}${systemd_unitdir}/system/*
+}
+
+
GLIBC_ADDONS ?= "nptl,libidn"
+
diff --git a/meta/recipes-core/glibc/glibc/nscd.service b/meta/recipes-core/glibc/glibc/nscd.service
new file mode 100644
index 0000000..014103e
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/nscd.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Name Service Cache Daemon
+After=syslog.target
+
+[Service]
+Type=forking
+ExecStartPre=@base_bindir@/mkdir -p @localstatedir@/run/nscd
+ExecStartPre=@base_bindir@/mkdir -p @localstatedir@/db/nscd
+ExecStart=@SBINDIR@/nscd
+ExecStop=@SBINDIR@/nscd --shutdown
+Restart=always
+PIDFile=@localstatedir@/run/nscd/nscd.pid
+
+[Install]
+WantedBy=multi-user.target
+Also=nscd.socket
diff --git a/meta/recipes-core/glibc/glibc/nscd.socket b/meta/recipes-core/glibc/glibc/nscd.socket
new file mode 100644
index 0000000..fc63453
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/nscd.socket
@@ -0,0 +1,8 @@
+[Unit]
+Description=Name Service Cache Daemon Socket
+
+[Socket]
+ListenDatagram=@localstatedir@/run/nscd/socket
+
+[Install]
+WantedBy=sockets.target
diff --git a/meta/recipes-core/glibc/glibc_2.21.bb b/meta/recipes-core/glibc/glibc_2.21.bb
index 8197c29..4230630 100644
--- a/meta/recipes-core/glibc/glibc_2.21.bb
+++ b/meta/recipes-core/glibc/glibc_2.21.bb
@@ -30,6 +30,8 @@ SRC_URI = "git://sourceware.org/git/glibc.git;branch=${BRANCH} \
file://Fix-__memcpy_chk-on-non-SSE2-CPUs.patch \
${EGLIBCPATCHES} \
${CVEPATCHES} \
+ file://nscd.service \
+ file://nscd.socket \
"
EGLIBCPATCHES = "\
file://timezone-re-written-tzselect-as-posix-sh.patch \
--
1.8.4.2
More information about the Openembedded-core
mailing list