]> git.pld-linux.org Git - packages/cacti.git/blob - cacti.spec
- up to 0.8.7h
[packages/cacti.git] / cacti.spec
1 #
2 # Conditional build:
3 %bcond_without  pa              # without plugin archidecture patch
4
5 %define         pia_ver 3.0
6 %include        /usr/lib/rpm/macros.perl
7 Summary:        Cacti is a PHP frontend for rrdtool
8 Summary(pl.UTF-8):      Cacti - frontend w PHP do rrdtoola
9 Name:           cacti
10 Version:        0.8.7h
11 Release:        1
12 License:        GPL
13 Group:          Applications/WWW
14 Source0:        http://www.cacti.net/downloads/%{name}-%{version}.tar.gz
15 # Source0-md5:  58c9371341f49a190ae11a85118e598d
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://docs.cacti.net/manual:087:1_installation.9_pia
23 Source8:        http://www.cacti.net/downloads/pia/%{name}-plugin-%{version}-PA-v%{pia_ver}.tar.gz
24 # Source8-md5:  1f45a65dc76dee368b11f2c78ae89dfb
25 # NOTE: update provides: cacti(pia) when updating the patch
26 Patch0:         %{name}-PA.patch
27 Patch1:         %{name}-config.patch
28 Patch2:         %{name}-adodb.patch
29 Patch3:         %{name}-ioerror.patch
30 Patch4:         %{name}-webroot.patch
31 Patch5:         %{name}-linux_memory.patch
32 Patch6:         %{name}-log-verbosity.patch
33 Patch7:         %{name}-ss_disk-array-indices.patch
34 Patch8:         host_name-url.patch
35 # http://www.cacti.net/download_patches.php
36 #Patch10:       none now
37 URL:            http://www.cacti.net/
38 BuildRequires:  rpm-perlprov
39 BuildRequires:  sed >= 4.0
40 Requires(postun):       /usr/sbin/userdel
41 Requires(pre):  /bin/id
42 Requires(pre):  /usr/sbin/useradd
43 Requires:       adodb >= 4.67-1.17
44 Requires:       crondaemon
45 Requires:       group(http)
46 Requires:       net-snmp-utils
47 Requires:       php-cli
48 Requires:       php-common >= 4:5.2.13-10
49 Requires:       php-mysql
50 Requires:       php-pcre
51 Requires:       php-session
52 Requires:       php-snmp
53 Requires:       php-xml
54 Requires:       rrdtool
55 Requires:       webapps
56 Requires:       webserver
57 Requires:       webserver(access)
58 Requires:       webserver(alias)
59 Requires:       webserver(indexfile)
60 Requires:       webserver(php)
61 Suggests:       cacti-spine
62 Suggests:       php-gd
63 Provides:       cacti(pia) = %{pia_ver}
64 Provides:       user(cacti)
65 BuildArch:      noarch
66 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
67
68 %define         _webapps        /etc/webapps
69 %define         _webapp         %{name}
70 %define         _sysconfdir     %{_webapps}/%{_webapp}
71 %define         _appdir         /usr/share/%{name}
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 %{?with_pa:-a8}
124 # official patches
125 #%patch10 -p1
126
127 %if %{with pa}
128 %patch0 -p1
129 # copy images and drop the rest
130 mv cacti-plugin-arch/files/images/* images
131 %{__rm} -r cacti-plugin-arch
132 %endif
133
134 %patch1 -p1
135 %patch2 -p1
136 %patch3 -p1
137 %patch4 -p1
138 %patch5 -p1
139 %patch6 -p1
140 %patch7 -p1
141 %patch8 -p1
142
143 mkdir -p sql
144 mv *.sql sql
145 # you should run this sql if your database contains path to %{_datadir}...
146 cp %{SOURCE5} sql
147 cp %{SOURCE6} sql
148
149 %{__rm} -r lib/adodb
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 -a *.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 install -d $RPM_BUILD_ROOT/var/log/archive/%{name}
184 cp -a rra $RPM_BUILD_ROOT/var/lib/%{name}
185
186 mv $RPM_BUILD_ROOT{%{_appdir}/include,%{_sysconfdir}}/config.php
187 cp -a %{SOURCE2} $RPM_BUILD_ROOT/etc/cron.d/%{name}
188 cp -a %{SOURCE7} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
189
190 cp -a %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
191 cp -a %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
192 cp -a %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf
193
194 %clean
195 rm -rf $RPM_BUILD_ROOT
196
197 %pre
198 %useradd -u 184 -d /var/lib/%{name} -g http -c "Cacti User" cacti
199
200 %post
201 if [ ! -f /var/log/%{name}/cacti.log ]; then
202         install -m660 -oroot -ghttp /dev/null /var/log/%{name}/cacti.log
203 fi
204
205 %postun
206 if [ "$1" = "0" ]; then
207         %userremove cacti
208 fi
209
210 %triggerin -- apache1 < 1.3.37-3, apache1-base
211 %webapp_register apache %{_webapp}
212
213 %triggerun -- apache1 < 1.3.37-3, apache1-base
214 %webapp_unregister apache %{_webapp}
215
216 %triggerin -- apache < 2.2.0, apache-base
217 %webapp_register httpd %{_webapp}
218
219 %triggerun -- apache < 2.2.0, apache-base
220 %webapp_unregister httpd %{_webapp}
221
222 %triggerin -- lighttpd
223 %webapp_register lighttpd %{_webapp}
224
225 %triggerun -- lighttpd
226 %webapp_unregister lighttpd %{_webapp}
227
228 %triggerpostun -- %{name} < 0.8.7b-9.5
229 if [ -f /etc/cacti/cacti.cfg.rpmsave ]; then
230         cp -f %{_sysconfdir}/config.php{,.rpmnew}
231         mv /etc/cacti/cacti.cfg.rpmsave %{_sysconfdir}/config.php
232 fi
233
234 %files
235 %defattr(644,root,root,755)
236 %doc docs/CHANGELOG docs/CONTRIB docs/README docs/txt/manual.txt
237 %dir %attr(750,root,http) %{_sysconfdir}
238 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf
239 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf
240 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lighttpd.conf
241 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config.php
242 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
243 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
244 %attr(755,root,root) %{_sbindir}/cacti-poller
245 %dir %{_appdir}
246 %exclude %{_appdir}/install
247 %exclude %{_appdir}/docs
248 %{_appdir}/resource
249 %{_appdir}/sql
250 %{_appdir}/lib
251 %{_appdir}/include
252 %{_appdir}/images
253 %{_appdir}/plugins
254 %{_appdir}/*.php
255
256 %dir %{_appdir}/cli
257 %attr(755,root,root) %{_appdir}/cli/*
258
259 %dir %{_appdir}/scripts
260 %attr(755,root,root) %{_appdir}/scripts/*
261
262 %attr(750,root,http) %dir /var/lib/%{name}
263 %attr(770,root,http) %dir /var/lib/%{name}/rra
264 %attr(730,root,http) %dir /var/log/%{name}
265 %attr(750,root,logs) %dir /var/log/archive/%{name}
266 %attr(660,root,http) %ghost /var/log/%{name}/cacti.log
267 %attr(730,root,http) %dir /var/cache/%{name}
268
269 %files setup
270 %defattr(644,root,root,755)
271 %{_appdir}/install
272
273 %files doc
274 %defattr(644,root,root,755)
275 %{_appdir}/docs
This page took 0.090173 seconds and 3 git commands to generate.