]> git.pld-linux.org Git - packages/cacti.git/blob - cacti.spec
- fix config syntax error, actually use just one config file from webapps dir; rel 5
[packages/cacti.git] / cacti.spec
1 #
2 # Conditional build:
3 %bcond_without  pa              # without plugin archidecture patch
4
5 %include        /usr/lib/rpm/macros.perl
6 Summary:        Cacti is a PHP frontend for rrdtool
7 Summary(pl.UTF-8):      Cacti - frontend w PHP do rrdtoola
8 Name:           cacti
9 Version:        0.8.7g
10 Release:        5
11 License:        GPL
12 Group:          Applications/WWW
13 Source0:        http://www.cacti.net/downloads/%{name}-%{version}.tar.gz
14 # Source0-md5:  268421cb1a58d3444f7ecbddb4c4b016
15 Source2:        %{name}.crontab
16 Source3:        %{name}-apache.conf
17 Source4:        %{name}-lighttpd.conf
18 Source5:        %{name}-rrdpath.sql
19 Source6:        %{name}-pa.sql
20 Source7:        %{name}.logrotate
21 # http://docs.cacti.net/manual:087:1_installation.9_pia
22 # http://mirror.cactiusers.org/downloads/plugins/cacti-plugin-0.8.7g-PA-v2.8.tar.gz
23 Patch0:         %{name}-PA.patch
24 Patch1:         %{name}-config.patch
25 Patch2:         %{name}-adodb.patch
26 Patch3:         %{name}-ioerror.patch
27 Patch4:         %{name}-webroot.patch
28 Patch5:         %{name}-linux_memory.patch
29 Patch6:         %{name}-log-verbosity.patch
30 Patch7:         %{name}-ss_disk-array-indices.patch
31 Patch8:         host_name-url.patch
32 Patch9:         cli-relpath.patch
33 # http://www.cacti.net/download_patches.php
34 Patch10:        data_source_deactivate.patch
35 Patch11:        graph_list_view.patch
36 Patch12:        html_output.patch
37 Patch13:        ldap_group_authenication.patch
38 Patch14:        script_server_command_line_parse.patch
39 Patch15:        ping.patch
40 Patch16:        poller_interval.patch
41 URL:            http://www.cacti.net/
42 BuildRequires:  rpm-perlprov
43 BuildRequires:  sed >= 4.0
44 Requires(postun):       /usr/sbin/userdel
45 Requires(pre):  /bin/id
46 Requires(pre):  /usr/sbin/useradd
47 Requires:       adodb >= 4.67-1.17
48 Requires:       crondaemon
49 Requires:       group(http)
50 Requires:       net-snmp-utils
51 Requires:       php-cli
52 Requires:       php-common >= 4:5.2.13-10
53 Requires:       php-mysql
54 Requires:       php-pcre
55 Requires:       php-session
56 Requires:       php-snmp
57 Requires:       php-xml
58 Requires:       rrdtool
59 Requires:       webapps
60 Requires:       webserver
61 Requires:       webserver(access)
62 Requires:       webserver(alias)
63 Requires:       webserver(indexfile)
64 Requires:       webserver(php)
65 Suggests:       cacti-spine
66 Suggests:       php-gd
67 Provides:       user(cacti)
68 BuildArch:      noarch
69 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
70
71 %define         _webapps        /etc/webapps
72 %define         _webapp         %{name}
73 %define         _sysconfdir     %{_webapps}/%{_webapp}
74 %define         _appdir         /usr/share/%{name}
75
76 %description
77 Cacti is a complete frondend to rrdtool, it stores all of the
78 nessesary information to create graphs and populate them with data in
79 a MySQL database.
80
81 The frontend is completely PHP driven. Along with being able to
82 maintain Graphs, Data Sources, and Round Robin Archives in a database,
83 cacti handles the data gathering also. There is also SNMP support for
84 those used to creating traffic graphs with MRTG.
85
86 %description -l pl.UTF-8
87 Cacti to pełny frontend do rrdtoola, zapamiętujący wszystkie
88 informacje potrzebne do tworzenia wykresów i wypełniające je danymi w
89 bazie MySQL.
90
91 Frontend jest w pełni oparty na PHP. Oprócz zarządzania wykresami,
92 źródłami danych, archiwami Round Robin w bazie danych, cacti obsługuje
93 także gromadzenie danych. Ma także obsługę SNMP przydatną przy
94 tworzeniu wykresów ruchu przy użyciu MRTG.
95
96 %package setup
97 Summary:        Cacti setup package
98 Summary(pl.UTF-8):      Pakiet do wstępnej konfiguracji Cacti
99 Group:          Applications/WWW
100 Requires:       %{name} = %{version}-%{release}
101 Suggests:       %{name}-doc = %{version}-%{release}
102
103 %description setup
104 Install this package to configure initial Cacti installation. You
105 should uninstall this package when you're done, as it considered
106 insecure to keep the setup files in place.
107
108 %description setup -l pl.UTF-8
109 Ten pakiet należy zainstalować, aby wstępnie skonfigurować instalację
110 Cacti. Po tym pakiet powinien zostać odinstalowany, jako że jego
111 obecność może być niebezpieczna.
112
113 %package doc
114 Summary:        HTML Documentation for Cacti
115 Summary(pl.UTF-8):      Dokumentacja do Cacti w formacie HTML
116 Group:          Documentation
117 Requires:       %{name} = %{version}-%{release}
118
119 %description doc
120 HTML Documentation for Cacti.
121
122 %description doc -l pl.UTF-8
123 Dokumentacja do Cacti w formacie HTML.
124
125 %prep
126 %setup -q
127 # official patches
128 %patch10 -p1
129 %patch11 -p1
130 %patch12 -p1
131 %patch13 -p1
132 %patch14 -p1
133 %patch15 -p1
134 %patch16 -p1
135
136 %{?with_pa:%patch0 -p1}
137
138 %patch1 -p1
139 %patch2 -p1
140 %patch3 -p1
141 %patch4 -p1
142 %patch5 -p1
143 %patch6 -p1
144 %patch7 -p1
145 %patch8 -p1
146 %patch9 -p1
147
148 mkdir -p sql
149 mv *.sql sql
150 # you should run this sql if your database contains path to %{_datadir}...
151 cp %{SOURCE5} sql
152 cp %{SOURCE6} sql
153
154 %{__rm} -r lib/adodb
155 %{__rm} log/.htaccess
156 %{__rm} cli/.htaccess
157 %{__rm} rra/.htaccess
158
159 # must require libs to get fatals on missing files, not include
160 %{__sed} -i -e '
161         s,include(dirname(__FILE__)."/../include/global.php");,require(dirname(__FILE__)."/../include/global.php");,
162         s,include_once,require_once,
163 ' cli/*.php
164
165 # make sure scripts have php shebang
166 %{__sed} -i -e '1{
167     /bin.php/!i#!%{_bindir}/php
168 }' scripts/*.php  cli/*.php
169
170 chmod a+rx scripts/*.php cli/*.php
171
172 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
173
174 # make sure cacti runs out of the box
175 %{__sed} -i -e 's,new_install,%{version},' sql/cacti.sql
176
177 %install
178 rm -rf $RPM_BUILD_ROOT
179 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},%{_appdir}/{docs,plugins},/etc/{cron.d,logrotate.d},%{_sbindir}}
180 install -d $RPM_BUILD_ROOT/var/{log,lib/%{name}}
181
182 cp -a *.php $RPM_BUILD_ROOT%{_appdir}
183 cp -a cli images include install lib resource scripts sql $RPM_BUILD_ROOT%{_appdir}
184 cp -a docs/html $RPM_BUILD_ROOT%{_appdir}/docs/html
185 mv $RPM_BUILD_ROOT{%{_appdir}/poller.php,%{_sbindir}/cacti-poller}
186
187 cp -a log $RPM_BUILD_ROOT/var/log/%{name}
188 cp -a rra $RPM_BUILD_ROOT/var/lib/%{name}
189
190 mv $RPM_BUILD_ROOT{%{_appdir}/include,%{_sysconfdir}}/config.php
191 cp -a %{SOURCE2} $RPM_BUILD_ROOT/etc/cron.d/%{name}
192 cp -a %{SOURCE7} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
193
194 cp -a %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
195 cp -a %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
196 cp -a %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf
197
198 %clean
199 rm -rf $RPM_BUILD_ROOT
200
201 %pre
202 %useradd -u 184 -d /var/lib/%{name} -g http -c "Cacti User" cacti
203
204 %post
205 if [ ! -f /var/log/%{name}/cacti.log ]; then
206         install -m660 -oroot -ghttp /dev/null /var/log/%{name}/cacti.log
207 fi
208
209 %postun
210 if [ "$1" = "0" ]; then
211         %userremove cacti
212 fi
213
214 %triggerin -- apache1 < 1.3.37-3, apache1-base
215 %webapp_register apache %{_webapp}
216
217 %triggerun -- apache1 < 1.3.37-3, apache1-base
218 %webapp_unregister apache %{_webapp}
219
220 %triggerin -- apache < 2.2.0, apache-base
221 %webapp_register httpd %{_webapp}
222
223 %triggerun -- apache < 2.2.0, apache-base
224 %webapp_unregister httpd %{_webapp}
225
226 %triggerin -- lighttpd
227 %webapp_register lighttpd %{_webapp}
228
229 %triggerun -- lighttpd
230 %webapp_unregister lighttpd %{_webapp}
231
232 %triggerpostun -- %{name} < 0.8.7b-9.5
233 if [ -f /etc/cacti/cacti.cfg.rpmsave ]; then
234         cp -f %{_sysconfdir}/config.php{,.rpmnew}
235         mv /etc/cacti/cacti.cfg.rpmsave %{_sysconfdir}/config.php
236 fi
237
238 %files
239 %defattr(644,root,root,755)
240 %doc docs/CHANGELOG docs/CONTRIB docs/README docs/txt/manual.txt
241 %dir %attr(750,root,http) %{_sysconfdir}
242 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf
243 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf
244 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lighttpd.conf
245 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config.php
246 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
247 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
248 %attr(755,root,root) %{_sbindir}/cacti-poller
249 %dir %{_appdir}
250 %exclude %{_appdir}/install
251 %exclude %{_appdir}/docs
252 %{_appdir}/resource
253 %{_appdir}/sql
254 %{_appdir}/lib
255 %{_appdir}/include
256 %{_appdir}/images
257 %{_appdir}/plugins
258 %{_appdir}/*.php
259
260 %dir %{_appdir}/cli
261 %attr(755,root,root) %{_appdir}/cli/*
262
263 %dir %{_appdir}/scripts
264 %attr(755,root,root) %{_appdir}/scripts/*
265
266 %attr(750,root,http) %dir /var/lib/%{name}
267 %attr(770,root,http) %dir /var/lib/%{name}/rra
268 %attr(730,root,http) %dir /var/log/%{name}
269 %attr(660,root,http) %ghost /var/log/%{name}/cacti.log
270
271 %files setup
272 %defattr(644,root,root,755)
273 %{_appdir}/install
274
275 %files doc
276 %defattr(644,root,root,755)
277 %{_appdir}/docs
This page took 0.112136 seconds and 3 git commands to generate.