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