]> git.pld-linux.org Git - packages/cacti.git/blob - cacti.spec
Up to 1.2.26
[packages/cacti.git] / cacti.spec
1 %define         pia_ver 3.1
2 %define         php_min_version 5.4.0
3 Summary:        Cacti is a PHP frontend for rrdtool
4 Summary(pl.UTF-8):      Cacti - frontend w PHP do rrdtoola
5 Name:           cacti
6 Version:        1.2.26
7 Release:        1
8 License:        GPL v2
9 Group:          Applications/WWW
10 Source0:        http://www.cacti.net/downloads/%{name}-%{version}.tar.gz
11 # Source0-md5:  53043d8279640a074cc054c7b156375d
12 Source2:        %{name}.crontab
13 Source3:        %{name}-apache.conf
14 Source4:        %{name}-lighttpd.conf
15 Source5:        %{name}-rrdpath.sql
16 Source7:        %{name}.logrotate
17
18 Patch1:         %{name}-config.patch
19
20 Patch3:         %{name}-ioerror.patch
21 Patch4:         %{name}-webroot.patch
22 Patch5:         %{name}-linux_memory.patch
23 Patch6:         %{name}-log-verbosity.patch
24
25 Patch8:         host_name-url.patch
26 # http://www.cacti.net/download_patches.php
27 # Patch100: ..
28 URL:            http://www.cacti.net/
29 BuildRequires:  sed >= 4.0
30 Requires(postun):       /usr/sbin/userdel
31 Requires(pre):  /bin/id
32 Requires(pre):  /usr/sbin/useradd
33 Requires:       crondaemon
34 Requires:       group(http)
35 Requires:       net-snmp-utils
36 Requires:       php(core) >= %{php_min_version}
37 Requires:       php(ctype)
38 Requires:       php(filter)
39 Requires:       php(gd)
40 Requires:       php(json)
41 Requires:       php(ldap)
42 Requires:       php(mbstring)
43 Requires:       php(openssl)
44 Requires:       php(pcre)
45 Requires:       php(pdo-mysql)
46 Requires:       php(posix)
47 Requires:       php(session)
48 Requires:       php(sockets)
49 Requires:       php(xml)
50 Requires:       php(zlib)
51 Requires:       rrdtool
52 Requires:       webapps
53 Requires:       webserver
54 Requires:       webserver(access)
55 Requires:       webserver(alias)
56 Requires:       webserver(indexfile)
57 Requires:       webserver(php)
58 Suggests:       cacti-spine
59 Suggests:       php(bcmath)
60 Suggests:       php(ftp)
61 Suggests:       php(gmp)
62 Suggests:       php(snmp)
63 Provides:       cacti(pia) = %{pia_ver}
64 Provides:       user(cacti)
65 Obsoletes:      cacti-add_template
66 Obsoletes:      cacti-plugin-boost
67 Obsoletes:      cacti-plugin-update
68 %if "%{pld_release}" != "ac"
69 Conflicts:      logrotate < 3.8.0
70 %endif
71 BuildArch:      noarch
72 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
73
74 %define         _webapps        /etc/webapps
75 %define         _webapp         %{name}
76 %define         _sysconfdir     %{_webapps}/%{_webapp}
77 %define         _appdir         /usr/share/%{name}
78
79 # bad depsolver
80 %define         _noautopear     pear
81 # optional
82 %define         _noautophp      php-ftp php-bcmath
83
84 # put it together for rpmbuild
85 %define         _noautoreq      %{?_noautophp} %{?_noautopear}
86
87 %description
88 Cacti is a complete frondend to rrdtool, it stores all of the
89 nessesary information to create graphs and populate them with data in
90 a MySQL database.
91
92 The frontend is completely PHP driven. Along with being able to
93 maintain Graphs, Data Sources, and Round Robin Archives in a database,
94 cacti handles the data gathering also. There is also SNMP support for
95 those used to creating traffic graphs with MRTG.
96
97 %description -l pl.UTF-8
98 Cacti to pełny frontend do rrdtoola, zapamiętujący wszystkie
99 informacje potrzebne do tworzenia wykresów i wypełniające je danymi w
100 bazie MySQL.
101
102 Frontend jest w pełni oparty na PHP. Oprócz zarządzania wykresami,
103 źródłami danych, archiwami Round Robin w bazie danych, cacti obsługuje
104 także gromadzenie danych. Ma także obsługę SNMP przydatną przy
105 tworzeniu wykresów ruchu przy użyciu MRTG.
106
107 %package setup
108 Summary:        Cacti setup package
109 Summary(pl.UTF-8):      Pakiet do wstępnej konfiguracji Cacti
110 Group:          Applications/WWW
111 Requires:       %{name} = %{version}-%{release}
112 Suggests:       %{name}-doc = %{version}-%{release}
113
114 %description setup
115 Install this package to configure initial Cacti installation. You
116 should uninstall this package when you're done, as it considered
117 insecure to keep the setup files in place.
118
119 %description setup -l pl.UTF-8
120 Ten pakiet należy zainstalować, aby wstępnie skonfigurować instalację
121 Cacti. Po tym pakiet powinien zostać odinstalowany, jako że jego
122 obecność może być niebezpieczna.
123
124 %package doc
125 Summary:        HTML Documentation for Cacti
126 Summary(pl.UTF-8):      Dokumentacja do Cacti w formacie HTML
127 Group:          Documentation
128 Requires:       %{name} = %{version}-%{release}
129
130 %description doc
131 HTML Documentation for Cacti.
132
133 %description doc -l pl.UTF-8
134 Dokumentacja do Cacti w formacie HTML.
135
136 %prep
137 %setup -q
138
139 # official patches
140 %if 0%{?PATCH100:1}
141 %patch100 -p1
142 %endif
143
144 %patch1 -p1
145
146 %patch3 -p1
147 %patch4 -p1
148 %patch5 -p1
149 %patch6 -p1
150
151 # ?
152 # %patch8 -p1
153
154 mkdir -p sql
155 mv *.sql sql
156 # you should run this sql if your database contains path to %{_datadir}...
157 cp -p %{SOURCE5} sql
158
159 %{__rm} log/.htaccess
160 %{__rm} cli/.htaccess
161 %{__rm} rra/.htaccess
162
163 # must require libs to get fatals on missing files, not include
164 %{__sed} -i -e '
165         s,include(dirname(__FILE__)."/../include/global.php");,require(dirname(__FILE__)."/../include/global.php");,
166         s,include_once,require_once,
167 ' cli/*.php
168
169 %{__sed} -i -e 's,#!/usr/bin/env php,#!/usr/bin/php,' include/vendor/cldr-to-gettext-plural-rules/bin/export-plural-rules *.php */*.php
170
171 # make sure scripts have php shebang
172 %{__sed} -i -e '1{
173     /bin.php/!i#!%{_bindir}/php
174 }' scripts/*.php  cli/*.php
175
176 chmod a+rx scripts/*.php cli/*.php
177
178 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
179
180 # make sure cacti runs out of the box
181 %{__sed} -i -e 's,new_install,%{version},' sql/cacti.sql
182
183 %install
184 rm -rf $RPM_BUILD_ROOT
185 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},%{_appdir}/docs,/etc/{cron.d,logrotate.d},%{_sbindir}}
186 install -d $RPM_BUILD_ROOT/var/{log,{lib,cache}/%{name}}
187
188 cp -p *.php $RPM_BUILD_ROOT%{_appdir}
189 # dirs that contain index.php are likely to be installed
190 # ls -1d */index.php | cut -d"/" -f1 | xargs
191 cp -a cache/* $RPM_BUILD_ROOT/var/cache/%{name}
192 ln -s /var/cache/%{name} $RPM_BUILD_ROOT%{_appdir}/cache
193 cp -a cli docs formats images include install lib locales mibs plugins resource scripts sql $RPM_BUILD_ROOT%{_appdir}
194 mv $RPM_BUILD_ROOT{%{_appdir}/poller.php,%{_sbindir}/cacti-poller}
195
196 cp -a log $RPM_BUILD_ROOT/var/log/%{name}
197 :> $RPM_BUILD_ROOT/var/log/%{name}/%{name}.log
198 install -d $RPM_BUILD_ROOT/var/log/archive/%{name}
199 cp -a rra $RPM_BUILD_ROOT/var/lib/%{name}
200
201 mv $RPM_BUILD_ROOT{%{_appdir}/include,%{_sysconfdir}}/config.php
202 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/cron.d/%{name}
203 cp -p %{SOURCE7} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
204
205 %if "%{pld_release}" == "ac"
206 %{__sed} -i -e '/su/d' $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
207 %endif
208
209 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
210 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
211 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf
212
213 %clean
214 rm -rf $RPM_BUILD_ROOT
215
216 %pre
217 %useradd -u 184 -d /var/lib/%{name} -g http -c "Cacti User" cacti
218
219 %pretrans
220 if [ -d "%{_appdir}/cache" ] && [ ! -L "%{_appdir}/cache" ]; then
221         mv -v %{_appdir}/cache{,.rpmsave}
222 fi
223 exit 0
224
225 %post
226 if [ ! -f /var/log/%{name}/cacti.log ]; then
227         install -m660 -oroot -ghttp /dev/null /var/log/%{name}/cacti.log
228 fi
229
230 %postun
231 if [ "$1" = "0" ]; then
232         %userremove cacti
233 fi
234
235 %post setup
236 %{_appdir}/cli/upgrade_database.php || :
237
238 %triggerin -- apache1 < 1.3.37-3, apache1-base
239 %webapp_register apache %{_webapp}
240
241 %triggerun -- apache1 < 1.3.37-3, apache1-base
242 %webapp_unregister apache %{_webapp}
243
244 %triggerin -- apache < 2.2.0, apache-base
245 %webapp_register httpd %{_webapp}
246
247 %triggerun -- apache < 2.2.0, apache-base
248 %webapp_unregister httpd %{_webapp}
249
250 %triggerin -- lighttpd
251 %webapp_register lighttpd %{_webapp}
252
253 %triggerun -- lighttpd
254 %webapp_unregister lighttpd %{_webapp}
255
256 %triggerpostun -- %{name} < 0.8.7b-9.5
257 if [ -f /etc/cacti/cacti.cfg.rpmsave ]; then
258         cp -f %{_sysconfdir}/config.php{,.rpmnew}
259         mv /etc/cacti/cacti.cfg.rpmsave %{_sysconfdir}/config.php
260 fi
261
262 %files
263 %defattr(644,root,root,755)
264 %doc README.md CHANGELOG
265 %dir %attr(750,root,http) %{_sysconfdir}
266 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf
267 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf
268 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lighttpd.conf
269 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config.php
270 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
271 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
272 %attr(755,root,root) %{_sbindir}/cacti-poller
273 %dir %{_appdir}
274 %exclude %{_appdir}/install
275 %exclude %{_appdir}/docs
276 %{_appdir}/cache
277 %{_appdir}/formats
278 %{_appdir}/images
279 %{_appdir}/include
280 %{_appdir}/lib
281 %{_appdir}/locales
282 %{_appdir}/mibs
283 %{_appdir}/plugins
284 %{_appdir}/resource
285 %{_appdir}/sql
286 %{_appdir}/*.php
287
288 %dir %{_appdir}/cli
289 %attr(755,root,root) %{_appdir}/cli/*
290
291 %dir %{_appdir}/scripts
292 %attr(755,root,root) %{_appdir}/scripts/*
293
294 %attr(750,root,http) %dir /var/lib/%{name}
295 %attr(770,root,http) %dir /var/lib/%{name}/rra
296 %attr(730,root,http) %dir /var/log/%{name}
297 %attr(750,root,logs) %dir /var/log/archive/%{name}
298 %attr(660,root,http) %ghost /var/log/%{name}/cacti.log
299 %attr(730,root,http) %dir /var/cache/%{name}
300 /var/cache/%{name}/index.php
301 %attr(730,root,http) %dir /var/cache/%{name}/boost
302 %attr(730,root,http) %dir /var/cache/%{name}/mibcache
303 %attr(770,root,http) %dir /var/cache/%{name}/realtime
304 %attr(730,root,http) %dir /var/cache/%{name}/spikekill
305 /var/cache/%{name}/*/.htaccess
306 /var/cache/%{name}/*/index.php
307
308 %files setup
309 %defattr(644,root,root,755)
310 %{_appdir}/install
311
312 %files doc
313 %defattr(644,root,root,755)
314 %{_appdir}/docs
This page took 0.108966 seconds and 4 git commands to generate.