[packages/gnscd] new, created from unscd package

glen glen at pld-linux.org
Tue Sep 4 21:22:02 CEST 2012


commit 449341d538ea0a142410e9545c1fa9860fef90d5
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Tue Sep 4 22:21:43 2012 +0300

    new, created from unscd package

 gnscd.spec     | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 nscd.conf      |  66 +++++++++++++++++++++++++++++++
 nscd.init      | 100 +++++++++++++++++++++++++++++++++++++++++++++++
 nscd.logrotate |   7 ++++
 nscd.sysconfig |   4 ++
 nscd.tmpfiles  |   1 +
 6 files changed, 298 insertions(+)
---
diff --git a/gnscd.spec b/gnscd.spec
new file mode 100644
index 0000000..b664450
--- /dev/null
+++ b/gnscd.spec
@@ -0,0 +1,120 @@
+# TODO
+# - x86_64 warning is important?
+#  thread.c: In function 'handle_client_thread':
+#  thread.c:303:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
+#  thread.c: In function 'dispatch_client':
+#  thread.c:346:64: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
+%define		svnrev	6
+Summary:	NSCD (Name Service Caching Daemon) Google reimplementation of GNU nscd
+Name:		gnscd
+Version:	1.0.3
+Release:	0.1
+License:	GPL v2
+Group:		Networking/Daemons
+# use get-source.sh
+Source0:	%{name}-%{svnrev}.tar.bz2
+# Source0-md5:	2f0f325ccb10c50c6ec5c63cabced836
+Source1:	nscd.init
+Source2:	nscd.sysconfig
+Source3:	nscd.logrotate
+Source4:	nscd.conf
+Source6:	nscd.tmpfiles
+URL:		https://code.google.com/p/gnscd/
+BuildRequires:	sed >= 4.0
+Provides:	group(nscd)
+Requires(post):	fileutils
+Requires(post,preun):	/sbin/chkconfig
+Requires(postun):	/usr/sbin/groupdel
+Requires(postun):	/usr/sbin/userdel
+Requires(pre):	/bin/id
+Requires(pre):	/usr/bin/getgid
+Requires(pre):	/usr/sbin/groupadd
+Requires(pre):	/usr/sbin/useradd
+Requires:	rc-scripts >= 0.2.0
+Provides:	user(nscd)
+Obsoletes:	nscd
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+# glibc private symbols
+%define		_noautoreq		libc.so.6(GLIBC_PRIVATE)
+
+%description
+A daemon which handles passwd, group and host lookups for running
+programs and caches the results for the next query. You only need this
+package if you are using slow Name Services like LDAP, NIS or NIS+.
+
+gnscd is Google reimplementation of GNU nscd, rewritten with different
+networking and database code. Additionally, it listens on both
+/var/run/nscd/socket and the older path /var/run/.nscd_socket, making
+the nscd-compat wrapper daemon unnecessary.
+
+It should mostly be a drop-in replacement for existing installs using
+nscd.
+
+%prep
+%setup -qc
+mv %{name}/* .
+
+%{__sed} -i -e 's,gcc,$(CC),' src/Makefile
+
+%build
+%{__make} -C src \
+	CC="%{__cc}" \
+	ARCH=exe \
+	CFLAGS="%{rpmcflags} -D_GNU_SOURCE" \
+	LDFLAGS="-lpthread %{rpmldflags}"
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_sbindir},%{_mandir}/man8,/var/log,/var/run/nscd,/etc/{logrotate.d,rc.d/init.d,sysconfig},%{systemdtmpfilesdir}}
+install -p src/gnscd.exe $RPM_BUILD_ROOT%{_sbindir}/nscd
+install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/nscd
+cp -p %{name}.8 $RPM_BUILD_ROOT%{_mandir}/man8
+echo '.so man8/nscd.8' >  $RPM_BUILD_ROOT%{_mandir}/man8/nscd.8
+cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/nscd
+cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/nscd
+cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}
+cp -p %{SOURCE6} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/nscd.conf
+: > $RPM_BUILD_ROOT/var/log/nscd
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%pre
+%groupadd -P nscd -g 144 -r nscd
+%useradd -P nscd -u 144 -r -d /tmp -s /bin/false -c "Name Service Cache Daemon" -g nscd nscd
+
+%post
+if [ ! -f /var/log/nscd ]; then
+	umask 027
+	touch /var/log/nscd
+	chown root:root /var/log/nscd
+	chmod 640 /var/log/nscd
+fi
+/sbin/chkconfig --add nscd
+%service nscd restart "Name Service Cache Daemon"
+
+%preun
+if [ "$1" = "0" ]; then
+	%service nscd stop
+	/sbin/chkconfig --del nscd
+fi
+
+%postun
+if [ "$1" = "0" ]; then
+	%userremove nscd
+	%groupremove nscd
+fi
+
+%files
+%defattr(644,root,root,755)
+%doc debian/changelog
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/nscd
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/nscd.conf
+%attr(754,root,root) /etc/rc.d/init.d/nscd
+%attr(755,root,root) %{_sbindir}/nscd
+%{_mandir}/man8/*nscd.8*
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/nscd
+%attr(640,root,root) %ghost /var/log/nscd
+%{systemdtmpfilesdir}/nscd.conf
+%dir /var/run/nscd
diff --git a/nscd.conf b/nscd.conf
new file mode 100644
index 0000000..e195469
--- /dev/null
+++ b/nscd.conf
@@ -0,0 +1,66 @@
+#
+# /etc/nscd.conf
+#
+# An example Name Service Cache config file.  This file is needed by nscd.
+#
+# Legal entries are:
+#
+#	logfile			<file>
+#	debug-level		<level>
+#	threads			<initial #threads to use>
+#	max-threads		<maximum #threads to use>
+#	server-user             <user to run server as instead of root>
+#		server-user is ignored if nscd is started with -S parameters
+#       stat-user               <user who is allowed to request statistics>
+#	reload-count		unlimited|<number>
+#	paranoia		<yes|no>
+#	restart-interval	<time in seconds>
+#
+#       enable-cache		<service> <yes|no>
+#	positive-time-to-live	<service> <time in seconds>
+#	negative-time-to-live   <service> <time in seconds>
+#       suggested-size		<service> <prime number>
+#	check-files		<service> <yes|no>
+#	persistent		<service> <yes|no>
+#	shared			<service> <yes|no>
+#	auto-propagate		<service> <yes|no>
+#
+# Currently supported cache names (services): passwd, group, hosts
+#
+
+
+	logfile			/var/log/nscd
+	threads			4
+	max-threads		32
+	server-user		nscd
+	stat-user		root
+	debug-level		0
+#	reload-count		5
+	paranoia		no
+#	restart-interval	3600
+
+	enable-cache		passwd		yes
+	positive-time-to-live	passwd		600
+	negative-time-to-live	passwd		20
+	suggested-size		passwd		211
+	check-files		passwd		yes
+	persistent		passwd		yes
+	shared			passwd		yes
+	auto-propagate		passwd		yes
+
+	enable-cache		group		yes
+	positive-time-to-live	group		3600
+	negative-time-to-live	group		60
+	suggested-size		group		211
+	check-files		group		yes
+	persistent		group		yes
+	shared			group		yes
+	auto-propagate		group		yes
+
+	enable-cache		hosts		yes
+	positive-time-to-live	hosts		3600
+	negative-time-to-live	hosts		20
+	suggested-size		hosts		211
+	check-files		hosts		yes
+	persistent		hosts		yes
+	shared			hosts		yes
diff --git a/nscd.init b/nscd.init
new file mode 100755
index 0000000..4aa4925
--- /dev/null
+++ b/nscd.init
@@ -0,0 +1,100 @@
+#!/bin/sh
+#
+# nscd:		Starts the Name Switch Cache Daemon
+#
+# chkconfig:	345 30 80
+# description:	This is a daemon which handles passwd and group lookups \
+#		for running programs and cache the results for the next \
+#		query. You should start this daemon only if you use \
+#		slow Services like NIS or NIS+
+# processname:	nscd
+# config:	/etc/nscd.conf
+#
+
+# Sanity checks.
+[ -f /etc/nscd.conf ] || exit 0
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+# Get sysconfig
+[ -f /etc/sysconfig/nscd ] && . /etc/sysconfig/nscd
+
+start() {
+	if [ ! -f /var/lock/subsys/nscd ]; then
+		msg_starting "Name Switch Cache Daemon"
+		daemon /usr/sbin/nscd
+		RETVAL=$?
+		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/nscd
+	else
+		msg_already_running "Name Switch Cache Daemon"
+	fi
+}
+
+stop() {
+	if [ -f /var/lock/subsys/nscd ]; then
+		msg_stopping "Name Switch Cache Daemon"
+		busy
+		/usr/sbin/nscd -K >/dev/null
+		rm -f /var/lock/subsys/nscd >/dev/null 2>&1
+		ok
+	else
+		msg_not_running "Name Switch Cache Daemon"
+	fi
+}
+
+condrestart() {
+	if [ -f /var/lock/subsys/nscd ]; then
+		stop
+		start
+	else
+		msg_not_running "Name Switch Cache Daemon"
+		RETVAL=$1
+	fi
+}
+
+# return true if service is considered "up"
+# otherwise lockfile in subsys must exist
+is_service_up() {
+	[ -f /var/lock/subsys/"$1" ]
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+	start
+	;;
+  stop)
+	stop
+	;;
+  restart)
+	stop
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+  force-reload)
+	condrestart 7
+	;;
+  reload)
+	if is_service_up nscd; then
+		for db in passwd group hosts; do
+			show "Invalidating %s cache" $db; busy
+			nscd -i $db >/dev/null && ok || fail
+		done
+	else
+		msg_not_running "Name Switch Cache Daemon"
+	fi
+	;;
+  status)
+	status nscd
+	exit $?
+	;;
+  *)
+	msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
+	exit 3
+esac
+
+exit $RETVAL
diff --git a/nscd.logrotate b/nscd.logrotate
new file mode 100644
index 0000000..26c3ff6
--- /dev/null
+++ b/nscd.logrotate
@@ -0,0 +1,7 @@
+/var/log/nscd {
+	sharedscripts
+
+	postrotate
+		/sbin/service nscd try-restart >/dev/null
+	endscript
+}
diff --git a/nscd.sysconfig b/nscd.sysconfig
new file mode 100644
index 0000000..8e4b039
--- /dev/null
+++ b/nscd.sysconfig
@@ -0,0 +1,4 @@
+# Customized settings for nscd
+
+# Define nice level for nscd
+SERVICE_RUN_NICE_LEVEL="+0"
diff --git a/nscd.tmpfiles b/nscd.tmpfiles
new file mode 100644
index 0000000..3bbd71f
--- /dev/null
+++ b/nscd.tmpfiles
@@ -0,0 +1 @@
+d /var/run/nscd 0755 root root -
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/gnscd.git/commitdiff/449341d538ea0a142410e9545c1fa9860fef90d5



More information about the pld-cvs-commit mailing list