[arch-commits] Commit in glibc/trunk (5 files)

Allan McRae allan at archlinux.org
Sat Jun 9 05:50:17 UTC 2012


    Date: Saturday, June 9, 2012 @ 01:50:17
  Author: allan
Revision: 161307

add systemd files for ncsd, tidy up nscd rc.d script

Added:
  glibc/trunk/nscd.rcd
    (from rev 161299, glibc/trunk/nscd)
  glibc/trunk/nscd.service
  glibc/trunk/nscd.tmpfiles
Modified:
  glibc/trunk/PKGBUILD
Deleted:
  glibc/trunk/nscd

---------------+
 PKGBUILD      |   25 +++++++++++++--------
 nscd          |   40 ----------------------------------
 nscd.rcd      |   65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 nscd.service  |   17 ++++++++++++++
 nscd.tmpfiles |    1 
 5 files changed, 99 insertions(+), 49 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2012-06-09 05:49:03 UTC (rev 161306)
+++ PKGBUILD	2012-06-09 05:50:17 UTC (rev 161307)
@@ -6,7 +6,7 @@
 
 pkgname=glibc
 pkgver=2.15
-pkgrel=11
+pkgrel=12
 _glibcdate=20111227
 pkgdesc="GNU C Library"
 arch=('i686' 'x86_64')
@@ -50,7 +50,9 @@
         glibc-2.15-nearbyintf-rounding.patch
         glibc-2.15-confstr-local-buffer-extent.patch
         glibc-2.15-testsuite.patch
-        nscd
+        nscd.rcd
+        nscd.service
+        nscd.tmpfiles
         locale.gen.txt
         locale-gen)
 md5sums=('6ffdf5832192b92f98bdd125317c0dfc'
@@ -83,10 +85,13 @@
          '7ff501435078b1a2622124fbeaafc921'
          '8d1023a51e0932681b46440d5f8551ee'
          '6962c3fa29306bfbf6f0d22b19cb825d'
-         'b587ee3a70c9b3713099295609afde49'
+         '589d79041aa767a5179eaa4e2737dd3f'
+         'ad8a9af15ab7eeaa23dc7ee85024af9f'
+         'bccbe5619e75cf1d97312ec3681c605c'
          '07ac979b6ab5eeb778d55f041529d623'
          '476e9113489f93b348b21e144b6a8fcf')
 
+
 mksource() {
   git clone git://sourceware.org/git/glibc.git
   pushd glibc
@@ -269,15 +274,17 @@
 
   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
-  install -m755 ${srcdir}/nscd ${pkgdir}/etc/rc.d/nscd
-  install -m755 ${srcdir}/locale-gen ${pkgdir}/usr/sbin
+  sed -i -e 's/^\tserver-user/#\tserver-user/' ${pkgdir}/etc/nscd.conf
+  install -m755 ${srcdir}/nscd.rcd ${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 -m644 ${srcdir}/glibc/posix/gai.conf ${pkgdir}/etc/gai.conf
 
-  sed -i -e 's/^\tserver-user/#\tserver-user/' ${pkgdir}/etc/nscd.conf
+  install -m755 ${srcdir}/locale-gen ${pkgdir}/usr/sbin
 
   # create /etc/locale.gen
   install -m644 ${srcdir}/locale.gen.txt ${pkgdir}/etc/locale.gen

Deleted: nscd
===================================================================
--- nscd	2012-06-09 05:49:03 UTC (rev 161306)
+++ nscd	2012-06-09 05:50:17 UTC (rev 161307)
@@ -1,40 +0,0 @@
-#!/bin/bash
-
-. /etc/rc.conf
-. /etc/rc.d/functions
-
-PID=`pidof -o %PPID /usr/sbin/nscd`
-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}"  
-esac
-exit 0

Copied: glibc/trunk/nscd.rcd (from rev 161299, glibc/trunk/nscd)
===================================================================
--- nscd.rcd	                        (rev 0)
+++ nscd.rcd	2012-06-09 05:50:17 UTC (rev 161307)
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+daemon_name="nscd"
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+
+get_pid() {
+	pidof -o %PPID $daemon_name
+}
+
+case "$1" in
+	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

Added: nscd.service
===================================================================
--- nscd.service	                        (rev 0)
+++ nscd.service	2012-06-09 05:50:17 UTC (rev 161307)
@@ -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 service
+Restart=always
+PIDFile=/run/nscd/nscd.pid
+ 
+[Install]
+WantedBy=multi-user.target

Added: nscd.tmpfiles
===================================================================
--- nscd.tmpfiles	                        (rev 0)
+++ nscd.tmpfiles	2012-06-09 05:50:17 UTC (rev 161307)
@@ -0,0 +1 @@
+d /run/nscd 0755 root root




More information about the arch-commits mailing list