SPECS: cacti.spec - add cacti user for running scripts - move conf...

glen glen at pld-linux.org
Wed Mar 12 01:41:08 CET 2008


Author: glen                         Date: Wed Mar 12 00:41:08 2008 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- add cacti user for running scripts
- move config to SOURCES
- remove backup files not to package that shit
- rel 5

---- Files affected:
SPECS:
   cacti.spec (1.74 -> 1.75) 

---- Diffs:

================================================================
Index: SPECS/cacti.spec
diff -u SPECS/cacti.spec:1.74 SPECS/cacti.spec:1.75
--- SPECS/cacti.spec:1.74	Wed Mar 12 01:30:57 2008
+++ SPECS/cacti.spec	Wed Mar 12 01:41:03 2008
@@ -1,16 +1,18 @@
 # $Revision$, $Date$
 # TODO
 # - patch source to use adodb system path instead of symlinking
+# - shouldn't files in scripts dir be executable?
 %include	/usr/lib/rpm/macros.perl
 Summary:	Cacti is a PHP frontend for rrdtool
 Summary(pl.UTF-8):	Cacti - frontend w PHP do rrdtoola
 Name:		cacti
 Version:	0.8.7b
-Release:	4
+Release:	5
 License:	GPL
 Group:		Applications/WWW
 Source0:	http://www.cacti.net/downloads/%{name}-%{version}.tar.gz
 # Source0-md5:	63ffca5735b60bc33c68bc880f0e8042
+Source1:	%{name}.cfg.php
 Patch1:		%{name}-upgrade_from_086k_fix.patch
 Patch2:		http://www.cacti.net/downloads/patches/0.8.7b/snmp_auth_none_notice.patch
 Patch10:	%{name}-plugin-%{version}.diff
@@ -19,8 +21,12 @@
 Patch13:	%{name}-url_path.patch
 URL:		http://www.cacti.net/
 BuildRequires:	rpm-perlprov
+Requires(postun):	/usr/sbin/userdel
+Requires(pre):	/bin/id
+Requires(pre):	/usr/sbin/useradd
 Requires:	adodb >= 4.67-1.17
 Requires:	crondaemon
+Requires:	group(http)
 Requires:	net-snmp-utils
 Requires:	php(gd)
 Requires:	php(mysql)
@@ -32,6 +38,7 @@
 Requires:	webserver
 Requires:	webserver(php)
 Suggests:	cacti-spine
+Provides:	user(cacti)
 BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -68,40 +75,18 @@
 
 rm -rf lib/adodb
 
+find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
+
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT%{webadminroot}
 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},/etc/cron.d}
 install -d $RPM_BUILD_ROOT/var/{log,lib/%{name}}
-cp -aRf * $RPM_BUILD_ROOT%{webadminroot}
+cp -a * $RPM_BUILD_ROOT%{webadminroot}
+# wtf is this?
 ln -s . $RPM_BUILD_ROOT%{webadminroot}/%{name}
 
-# TODO: move this to SOURCES. it's a lot better to backtrack changes
-# if it's a separate file.
-cat << 'EOF' > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/%{name}.cfg
-<?php
-$database_type = 'mysql';
-$database_default = 'cacti';
-$database_hostname = 'localhost';
-$database_username = 'cactiuser';
-$database_password = 'cactiuser';
-
-$plugins = array();
-// $plugins[] = 'thold';
-// $plugins[] = 'monitor';
-// $plugins[] = 'discovery';
-
-/* Do not edit this line */
-$config = array();
-
-/* This is full URL Path to the Cacti installation
-   For example, if your cacti was accessible by http://server/cacti/ you would user '/cacti/'
-   as the url path.  For just http://server/ use '/'
-*/
-$config['url_path'] = '/cacti/';
-
-?>
-EOF
+cp -a %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/%{name}.cfg
 
 mv $RPM_BUILD_ROOT%{webadminroot}/log $RPM_BUILD_ROOT/var/log/%{name}
 ln -sf /var/log/cacti $RPM_BUILD_ROOT%{webadminroot}/log
@@ -110,6 +95,7 @@
 ln -sf /var/lib/%{name}/rra $RPM_BUILD_ROOT%{webadminroot}/rra
 ln -sf %{_datadir}/php/adodb $RPM_BUILD_ROOT%{webadminroot}/lib/adodb
 
+# TODO: switch to user cacti here
 cat  << 'EOF' > $RPM_BUILD_ROOT%{_sysconfdir}/cron.d/%{name}
 */5 * * * * http umask 022; %{_bindir}/php %{webadminroot}/poller.php > /dev/null 2>&1
 EOF
@@ -117,6 +103,14 @@
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%pre
+%useradd -u 184 -d /var/lib/%{name} -g http -c "Cacti User" cacti
+
+%postun
+if [ "$1" = "0" ]; then
+	%userremove cacti
+fi
+
 %files
 %defattr(644,root,root,755)
 %doc docs/CHANGELOG docs/CONTRIB docs/README
@@ -135,6 +129,12 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.75  2008-03-12 00:41:03  glen
+- add cacti user for running scripts
+- move config to SOURCES
+- remove backup files not to package that shit
+- rel 5
+
 Revision 1.74  2008-03-12 00:30:57  glen
 - adapter
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SPECS/cacti.spec?r1=1.74&r2=1.75&f=u



More information about the pld-cvs-commit mailing list