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