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