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