SPECS: smokeping.spec - run as "smokeping" user. - do not generate config. ...

kosmo kosmo at pld-linux.org
Tue Nov 11 14:03:40 CET 2008


Author: kosmo                        Date: Tue Nov 11 13:03:40 2008 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- run as "smokeping" user.
- do not generate config.
- do not start service during installation.

---- Files affected:
SPECS:
   smokeping.spec (1.55 -> 1.56) 

---- Diffs:

================================================================
Index: SPECS/smokeping.spec
diff -u SPECS/smokeping.spec:1.55 SPECS/smokeping.spec:1.56
--- SPECS/smokeping.spec:1.55	Wed Nov  5 19:07:53 2008
+++ SPECS/smokeping.spec	Tue Nov 11 14:03:34 2008
@@ -1,15 +1,13 @@
 # $Revision$, $Date$
 # TODO
-# - generated config does not always match the used webserver vhost (don't autogenerate it at all?)
 # - finish -cgi and main files, afaik templates/ needed only by -cgi
 # - use .patch not decruft()
-# - IMPORTANT: use other user than root for daemon (uid=stats perhaps)
 %include	/usr/lib/rpm/macros.perl
 Summary:	Smokeping - a latency grapher that uses rrdtool
 Summary(pl.UTF-8):	Smokeping - narzędzie do tworzenia wykresów opóźnień sieci
 Name:		smokeping
 Version:	2.4.2
-Release:	2
+Release:	3
 License:	GPL v2+
 Group:		Networking/Utilities
 Source0:	http://oss.oetiker.ch/smokeping/pub/%{name}-%{version}.tar.gz
@@ -43,6 +41,8 @@
 #	Requires: perl-Net-DNS
 #	Requires: perl-SNMP_Session
 #	Requires: perl-ldap
+Provides:	user(%{name})
+Provides:	group(%{name})
 Suggests:	bind-utils
 Suggests:	curl
 Suggests:	echoping
@@ -139,35 +139,12 @@
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-%post
-if [ "$1" = "1" ]; then
-
-firstgate=`route -n |awk '$1=="0.0.0.0" && $4 ~ /G/ {print $2}' | head -n 1`
-echo "
-+ gateway
- menu   = Default Gateway
- title  = Default Gateway Router
- host   = $firstgate
-
-+ dns
- menu   = DNS Servers
- title  = Domain Name Servers
-        " >> %{_sysconfdir}/config
-for dns in `awk '$1 ~ /^nameserver/ {print $2}' /etc/resolv.conf | LC_ALL=C sort -u` ; do
-dnscnt=$((dnscnt+1))
-echo "++ dns$dnscnt
-  menu  = DNS Server $dnscnt
-  title = Domain Name Server $dnscnt
-  host  = $dns
-        " >> %{_sysconfdir}/config
-done
-
-[ "$HOSTNAME" ] && %{__sed} -i -e "s|localhost|$HOSTNAME|g" %{_sysconfdir}/config
-
-fi
+%pre
+%groupadd -g 207 %{name}
+%useradd -u 207 -d /var/lib/%{name} -g %{name} -s /bin/false -c "Smokeping User" %{name}
 
+%post
 /sbin/chkconfig --add %{name}
-%service %{name} restart
 
 %preun
 if [ "$1" = 0 ]; then
@@ -175,6 +152,12 @@
 	/sbin/chkconfig --del %{name}
 fi
 
+%postun
+if [ "$1" = 0 ]; then
+	%userremove %{name}
+	%groupremove %{name}
+fi
+
 %triggerin cgi -- apache1 < 1.3.37-3, apache1-base
 %webapp_register apache %{_webapp}
 
@@ -187,10 +170,10 @@
 %triggerun cgi -- apache < 2.2.0, apache-base
 %webapp_unregister httpd %{_webapp}
 
-%triggerin -- lighttpd
+%triggerin cgi -- lighttpd
 %webapp_register lighttpd %{_webapp}
 
-%triggerun -- lighttpd
+%triggerun cgi -- lighttpd
 %webapp_unregister lighttpd %{_webapp}
 
 %triggerpostun -- %{name} < 2.0.5-0.3
@@ -234,7 +217,7 @@
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/tmail
 %attr(754,root,root) /etc/rc.d/init.d/smokeping
 %dir %{_sharedstatedir}/%{name}
-%{_sharedstatedir}/%{name}/rrd
+%dir %attr(775,root,smokeping) %{_sharedstatedir}/%{name}/rrd
 %dir %attr(775,root,http) %{_sharedstatedir}/%{name}/img
 
 %files cgi
@@ -256,6 +239,11 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.56  2008/11/11 13:03:34  kosmo
+- run as "smokeping" user.
+- do not generate config.
+- do not start service during installation.
+
 Revision 1.55  2008/11/05 18:07:53  glen
 - i dislike *
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SPECS/smokeping.spec?r1=1.55&r2=1.56&f=u



More information about the pld-cvs-commit mailing list