diff --git a/glibc/PKGBUILD b/glibc/PKGBUILD index 05372f881..2ac8670f2 100644 --- a/glibc/PKGBUILD +++ b/glibc/PKGBUILD @@ -52,6 +52,8 @@ source=(http://chakra.sourceforge.net/sources/${pkgname}/${pkgname}-${pkgver}_${ glibc-2.15-nearbyintf-rounding.patch glibc-2.15-confstr-local-buffer-extent.patch nscd + nscd.service + nscd.tmpfiles locale.gen.txt locale-gen) md5sums=('c0487f4e83db1b9b30d7989fc47dbead' @@ -83,7 +85,9 @@ md5sums=('c0487f4e83db1b9b30d7989fc47dbead' '104300a586580bb340bb70162a196c80' '50dc7006874cbd86ee436044752f5228' '4ed0bb09c3851cd9cb5e39c946a8a334' - 'b587ee3a70c9b3713099295609afde49' + '589d79041aa767a5179eaa4e2737dd3f' + 'f3fb741c73ae5fd46e03beae4e6948c9' + 'bccbe5619e75cf1d97312ec3681c605c' '07ac979b6ab5eeb778d55f041529d623' '476e9113489f93b348b21e144b6a8fcf') @@ -212,9 +216,6 @@ build() { # http://sourceware.org/git/?p=glibc.git;a=commit;h=d6a403f9 patch -p1 -i ${srcdir}/glibc-2.15-confstr-local-buffer-extent.patch - install -dm755 ${pkgdir}/etc - touch ${pkgdir}/etc/ld.so.conf - cd ${srcdir} rm -vRf glibc-build mkdir glibc-build @@ -249,20 +250,25 @@ check() { package() { cd ${srcdir}/glibc-build + + install -dm755 ${pkgdir}/etc + touch ${pkgdir}/etc/ld.so.conf + make install_root=${pkgdir} install rm -f ${pkgdir}/etc/ld.so.{cache,conf} - install -dm755 ${pkgdir}/etc/rc.d - install -dm755 ${pkgdir}/usr/sbin - install -dm755 ${pkgdir}/usr/lib/locale + install -dm755 ${pkgdir}/{etc/rc.d,usr/{sbin,lib/{,locale,systemd/system,tmpfiles.d}}} + install -m644 ${srcdir}/glibc/nscd/nscd.conf ${pkgdir}/etc/nscd.conf + sed -i -e 's/^\tserver-user/#\tserver-user/' ${pkgdir}/etc/nscd.conf install -m755 ${srcdir}/nscd ${pkgdir}/etc/rc.d/nscd + install -m644 ${srcdir}/nscd.service ${pkgdir}/usr/lib/systemd/system + install -m644 ${srcdir}/nscd.tmpfiles ${pkgdir}/usr/lib/tmpfiles.d/nscd.conf + install -m755 ${srcdir}/locale-gen ${pkgdir}/usr/sbin install -m644 ${srcdir}/glibc/posix/gai.conf ${pkgdir}/etc/gai.conf - sed -i -e 's/^\tserver-user/#\tserver-user/' ${pkgdir}/etc/nscd.conf - # create /etc/locale.gen install -m644 ${srcdir}/locale.gen.txt ${pkgdir}/etc/locale.gen sed -i "s|/| |g" ${srcdir}/glibc/localedata/SUPPORTED diff --git a/glibc/nscd b/glibc/nscd index 8b14f2a3f..4b48ab002 100755 --- a/glibc/nscd +++ b/glibc/nscd @@ -1,40 +1,65 @@ #!/bin/bash +daemon_name="nscd" + . /etc/rc.conf . /etc/rc.d/functions -PID=`pidof -o %PPID /usr/sbin/nscd` + +get_pid() { + pidof -o %PPID $daemon_name +} + case "$1" in - start) - stat_busy "Starting nscd" - # create necessary directories if they don't already exist - mkdir -p /var/run/nscd /var/db/nscd 2>/dev/null - # remove stale files - rm -f /var/db/nscd/* /var/run/nscd/* 2>/dev/null - [ -z "$PID" ] && /usr/sbin/nscd - if [ $? -gt 0 ]; then - stat_fail - else - add_daemon nscd - stat_done - fi - ;; - stop) - stat_busy "Stopping nscd" - [ ! -z "$PID" ] && kill $PID &> /dev/null - if [ $? -gt 0 ]; then - stat_fail - else - rm_daemon nscd - stat_done - fi - ;; - restart) - $0 stop - sleep 1 - $0 start - ;; - *) - echo "usage: $0 {start|stop|restart}" + start) + stat_busy "Starting $daemon_name daemon" + PID=$(get_pid) + if [[ -z $PID ]]; then + rm -f /run/$daemon_name.pid + mkdir -p /run/nscd /var/db/nscd + rm -f /run/nscd/* /var/db/nscd/* + $daemon_name + if (( $? > 0 )); then + stat_fail + exit 1 + else + echo $(get_pid) > /var/run/$daemon_name.pid + add_daemon $daemon_name + stat_done + fi + else + stat_fail + exit 1 + fi + ;; + + stop) + stat_busy "Stopping $daemon_name daemon" + PID=$(get_pid) + [[ -n $PID ]] && nscd --shutdown &> /dev/null + if (( $? > 0 )); then + stat_fail + exit 1 + else + rm -f /run/$daemon_name.pid &> /dev/null + rm_daemon $daemon_name + stat_done + fi + ;; + + restart) + $0 stop + sleep 3 + $0 start + ;; + + status) + stat_busy "Checking $daemon_name status"; + ck_status $daemon_name + ;; + + *) + echo "usage: $0 {start|stop|restart|status}" esac + exit 0 diff --git a/glibc/nscd.service b/glibc/nscd.service new file mode 100644 index 000000000..3347817ac --- /dev/null +++ b/glibc/nscd.service @@ -0,0 +1,17 @@ +[Unit] +Description=Name Service Cache Daemon +After=syslog.target + +[Service] +Type=forking +ExecStart=/usr/sbin/nscd +ExecStop=/usr/sbin/nscd --shutdown +ExecReload=/usr/sbin/nscd -i passwd +ExecReload=/usr/sbin/nscd -i group +ExecReload=/usr/sbin/nscd -i hosts +ExecReload=/usr/sbin/nscd -i services +Restart=always +PIDFile=/run/nscd/nscd.pid + +[Install] +WantedBy=multi-user.target diff --git a/glibc/nscd.tmpfiles b/glibc/nscd.tmpfiles new file mode 100644 index 000000000..8a24a785e --- /dev/null +++ b/glibc/nscd.tmpfiles @@ -0,0 +1 @@ +d /run/nscd 0755 root root