]>
Commit | Line | Data |
---|---|---|
bb0e5568 ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without pa # without plugin archidecture patch | |
4 | ||
d839b321 | 5 | %define pia_ver 2.9 |
e90043f8 | 6 | %include /usr/lib/rpm/macros.perl |
9f35c748 | 7 | Summary: Cacti is a PHP frontend for rrdtool |
bf643d4f | 8 | Summary(pl.UTF-8): Cacti - frontend w PHP do rrdtoola |
94614147 | 9 | Name: cacti |
bb0e5568 | 10 | Version: 0.8.7g |
3f7a5bd0 | 11 | Release: 11 |
6587a5d5 | 12 | License: GPL |
94614147 | 13 | Group: Applications/WWW |
761b4fb2 | 14 | Source0: http://www.cacti.net/downloads/%{name}-%{version}.tar.gz |
bb0e5568 | 15 | # Source0-md5: 268421cb1a58d3444f7ecbddb4c4b016 |
a1abeca3 | 16 | Source2: %{name}.crontab |
de4cec3c GS |
17 | Source3: %{name}-apache.conf |
18 | Source4: %{name}-lighttpd.conf | |
19 | Source5: %{name}-rrdpath.sql | |
817cc464 | 20 | Source6: %{name}-pa.sql |
af389505 | 21 | Source7: %{name}.logrotate |
d7378ed4 | 22 | # http://docs.cacti.net/manual:087:1_installation.9_pia |
d839b321 ER |
23 | Source8: http://www.cacti.net/downloads/pia/%{name}-plugin-%{version}-PA-v%{pia_ver}.tar.gz |
24 | # Source8-md5: a508cf859577afccb6555557d4ec90f1 | |
8466638a | 25 | # NOTE: update provides: cacti(pia) when updating the patch |
8514c08f | 26 | Patch0: %{name}-PA.patch |
de4cec3c GS |
27 | Patch1: %{name}-config.patch |
28 | Patch2: %{name}-adodb.patch | |
29 | Patch3: %{name}-ioerror.patch | |
30 | Patch4: %{name}-webroot.patch | |
31 | Patch5: %{name}-linux_memory.patch | |
32 | Patch6: %{name}-log-verbosity.patch | |
33 | Patch7: %{name}-ss_disk-array-indices.patch | |
ac01d3f9 AZ |
34 | Patch8: host_name-url.patch |
35 | Patch9: cli-relpath.patch | |
e79e3b18 | 36 | # http://www.cacti.net/download_patches.php |
af389505 ER |
37 | Patch10: data_source_deactivate.patch |
38 | Patch11: graph_list_view.patch | |
39 | Patch12: html_output.patch | |
40 | Patch13: ldap_group_authenication.patch | |
41 | Patch14: script_server_command_line_parse.patch | |
42 | Patch15: ping.patch | |
43 | Patch16: poller_interval.patch | |
3f7a5bd0 | 44 | Patch17: %{name}-0.8.7g-sqli-xss.patch |
761b4fb2 | 45 | URL: http://www.cacti.net/ |
89aea3b3 | 46 | BuildRequires: rpm-perlprov |
344e658b | 47 | BuildRequires: sed >= 4.0 |
f4a0dd1f ER |
48 | Requires(postun): /usr/sbin/userdel |
49 | Requires(pre): /bin/id | |
50 | Requires(pre): /usr/sbin/useradd | |
f44cea91 | 51 | Requires: adodb >= 4.67-1.17 |
e9300b9e | 52 | Requires: crondaemon |
f4a0dd1f | 53 | Requires: group(http) |
94614147 | 54 | Requires: net-snmp-utils |
4e25427a | 55 | Requires: php-cli |
c5421ef6 | 56 | Requires: php-common >= 4:5.2.13-10 |
c5421ef6 ER |
57 | Requires: php-mysql |
58 | Requires: php-pcre | |
59 | Requires: php-session | |
60 | Requires: php-snmp | |
61 | Requires: php-xml | |
c8f292cd | 62 | Requires: rrdtool |
4b6cd69a | 63 | Requires: webapps |
e4f2f951 | 64 | Requires: webserver |
cce68540 | 65 | Requires: webserver(access) |
7d4ec5c1 | 66 | Requires: webserver(alias) |
09dccb3a | 67 | Requires: webserver(indexfile) |
f5a0e42f | 68 | Requires: webserver(php) |
578edcb5 | 69 | Suggests: cacti-spine |
24fa0556 | 70 | Suggests: php-gd |
d839b321 | 71 | Provides: cacti(pia) = %{pia_ver} |
f4a0dd1f | 72 | Provides: user(cacti) |
6587a5d5 | 73 | BuildArch: noarch |
94614147 JB |
74 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
75 | ||
4b6cd69a ER |
76 | %define _webapps /etc/webapps |
77 | %define _webapp %{name} | |
78 | %define _sysconfdir %{_webapps}/%{_webapp} | |
79 | %define _appdir /usr/share/%{name} | |
6587a5d5 JB |
80 | |
81 | %description | |
82 | Cacti is a complete frondend to rrdtool, it stores all of the | |
94614147 JB |
83 | nessesary information to create graphs and populate them with data in |
84 | a MySQL database. | |
6587a5d5 | 85 | |
94614147 JB |
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. | |
6587a5d5 | 90 | |
41840fab | 91 | %description -l pl.UTF-8 |
350cedee | 92 | Cacti to pełny frontend do rrdtoola, zapamiętujący wszystkie |
bf643d4f ER |
93 | informacje potrzebne do tworzenia wykresów i wypełniające je danymi w |
94 | bazie MySQL. | |
c9dfb888 | 95 | |
350cedee | 96 | Frontend jest w pełni oparty na PHP. Oprócz zarządzania wykresami, |
bf643d4f ER |
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. | |
c9dfb888 | 100 | |
4b6cd69a ER |
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} | |
d6d42868 | 106 | Suggests: %{name}-doc = %{version}-%{release} |
4b6cd69a ER |
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 | ||
a40c4ad5 JB |
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 | ||
4b6cd69a ER |
118 | %package doc |
119 | Summary: HTML Documentation for Cacti | |
a40c4ad5 | 120 | Summary(pl.UTF-8): Dokumentacja do Cacti w formacie HTML |
4b6cd69a ER |
121 | Group: Documentation |
122 | Requires: %{name} = %{version}-%{release} | |
123 | ||
124 | %description doc | |
125 | HTML Documentation for Cacti. | |
126 | ||
a40c4ad5 JB |
127 | %description doc -l pl.UTF-8 |
128 | Dokumentacja do Cacti w formacie HTML. | |
129 | ||
6587a5d5 | 130 | %prep |
8466638a | 131 | %setup -q %{?with_pa:-a8} |
482f9753 | 132 | # official patches |
af389505 ER |
133 | %patch10 -p1 |
134 | %patch11 -p1 | |
135 | %patch12 -p1 | |
136 | %patch13 -p1 | |
137 | %patch14 -p1 | |
138 | %patch15 -p1 | |
139 | %patch16 -p1 | |
3f7a5bd0 | 140 | %patch17 -p1 |
e79e3b18 | 141 | |
8466638a ER |
142 | %if %{with pa} |
143 | %patch0 -p1 | |
144 | # copy images and drop the rest | |
145 | mv cacti-plugin-arch/files-%{version}/images/* images | |
146 | %{__rm} -r cacti-plugin-arch | |
147 | %endif | |
482f9753 | 148 | |
0482abbd | 149 | %patch1 -p1 |
f23be293 | 150 | %patch2 -p1 |
14544804 | 151 | %patch3 -p1 |
d6d42868 ER |
152 | %patch4 -p1 |
153 | %patch5 -p1 | |
154 | %patch6 -p1 | |
5e8efd1f | 155 | %patch7 -p1 |
de4cec3c | 156 | %patch8 -p1 |
fe418db4 | 157 | %patch9 -p1 |
6587a5d5 | 158 | |
4b6cd69a ER |
159 | mkdir -p sql |
160 | mv *.sql sql | |
86a72dca | 161 | # you should run this sql if your database contains path to %{_datadir}... |
de4cec3c | 162 | cp %{SOURCE5} sql |
817cc464 | 163 | cp %{SOURCE6} sql |
4b6cd69a | 164 | |
af389505 ER |
165 | %{__rm} -r lib/adodb |
166 | %{__rm} log/.htaccess | |
167 | %{__rm} cli/.htaccess | |
af389505 | 168 | %{__rm} rra/.htaccess |
344e658b | 169 | |
93d2fa9c ER |
170 | # must require libs to get fatals on missing files, not include |
171 | %{__sed} -i -e ' | |
172 | s,include(dirname(__FILE__)."/../include/global.php");,require(dirname(__FILE__)."/../include/global.php");, | |
173 | s,include_once,require_once, | |
174 | ' cli/*.php | |
175 | ||
c68d3a6e ER |
176 | # make sure scripts have php shebang |
177 | %{__sed} -i -e '1{ | |
178 | /bin.php/!i#!%{_bindir}/php | |
179 | }' scripts/*.php cli/*.php | |
6587a5d5 | 180 | |
c68d3a6e | 181 | chmod a+rx scripts/*.php cli/*.php |
ebacb7e6 | 182 | |
f4a0dd1f ER |
183 | find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f |
184 | ||
a0b0ee8a | 185 | # make sure cacti runs out of the box |
af389505 | 186 | %{__sed} -i -e 's,new_install,%{version},' sql/cacti.sql |
a0b0ee8a | 187 | |
6587a5d5 | 188 | %install |
94614147 | 189 | rm -rf $RPM_BUILD_ROOT |
af389505 | 190 | install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},%{_appdir}/{docs,plugins},/etc/{cron.d,logrotate.d},%{_sbindir}} |
8c6ff4ca | 191 | install -d $RPM_BUILD_ROOT/var/{log,{lib,cache}/%{name}} |
e9300b9e | 192 | |
4b6cd69a | 193 | cp -a *.php $RPM_BUILD_ROOT%{_appdir} |
de4cec3c | 194 | cp -a cli images include install lib resource scripts sql $RPM_BUILD_ROOT%{_appdir} |
4b6cd69a ER |
195 | cp -a docs/html $RPM_BUILD_ROOT%{_appdir}/docs/html |
196 | mv $RPM_BUILD_ROOT{%{_appdir}/poller.php,%{_sbindir}/cacti-poller} | |
e9300b9e | 197 | |
4b6cd69a | 198 | cp -a log $RPM_BUILD_ROOT/var/log/%{name} |
b53d6410 | 199 | install -d $RPM_BUILD_ROOT/var/log/archive/%{name} |
4b6cd69a | 200 | cp -a rra $RPM_BUILD_ROOT/var/lib/%{name} |
e9300b9e | 201 | |
caa81993 | 202 | mv $RPM_BUILD_ROOT{%{_appdir}/include,%{_sysconfdir}}/config.php |
4b6cd69a | 203 | cp -a %{SOURCE2} $RPM_BUILD_ROOT/etc/cron.d/%{name} |
af389505 | 204 | cp -a %{SOURCE7} $RPM_BUILD_ROOT/etc/logrotate.d/%{name} |
4b6cd69a | 205 | |
de4cec3c GS |
206 | cp -a %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf |
207 | cp -a %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf | |
208 | cp -a %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf | |
6587a5d5 JB |
209 | |
210 | %clean | |
94614147 | 211 | rm -rf $RPM_BUILD_ROOT |
6587a5d5 | 212 | |
f4a0dd1f ER |
213 | %pre |
214 | %useradd -u 184 -d /var/lib/%{name} -g http -c "Cacti User" cacti | |
215 | ||
4b6cd69a ER |
216 | %post |
217 | if [ ! -f /var/log/%{name}/cacti.log ]; then | |
218 | install -m660 -oroot -ghttp /dev/null /var/log/%{name}/cacti.log | |
219 | fi | |
220 | ||
f4a0dd1f ER |
221 | %postun |
222 | if [ "$1" = "0" ]; then | |
223 | %userremove cacti | |
224 | fi | |
225 | ||
4b6cd69a ER |
226 | %triggerin -- apache1 < 1.3.37-3, apache1-base |
227 | %webapp_register apache %{_webapp} | |
228 | ||
229 | %triggerun -- apache1 < 1.3.37-3, apache1-base | |
230 | %webapp_unregister apache %{_webapp} | |
231 | ||
232 | %triggerin -- apache < 2.2.0, apache-base | |
233 | %webapp_register httpd %{_webapp} | |
234 | ||
235 | %triggerun -- apache < 2.2.0, apache-base | |
236 | %webapp_unregister httpd %{_webapp} | |
237 | ||
238 | %triggerin -- lighttpd | |
239 | %webapp_register lighttpd %{_webapp} | |
240 | ||
241 | %triggerun -- lighttpd | |
242 | %webapp_unregister lighttpd %{_webapp} | |
243 | ||
244 | %triggerpostun -- %{name} < 0.8.7b-9.5 | |
245 | if [ -f /etc/cacti/cacti.cfg.rpmsave ]; then | |
246 | cp -f %{_sysconfdir}/config.php{,.rpmnew} | |
247 | mv /etc/cacti/cacti.cfg.rpmsave %{_sysconfdir}/config.php | |
248 | fi | |
249 | ||
6587a5d5 | 250 | %files |
94614147 | 251 | %defattr(644,root,root,755) |
e4aad445 | 252 | %doc docs/CHANGELOG docs/CONTRIB docs/README docs/txt/manual.txt |
4b6cd69a ER |
253 | %dir %attr(750,root,http) %{_sysconfdir} |
254 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf | |
255 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf | |
256 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lighttpd.conf | |
257 | %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config.php | |
258 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name} | |
af389505 | 259 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name} |
4b6cd69a | 260 | %attr(755,root,root) %{_sbindir}/cacti-poller |
344e658b | 261 | %dir %{_appdir} |
4b6cd69a ER |
262 | %exclude %{_appdir}/install |
263 | %exclude %{_appdir}/docs | |
344e658b ER |
264 | %{_appdir}/resource |
265 | %{_appdir}/sql | |
266 | %{_appdir}/lib | |
267 | %{_appdir}/include | |
268 | %{_appdir}/images | |
344e658b ER |
269 | %{_appdir}/plugins |
270 | %{_appdir}/*.php | |
271 | ||
ebacb7e6 ER |
272 | %dir %{_appdir}/cli |
273 | %attr(755,root,root) %{_appdir}/cli/* | |
274 | ||
344e658b ER |
275 | %dir %{_appdir}/scripts |
276 | %attr(755,root,root) %{_appdir}/scripts/* | |
4b6cd69a | 277 | |
ea4c4a5f AM |
278 | %attr(750,root,http) %dir /var/lib/%{name} |
279 | %attr(770,root,http) %dir /var/lib/%{name}/rra | |
4b6cd69a | 280 | %attr(730,root,http) %dir /var/log/%{name} |
b53d6410 | 281 | %attr(750,root,logs) %dir /var/log/archive/%{name} |
4b6cd69a | 282 | %attr(660,root,http) %ghost /var/log/%{name}/cacti.log |
8c6ff4ca | 283 | %attr(730,root,http) %dir /var/cache/%{name} |
4b6cd69a ER |
284 | |
285 | %files setup | |
286 | %defattr(644,root,root,755) | |
287 | %{_appdir}/install | |
288 | ||
289 | %files doc | |
290 | %defattr(644,root,root,755) | |
adf6e05d | 291 | %{_appdir}/docs |