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