]>
Commit | Line | Data |
---|---|---|
bb0e5568 ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without pa # without plugin archidecture patch | |
4 | ||
e90043f8 | 5 | %include /usr/lib/rpm/macros.perl |
9f35c748 | 6 | Summary: Cacti is a PHP frontend for rrdtool |
bf643d4f | 7 | Summary(pl.UTF-8): Cacti - frontend w PHP do rrdtoola |
94614147 | 8 | Name: cacti |
bb0e5568 ER |
9 | Version: 0.8.7g |
10 | Release: 0.1 | |
6587a5d5 | 11 | License: GPL |
94614147 | 12 | Group: Applications/WWW |
761b4fb2 | 13 | Source0: http://www.cacti.net/downloads/%{name}-%{version}.tar.gz |
bb0e5568 | 14 | # Source0-md5: 268421cb1a58d3444f7ecbddb4c4b016 |
f4a0dd1f | 15 | Source1: %{name}.cfg.php |
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 |
8514c08f | 21 | # http://cactiusers.org/wiki/PluginArchitectureInstall |
ac01d3f9 | 22 | # http://mirror.cactiusers.org/downloads/plugins/cacti-plugin-0.8.7f-PA-v2.7.tar.gz |
8514c08f | 23 | Patch0: %{name}-PA.patch |
de4cec3c GS |
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 | |
ac01d3f9 AZ |
31 | Patch8: host_name-url.patch |
32 | Patch9: cli-relpath.patch | |
761b4fb2 | 33 | URL: http://www.cacti.net/ |
89aea3b3 | 34 | BuildRequires: rpm-perlprov |
344e658b | 35 | BuildRequires: sed >= 4.0 |
f4a0dd1f ER |
36 | Requires(postun): /usr/sbin/userdel |
37 | Requires(pre): /bin/id | |
38 | Requires(pre): /usr/sbin/useradd | |
f44cea91 | 39 | Requires: adodb >= 4.67-1.17 |
e9300b9e | 40 | Requires: crondaemon |
f4a0dd1f | 41 | Requires: group(http) |
94614147 | 42 | Requires: net-snmp-utils |
4e25427a | 43 | Requires: php-cli |
c5421ef6 | 44 | Requires: php-common >= 4:5.2.13-10 |
c5421ef6 ER |
45 | Requires: php-mysql |
46 | Requires: php-pcre | |
47 | Requires: php-session | |
48 | Requires: php-snmp | |
49 | Requires: php-xml | |
c8f292cd | 50 | Requires: rrdtool |
4b6cd69a | 51 | Requires: webapps |
e4f2f951 | 52 | Requires: webserver |
cce68540 | 53 | Requires: webserver(access) |
7d4ec5c1 | 54 | Requires: webserver(alias) |
09dccb3a | 55 | Requires: webserver(indexfile) |
f5a0e42f | 56 | Requires: webserver(php) |
578edcb5 | 57 | Suggests: cacti-spine |
24fa0556 | 58 | Suggests: php-gd |
f4a0dd1f | 59 | Provides: user(cacti) |
6587a5d5 | 60 | BuildArch: noarch |
94614147 JB |
61 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
62 | ||
4b6cd69a ER |
63 | %define _webapps /etc/webapps |
64 | %define _webapp %{name} | |
65 | %define _sysconfdir %{_webapps}/%{_webapp} | |
66 | %define _appdir /usr/share/%{name} | |
6587a5d5 JB |
67 | |
68 | %description | |
69 | Cacti is a complete frondend to rrdtool, it stores all of the | |
94614147 JB |
70 | nessesary information to create graphs and populate them with data in |
71 | a MySQL database. | |
6587a5d5 | 72 | |
94614147 JB |
73 | The frontend is completely PHP driven. Along with being able to |
74 | maintain Graphs, Data Sources, and Round Robin Archives in a database, | |
75 | cacti handles the data gathering also. There is also SNMP support for | |
76 | those used to creating traffic graphs with MRTG. | |
6587a5d5 | 77 | |
41840fab | 78 | %description -l pl.UTF-8 |
350cedee | 79 | Cacti to pełny frontend do rrdtoola, zapamiętujący wszystkie |
bf643d4f ER |
80 | informacje potrzebne do tworzenia wykresów i wypełniające je danymi w |
81 | bazie MySQL. | |
c9dfb888 | 82 | |
350cedee | 83 | Frontend jest w pełni oparty na PHP. Oprócz zarządzania wykresami, |
bf643d4f ER |
84 | źródłami danych, archiwami Round Robin w bazie danych, cacti obsługuje |
85 | także gromadzenie danych. Ma także obsługę SNMP przydatną przy | |
86 | tworzeniu wykresów ruchu przy użyciu MRTG. | |
c9dfb888 | 87 | |
4b6cd69a ER |
88 | %package setup |
89 | Summary: Cacti setup package | |
90 | Summary(pl.UTF-8): Pakiet do wstępnej konfiguracji Cacti | |
91 | Group: Applications/WWW | |
92 | Requires: %{name} = %{version}-%{release} | |
d6d42868 | 93 | Suggests: %{name}-doc = %{version}-%{release} |
4b6cd69a ER |
94 | |
95 | %description setup | |
96 | Install this package to configure initial Cacti installation. You | |
97 | should uninstall this package when you're done, as it considered | |
98 | insecure to keep the setup files in place. | |
99 | ||
a40c4ad5 JB |
100 | %description setup -l pl.UTF-8 |
101 | Ten pakiet należy zainstalować, aby wstępnie skonfigurować instalację | |
102 | Cacti. Po tym pakiet powinien zostać odinstalowany, jako że jego | |
103 | obecność może być niebezpieczna. | |
104 | ||
4b6cd69a ER |
105 | %package doc |
106 | Summary: HTML Documentation for Cacti | |
a40c4ad5 | 107 | Summary(pl.UTF-8): Dokumentacja do Cacti w formacie HTML |
4b6cd69a ER |
108 | Group: Documentation |
109 | Requires: %{name} = %{version}-%{release} | |
110 | ||
111 | %description doc | |
112 | HTML Documentation for Cacti. | |
113 | ||
a40c4ad5 JB |
114 | %description doc -l pl.UTF-8 |
115 | Dokumentacja do Cacti w formacie HTML. | |
116 | ||
6587a5d5 | 117 | %prep |
de4cec3c | 118 | %setup -q |
bb0e5568 | 119 | %{?with_pa:%patch0 -p1} |
0482abbd | 120 | %patch1 -p1 |
f23be293 | 121 | %patch2 -p1 |
14544804 | 122 | %patch3 -p1 |
d6d42868 ER |
123 | %patch4 -p1 |
124 | %patch5 -p1 | |
125 | %patch6 -p1 | |
5e8efd1f | 126 | %patch7 -p1 |
de4cec3c | 127 | %patch8 -p1 |
fe418db4 | 128 | %patch9 -p1 |
6587a5d5 | 129 | |
4b6cd69a ER |
130 | mkdir -p sql |
131 | mv *.sql sql | |
86a72dca | 132 | # you should run this sql if your database contains path to %{_datadir}... |
de4cec3c | 133 | cp %{SOURCE5} sql |
817cc464 | 134 | cp %{SOURCE6} sql |
4b6cd69a | 135 | |
4b6cd69a | 136 | rm -rf cacti-plugin-arch |
f44cea91 | 137 | rm -rf lib/adodb |
4b6cd69a | 138 | rm -f log/.htaccess |
ebacb7e6 | 139 | rm -f cli/.htaccess |
4b6cd69a | 140 | rm -f rra/.placeholder |
bb0e5568 | 141 | rm -f rra/.htaccess |
344e658b | 142 | |
93d2fa9c ER |
143 | # must require libs to get fatals on missing files, not include |
144 | %{__sed} -i -e ' | |
145 | s,include(dirname(__FILE__)."/../include/global.php");,require(dirname(__FILE__)."/../include/global.php");, | |
146 | s,include_once,require_once, | |
147 | ' cli/*.php | |
148 | ||
c68d3a6e ER |
149 | # make sure scripts have php shebang |
150 | %{__sed} -i -e '1{ | |
151 | /bin.php/!i#!%{_bindir}/php | |
152 | }' scripts/*.php cli/*.php | |
6587a5d5 | 153 | |
c68d3a6e | 154 | chmod a+rx scripts/*.php cli/*.php |
ebacb7e6 | 155 | |
f4a0dd1f ER |
156 | find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f |
157 | ||
a0b0ee8a MM |
158 | # make sure cacti runs out of the box |
159 | sed -e "s,new_install,%{version}," -i sql/cacti.sql | |
160 | ||
6587a5d5 | 161 | %install |
94614147 | 162 | rm -rf $RPM_BUILD_ROOT |
de4cec3c | 163 | install -d $RPM_BUILD_ROOT{%{_sysconfdir}/%{name},%{_appdir}/{docs,plugins},/etc/cron.d,%{_sbindir}} |
c7a01fb3 | 164 | install -d $RPM_BUILD_ROOT/var/{log,lib/%{name}} |
e9300b9e | 165 | |
4b6cd69a | 166 | cp -a *.php $RPM_BUILD_ROOT%{_appdir} |
de4cec3c | 167 | cp -a cli images include install lib resource scripts sql $RPM_BUILD_ROOT%{_appdir} |
4b6cd69a ER |
168 | cp -a docs/html $RPM_BUILD_ROOT%{_appdir}/docs/html |
169 | mv $RPM_BUILD_ROOT{%{_appdir}/poller.php,%{_sbindir}/cacti-poller} | |
e9300b9e | 170 | |
4b6cd69a ER |
171 | cp -a log $RPM_BUILD_ROOT/var/log/%{name} |
172 | cp -a rra $RPM_BUILD_ROOT/var/lib/%{name} | |
e9300b9e | 173 | |
4b6cd69a | 174 | cp -a %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/config.php |
4b6cd69a ER |
175 | cp -a %{SOURCE2} $RPM_BUILD_ROOT/etc/cron.d/%{name} |
176 | ||
de4cec3c GS |
177 | cp -a %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf |
178 | cp -a %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf | |
179 | cp -a %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf | |
6587a5d5 JB |
180 | |
181 | %clean | |
94614147 | 182 | rm -rf $RPM_BUILD_ROOT |
6587a5d5 | 183 | |
f4a0dd1f ER |
184 | %pre |
185 | %useradd -u 184 -d /var/lib/%{name} -g http -c "Cacti User" cacti | |
186 | ||
4b6cd69a ER |
187 | %post |
188 | if [ ! -f /var/log/%{name}/cacti.log ]; then | |
189 | install -m660 -oroot -ghttp /dev/null /var/log/%{name}/cacti.log | |
190 | fi | |
191 | ||
f4a0dd1f ER |
192 | %postun |
193 | if [ "$1" = "0" ]; then | |
194 | %userremove cacti | |
195 | fi | |
196 | ||
4b6cd69a ER |
197 | %triggerin -- apache1 < 1.3.37-3, apache1-base |
198 | %webapp_register apache %{_webapp} | |
199 | ||
200 | %triggerun -- apache1 < 1.3.37-3, apache1-base | |
201 | %webapp_unregister apache %{_webapp} | |
202 | ||
203 | %triggerin -- apache < 2.2.0, apache-base | |
204 | %webapp_register httpd %{_webapp} | |
205 | ||
206 | %triggerun -- apache < 2.2.0, apache-base | |
207 | %webapp_unregister httpd %{_webapp} | |
208 | ||
209 | %triggerin -- lighttpd | |
210 | %webapp_register lighttpd %{_webapp} | |
211 | ||
212 | %triggerun -- lighttpd | |
213 | %webapp_unregister lighttpd %{_webapp} | |
214 | ||
215 | %triggerpostun -- %{name} < 0.8.7b-9.5 | |
216 | if [ -f /etc/cacti/cacti.cfg.rpmsave ]; then | |
217 | cp -f %{_sysconfdir}/config.php{,.rpmnew} | |
218 | mv /etc/cacti/cacti.cfg.rpmsave %{_sysconfdir}/config.php | |
219 | fi | |
220 | ||
6587a5d5 | 221 | %files |
94614147 | 222 | %defattr(644,root,root,755) |
e4aad445 | 223 | %doc docs/CHANGELOG docs/CONTRIB docs/README docs/txt/manual.txt |
4b6cd69a ER |
224 | %dir %attr(750,root,http) %{_sysconfdir} |
225 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf | |
226 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf | |
227 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lighttpd.conf | |
228 | %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config.php | |
229 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name} | |
230 | %attr(755,root,root) %{_sbindir}/cacti-poller | |
344e658b | 231 | %dir %{_appdir} |
4b6cd69a ER |
232 | %exclude %{_appdir}/install |
233 | %exclude %{_appdir}/docs | |
344e658b ER |
234 | %{_appdir}/resource |
235 | %{_appdir}/sql | |
236 | %{_appdir}/lib | |
237 | %{_appdir}/include | |
238 | %{_appdir}/images | |
344e658b ER |
239 | %{_appdir}/plugins |
240 | %{_appdir}/*.php | |
241 | ||
ebacb7e6 ER |
242 | %dir %{_appdir}/cli |
243 | %attr(755,root,root) %{_appdir}/cli/* | |
244 | ||
344e658b ER |
245 | %dir %{_appdir}/scripts |
246 | %attr(755,root,root) %{_appdir}/scripts/* | |
4b6cd69a | 247 | |
ea4c4a5f AM |
248 | %attr(750,root,http) %dir /var/lib/%{name} |
249 | %attr(770,root,http) %dir /var/lib/%{name}/rra | |
4b6cd69a ER |
250 | %attr(730,root,http) %dir /var/log/%{name} |
251 | %attr(660,root,http) %ghost /var/log/%{name}/cacti.log | |
252 | ||
253 | %files setup | |
254 | %defattr(644,root,root,755) | |
255 | %{_appdir}/install | |
256 | ||
257 | %files doc | |
258 | %defattr(644,root,root,755) | |
adf6e05d | 259 | %{_appdir}/docs |