packages: unscd/unscd.spec - initscript, logrotate, config, and the fun stuff

glen glen at pld-linux.org
Thu Jan 5 00:01:52 CET 2012


Author: glen                         Date: Wed Jan  4 23:01:52 2012 GMT
Module: packages                      Tag: HEAD
---- Log message:
- initscript, logrotate, config, and the fun stuff

---- Files affected:
packages/unscd:
   unscd.spec (1.3 -> 1.4) 

---- Diffs:

================================================================
Index: packages/unscd/unscd.spec
diff -u packages/unscd/unscd.spec:1.3 packages/unscd/unscd.spec:1.4
--- packages/unscd/unscd.spec:1.3	Wed Dec 28 16:36:40 2011
+++ packages/unscd/unscd.spec	Thu Jan  5 00:01:47 2012
@@ -2,11 +2,27 @@
 Summary:	Single threaded NSCD implementation
 Name:		unscd
 Version:	0.47
-Release:	0.1
+Release:	0.2
 License:	GPL v2
 Group:		Networking/Daemons
 Source0:	http://busybox.net/~vda/unscd/nscd-%{version}.c
 # Source0-md5:	90af0b57648d2199209051f0d57ba286
+Source1:	nscd.init
+Source2:	nscd.sysconfig
+Source3:	nscd.logrotate
+Source4:	nscd.conf
+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)
 
 %description
@@ -20,20 +36,57 @@
 sed -ne '/Description:/,/\*\*\*/p' %{SOURCE0} > README
 
 %build
-%{__cc} -o %{name} %{rpmcflags} -Os %{rpmcppflags} %{rpmldflags} -Wall -Wunused-parameter -Wl,--sort-section -Wl,alignment -Wl,--sort-common %{SOURCE0}
+%{__cc} -o nscd %{rpmcflags} -Os %{rpmcppflags} %{rpmldflags} -Wall -Wunused-parameter -Wl,--sort-section -Wl,alignment -Wl,--sort-common %{SOURCE0}
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT%{_sbindir}
-install -p %{name} $RPM_BUILD_ROOT%{_sbindir}
+install -d $RPM_BUILD_ROOT{%{_sbindir},/var/log,/var/run/nscd,/etc/{logrotate.d,rc.d/init.d,sysconfig}}
+install -p nscd $RPM_BUILD_ROOT%{_sbindir}
+install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/nscd
+cp -a %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/nscd
+cp -a %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/nscd
+cp -a %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}
+: > $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 README
-%attr(755,root,root) %{_sbindir}/%{name}
+%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
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/nscd
+%attr(640,root,root) %ghost /var/log/nscd
+%dir /var/run/nscd
 
 %define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
 %changelog
@@ -41,6 +94,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.4  2012/01/04 23:01:47  glen
+- initscript, logrotate, config, and the fun stuff
+
 Revision 1.3  2011/12/28 15:36:40  glen
 - too much macros
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/unscd/unscd.spec?r1=1.3&r2=1.4&f=u



More information about the pld-cvs-commit mailing list