]>
Commit | Line | Data |
---|---|---|
bc79e792 | 1 | %define pia_ver 3.1 |
4780a883 ER |
2 | %define php_min_version 5.2.13-10 |
3 | %include /usr/lib/rpm/macros.php | |
9f35c748 | 4 | Summary: Cacti is a PHP frontend for rrdtool |
bf643d4f | 5 | Summary(pl.UTF-8): Cacti - frontend w PHP do rrdtoola |
94614147 | 6 | Name: cacti |
71281bc3 | 7 | Version: 1.1.32 |
76dc65fe | 8 | Release: 1 |
bc79e792 | 9 | License: GPL v2 |
94614147 | 10 | Group: Applications/WWW |
ffbcce38 | 11 | Source0: http://www.cacti.net/downloads/%{name}-%{version}.tar.gz |
71281bc3 | 12 | # Source0-md5: 7c6951e3c977146d72eb68398c82add2 |
a1abeca3 | 13 | Source2: %{name}.crontab |
de4cec3c GS |
14 | Source3: %{name}-apache.conf |
15 | Source4: %{name}-lighttpd.conf | |
16 | Source5: %{name}-rrdpath.sql | |
af389505 | 17 | Source7: %{name}.logrotate |
81fd7803 | 18 | |
de4cec3c | 19 | Patch1: %{name}-config.patch |
81fd7803 | 20 | |
de4cec3c GS |
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 | |
ac01d3f9 | 26 | Patch8: host_name-url.patch |
e79e3b18 | 27 | # http://www.cacti.net/download_patches.php |
08cf4295 | 28 | # Patch100: .. |
855dc8ae | 29 | URL: http://www.cacti.net/ |
344e658b | 30 | BuildRequires: sed >= 4.0 |
f4a0dd1f ER |
31 | Requires(postun): /usr/sbin/userdel |
32 | Requires(pre): /bin/id | |
33 | Requires(pre): /usr/sbin/useradd | |
bc79e792 | 34 | Requires: cacti-plugin-boost >= 5.0 |
e9300b9e | 35 | Requires: crondaemon |
f4a0dd1f | 36 | Requires: group(http) |
94614147 | 37 | Requires: net-snmp-utils |
4780a883 | 38 | Requires: php(core) >= %{php_min_version} |
587a5678 | 39 | Requires: php(ctype) |
a9ce9d89 AM |
40 | Requires: php(filter) |
41 | Requires: php(json) | |
42 | Requires: php(mbstring) | |
6e11204f | 43 | Requires: php(pcre) |
fc151646 | 44 | Requires: php(pdo-mysql) |
6e11204f ER |
45 | Requires: php(session) |
46 | Requires: php(snmp) | |
47 | Requires: php(xml) | |
c8f292cd | 48 | Requires: rrdtool |
4b6cd69a | 49 | Requires: webapps |
e4f2f951 | 50 | Requires: webserver |
cce68540 | 51 | Requires: webserver(access) |
7d4ec5c1 | 52 | Requires: webserver(alias) |
09dccb3a | 53 | Requires: webserver(indexfile) |
f5a0e42f | 54 | Requires: webserver(php) |
578edcb5 | 55 | Suggests: cacti-spine |
e38b8207 ER |
56 | Suggests: php(bcmath) |
57 | Suggests: php(ftp) | |
58 | Suggests: php(gd) | |
d839b321 | 59 | Provides: cacti(pia) = %{pia_ver} |
f4a0dd1f | 60 | Provides: user(cacti) |
33c70cd1 | 61 | Obsoletes: cacti-add_template |
9f8f6fd2 | 62 | Obsoletes: cacti-plugin-update |
aa6fbcd1 | 63 | %if "%{pld_release}" != "ac" |
6e11204f | 64 | Conflicts: logrotate < 3.8.0 |
aa6fbcd1 | 65 | %endif |
6587a5d5 | 66 | BuildArch: noarch |
94614147 JB |
67 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
68 | ||
4b6cd69a ER |
69 | %define _webapps /etc/webapps |
70 | %define _webapp %{name} | |
71 | %define _sysconfdir %{_webapps}/%{_webapp} | |
72 | %define _appdir /usr/share/%{name} | |
6587a5d5 | 73 | |
4780a883 ER |
74 | # bad depsolver |
75 | %define _noautopear pear | |
d6d94c67 ER |
76 | # optional |
77 | %define _noautophp php-ftp php-bcmath | |
4780a883 ER |
78 | |
79 | # put it together for rpmbuild | |
80 | %define _noautoreq %{?_noautophp} %{?_noautopear} | |
81 | ||
6587a5d5 JB |
82 | %description |
83 | Cacti is a complete frondend to rrdtool, it stores all of the | |
94614147 JB |
84 | nessesary information to create graphs and populate them with data in |
85 | a MySQL database. | |
6587a5d5 | 86 | |
94614147 JB |
87 | The frontend is completely PHP driven. Along with being able to |
88 | maintain Graphs, Data Sources, and Round Robin Archives in a database, | |
89 | cacti handles the data gathering also. There is also SNMP support for | |
90 | those used to creating traffic graphs with MRTG. | |
6587a5d5 | 91 | |
41840fab | 92 | %description -l pl.UTF-8 |
350cedee | 93 | Cacti to pełny frontend do rrdtoola, zapamiętujący wszystkie |
bf643d4f ER |
94 | informacje potrzebne do tworzenia wykresów i wypełniające je danymi w |
95 | bazie MySQL. | |
c9dfb888 | 96 | |
350cedee | 97 | Frontend jest w pełni oparty na PHP. Oprócz zarządzania wykresami, |
bf643d4f ER |
98 | źródłami danych, archiwami Round Robin w bazie danych, cacti obsługuje |
99 | także gromadzenie danych. Ma także obsługę SNMP przydatną przy | |
100 | tworzeniu wykresów ruchu przy użyciu MRTG. | |
c9dfb888 | 101 | |
4b6cd69a ER |
102 | %package setup |
103 | Summary: Cacti setup package | |
104 | Summary(pl.UTF-8): Pakiet do wstępnej konfiguracji Cacti | |
105 | Group: Applications/WWW | |
106 | Requires: %{name} = %{version}-%{release} | |
d6d42868 | 107 | Suggests: %{name}-doc = %{version}-%{release} |
4b6cd69a ER |
108 | |
109 | %description setup | |
110 | Install this package to configure initial Cacti installation. You | |
111 | should uninstall this package when you're done, as it considered | |
112 | insecure to keep the setup files in place. | |
113 | ||
a40c4ad5 JB |
114 | %description setup -l pl.UTF-8 |
115 | Ten pakiet należy zainstalować, aby wstępnie skonfigurować instalację | |
116 | Cacti. Po tym pakiet powinien zostać odinstalowany, jako że jego | |
117 | obecność może być niebezpieczna. | |
118 | ||
4b6cd69a ER |
119 | %package doc |
120 | Summary: HTML Documentation for Cacti | |
a40c4ad5 | 121 | Summary(pl.UTF-8): Dokumentacja do Cacti w formacie HTML |
4b6cd69a ER |
122 | Group: Documentation |
123 | Requires: %{name} = %{version}-%{release} | |
124 | ||
125 | %description doc | |
126 | HTML Documentation for Cacti. | |
127 | ||
a40c4ad5 JB |
128 | %description doc -l pl.UTF-8 |
129 | Dokumentacja do Cacti w formacie HTML. | |
130 | ||
6587a5d5 | 131 | %prep |
ffbcce38 | 132 | %setup -q |
4a9821cf | 133 | |
482f9753 | 134 | # official patches |
4a9821cf ER |
135 | %if 0%{?PATCH100:1} |
136 | %patch100 -p1 | |
137 | %endif | |
482f9753 | 138 | |
0482abbd | 139 | %patch1 -p1 |
81fd7803 | 140 | |
14544804 | 141 | %patch3 -p1 |
d6d42868 ER |
142 | %patch4 -p1 |
143 | %patch5 -p1 | |
144 | %patch6 -p1 | |
5e8efd1f | 145 | %patch7 -p1 |
81fd7803 AM |
146 | # ? |
147 | # %patch8 -p1 | |
6587a5d5 | 148 | |
4b6cd69a ER |
149 | mkdir -p sql |
150 | mv *.sql sql | |
86a72dca | 151 | # you should run this sql if your database contains path to %{_datadir}... |
3d0c4fef | 152 | cp -p %{SOURCE5} sql |
4b6cd69a | 153 | |
af389505 ER |
154 | %{__rm} log/.htaccess |
155 | %{__rm} cli/.htaccess | |
af389505 | 156 | %{__rm} rra/.htaccess |
344e658b | 157 | |
93d2fa9c ER |
158 | # must require libs to get fatals on missing files, not include |
159 | %{__sed} -i -e ' | |
160 | s,include(dirname(__FILE__)."/../include/global.php");,require(dirname(__FILE__)."/../include/global.php");, | |
161 | s,include_once,require_once, | |
162 | ' cli/*.php | |
163 | ||
c68d3a6e ER |
164 | # make sure scripts have php shebang |
165 | %{__sed} -i -e '1{ | |
166 | /bin.php/!i#!%{_bindir}/php | |
167 | }' scripts/*.php cli/*.php | |
6587a5d5 | 168 | |
c68d3a6e | 169 | chmod a+rx scripts/*.php cli/*.php |
ebacb7e6 | 170 | |
f4a0dd1f ER |
171 | find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f |
172 | ||
a0b0ee8a | 173 | # make sure cacti runs out of the box |
af389505 | 174 | %{__sed} -i -e 's,new_install,%{version},' sql/cacti.sql |
a0b0ee8a | 175 | |
6587a5d5 | 176 | %install |
94614147 | 177 | rm -rf $RPM_BUILD_ROOT |
b2c7c665 | 178 | install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},%{_appdir}/docs,/etc/{cron.d,logrotate.d},%{_sbindir}} |
8c6ff4ca | 179 | install -d $RPM_BUILD_ROOT/var/{log,{lib,cache}/%{name}} |
e9300b9e | 180 | |
3d0c4fef | 181 | cp -p *.php $RPM_BUILD_ROOT%{_appdir} |
b2c7c665 AM |
182 | # dirs that contain index.php are likely to be installed |
183 | # ls -1d */index.php | cut -d"/" -f1 | xargs | |
71281bc3 AM |
184 | cp -a cache/* $RPM_BUILD_ROOT/var/cache/%{name} |
185 | ln -s /var/cache/%{name} $RPM_BUILD_ROOT%{_appdir}/cache | |
186 | cp -a cli formats images include install lib locales mibs plugins resource scripts sql $RPM_BUILD_ROOT%{_appdir} | |
4b6cd69a ER |
187 | cp -a docs/html $RPM_BUILD_ROOT%{_appdir}/docs/html |
188 | mv $RPM_BUILD_ROOT{%{_appdir}/poller.php,%{_sbindir}/cacti-poller} | |
e9300b9e | 189 | |
4b6cd69a | 190 | cp -a log $RPM_BUILD_ROOT/var/log/%{name} |
81fd7803 | 191 | :> $RPM_BUILD_ROOT/var/log/%{name}/%{name}.log |
b53d6410 | 192 | install -d $RPM_BUILD_ROOT/var/log/archive/%{name} |
4b6cd69a | 193 | cp -a rra $RPM_BUILD_ROOT/var/lib/%{name} |
e9300b9e | 194 | |
caa81993 | 195 | mv $RPM_BUILD_ROOT{%{_appdir}/include,%{_sysconfdir}}/config.php |
3d0c4fef ER |
196 | cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/cron.d/%{name} |
197 | cp -p %{SOURCE7} $RPM_BUILD_ROOT/etc/logrotate.d/%{name} | |
4b6cd69a | 198 | |
aa6fbcd1 ER |
199 | %if "%{pld_release}" == "ac" |
200 | %{__sed} -i -e '/su/d' $RPM_BUILD_ROOT/etc/logrotate.d/%{name} | |
201 | %endif | |
202 | ||
3d0c4fef | 203 | cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf |
e61341ec | 204 | cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf |
3d0c4fef | 205 | cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf |
6587a5d5 JB |
206 | |
207 | %clean | |
94614147 | 208 | rm -rf $RPM_BUILD_ROOT |
6587a5d5 | 209 | |
f4a0dd1f ER |
210 | %pre |
211 | %useradd -u 184 -d /var/lib/%{name} -g http -c "Cacti User" cacti | |
212 | ||
4b6cd69a ER |
213 | %post |
214 | if [ ! -f /var/log/%{name}/cacti.log ]; then | |
215 | install -m660 -oroot -ghttp /dev/null /var/log/%{name}/cacti.log | |
216 | fi | |
217 | ||
f4a0dd1f ER |
218 | %postun |
219 | if [ "$1" = "0" ]; then | |
220 | %userremove cacti | |
221 | fi | |
222 | ||
5e284e3e AM |
223 | %post setup |
224 | %{_appdir}/cli/upgrade_database.php || : | |
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 | ||
e61341ec | 232 | %triggerin -- apache < 2.2.0, apache-base |
4b6cd69a ER |
233 | %webapp_register httpd %{_webapp} |
234 | ||
e61341ec | 235 | %triggerun -- apache < 2.2.0, apache-base |
4b6cd69a ER |
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) |
81fd7803 | 252 | %doc README.md docs/CHANGELOG 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 | |
b2c7c665 AM |
264 | %{_appdir}/cache |
265 | %{_appdir}/formats | |
344e658b | 266 | %{_appdir}/images |
b2c7c665 AM |
267 | %{_appdir}/include |
268 | %{_appdir}/lib | |
0e54cf19 | 269 | %{_appdir}/locales |
fcd3cd85 | 270 | %{_appdir}/mibs |
344e658b | 271 | %{_appdir}/plugins |
b2c7c665 AM |
272 | %{_appdir}/resource |
273 | %{_appdir}/sql | |
344e658b ER |
274 | %{_appdir}/*.php |
275 | ||
ebacb7e6 ER |
276 | %dir %{_appdir}/cli |
277 | %attr(755,root,root) %{_appdir}/cli/* | |
278 | ||
344e658b ER |
279 | %dir %{_appdir}/scripts |
280 | %attr(755,root,root) %{_appdir}/scripts/* | |
4b6cd69a | 281 | |
ea4c4a5f AM |
282 | %attr(750,root,http) %dir /var/lib/%{name} |
283 | %attr(770,root,http) %dir /var/lib/%{name}/rra | |
4b6cd69a | 284 | %attr(730,root,http) %dir /var/log/%{name} |
b53d6410 | 285 | %attr(750,root,logs) %dir /var/log/archive/%{name} |
4b6cd69a | 286 | %attr(660,root,http) %ghost /var/log/%{name}/cacti.log |
8c6ff4ca | 287 | %attr(730,root,http) %dir /var/cache/%{name} |
71281bc3 AM |
288 | %attr(644,root,root) /var/cache/%{name}/index.php |
289 | %attr(730,root,http) %dir /var/cache/%{name}/boost | |
290 | %attr(730,root,http) %dir /var/cache/%{name}/mibcache | |
291 | %attr(730,root,http) %dir /var/cache/%{name}/realtime | |
292 | %attr(730,root,http) %dir /var/cache/%{name}/spikekill | |
293 | %attr(644,root,root) /var/cache/%{name}/*/.htaccess | |
294 | %attr(644,root,root) /var/cache/%{name}/*/index.php | |
4b6cd69a ER |
295 | |
296 | %files setup | |
297 | %defattr(644,root,root,755) | |
298 | %{_appdir}/install | |
299 | ||
300 | %files doc | |
301 | %defattr(644,root,root,755) | |
adf6e05d | 302 | %{_appdir}/docs |