1 %include /usr/lib/rpm/macros.perl
2 Summary: Smokeping - a latency grapher that uses rrdtool
3 Summary(pl.UTF-8): Smokeping - narzędzie do tworzenia wykresów opóźnień sieci
8 Group: Networking/Utilities
9 Source0: http://oss.oetiker.ch/smokeping/pub/%{name}-%{version}.tar.gz
10 # Source0-md5: 702392f5f3599f7eb1cc47eb2d192cb9
12 Source2: %{name}-apache.conf
13 Source3: %{name}-config
14 Source4: %{name}-lighttpd.conf
15 Source5: %{name}.tmpfiles
16 Source6: %{name}-httpd.conf
17 Patch0: fix-paths.patch
18 Patch1: high_precision_sleep_timer.patch
19 URL: http://oss.oetiker.ch/smokeping/
20 BuildRequires: perl-tools-pod
21 BuildRequires: rpm-perlprov >= 4.1-13
22 BuildRequires: rpmbuild(macros) >= 1.268
23 BuildRequires: sed >= 4.0
24 Requires(post): sed >= 4.0
25 Requires(post,preun): /sbin/chkconfig
26 Requires(postun): /usr/sbin/groupdel
27 Requires(postun): /usr/sbin/userdel
28 Requires(pre): /bin/id
29 Requires(pre): /usr/bin/getgid
30 Requires(pre): /usr/lib/rpm/user_group.sh
31 Requires(pre): /usr/sbin/groupadd
32 Requires(pre): /usr/sbin/useradd
33 Requires(pre): /usr/sbin/usermod
34 Requires(triggerpostun): findutils
35 Requires: rc-scripts >= 0.4.1.23
36 Requires: rrdtool >= 1.2
42 Suggests: openssh-clients
44 Provides: group(%{name})
45 Provides: user(%{name})
47 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
49 %define _noautoprovfiles %{_datadir}/%{name}
50 %define _noautoreq_perl BER CGI::Session::Driver CGI::Session::Driver::DBI CGI::Session::ErrorHandler Config::Grammar Digest::HMAC Digest::HMAC_MD5 JSON JSON::Converter JSON::Parser Smokeping Smokeping::ciscoRttMonMIB Smokeping::Colorspace Smokeping::Config Smokeping::Examples Smokeping::Graphs Smokeping::Master Smokeping::matchers::Avgratio Smokeping::matchers::base Smokeping::probes::base Smokeping::probes::basefork Smokeping::probes::basevars Smokeping::probes::EchoPing Smokeping::probes::EchoPingHttp Smokeping::probes::EchoPingPlugin Smokeping::probes::FPing Smokeping::probes::passwordchecker Smokeping::RRDhelpers Smokeping::RRDtools Smokeping::Slave Smokeping::sorters::base SNMP_Session SNMP_util
52 # How to obtain _noautoreq:
53 # 1. comment out _noauto* macros
54 # 2. repackage smokeping
55 # 3. select Provides from repackage output
56 # 4. xclip -o | sed 's/ perl/\nperl/' > perlprov
57 # 5. select Requires from repackage output
58 # 6. xclip -o | sed 's/ perl/\nperl/' > perlreq
59 # 7. cat perlprov perlreq | awk '{print $1}' | sort | uniq -c | grep '^ 2 ' | awk '{print $2}' | tr '\n' ' '
61 %define _sysconfdir /etc/%{name}
62 %define _webapps /etc/webapps
63 %define _webapp %{name}
64 %define _wwwconfdir %{_webapps}/%{_webapp}
65 %define _cgi_bindir %{_prefix}/share/%{name}
68 SmokePing is a ICMP latency logging and graphing system. It consists
69 of a daemon process which organizes the latency measurements and a CGI
70 which presents the graphs with interesting smoke-like effects.
72 %description -l pl.UTF-8
73 Smokeping jest narzędziem do tworzenia wykresów aktywności sieci.
74 Używając pakietów ICMP zapisuje czas odpowiedzi poszczególnych hostów
75 i wyświetla je w postaci czytelnego wykresu.
78 Summary: CGI webinterface for smokeping
79 Summary(pl.UTF-8): Interfejs WWW (CGI) do smokepinga
80 Group: Applications/WWW
81 Requires: %{name} = %{version}-%{release}
83 Requires: webserver(access)
84 Requires: webserver(alias)
85 Requires: webserver(cgi)
86 Conflicts: apache-base < 2.4.0-1
89 CGI webinterface for smokeping.
91 %description cgi -l pl.UTF-8
92 Interfejs WWW (CGI) do smokepinga.
100 #sed -i -e 's,^Net::.*$,,' PERL_MODULES
102 sed -i -e 's#@prefix@/etc/\(.*\).dist#/etc/smokeping/\1#' etc/config.dist.in
103 sed -i -e 's#@prefix@/etc/#/etc/smokeping/#' etc/config.dist.in
110 rm -rf $RPM_BUILD_ROOT
111 install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_sysconfdir},%{_wwwconfdir}} \
112 $RPM_BUILD_ROOT{%{_datadir}/%{name},%{_sharedstatedir}/%{name}/{img,rrd},%{_cgi_bindir}} \
113 $RPM_BUILD_ROOT{%{_mandir}/man{1,3,5,7},/var/run/%{name}} \
114 $RPM_BUILD_ROOT/usr/lib/tmpfiles.d
116 %{__make} install DESTDIR=$RPM_BUILD_ROOT
118 # start of fixing paths
119 for f in basepage.html smokemail smokeping_secrets tmail; do
120 mv $RPM_BUILD_ROOT/etc/smokeping/{$f.dist,$f}
123 rm -rf $RPM_BUILD_ROOT/etc/smokeping/examples
125 mv $RPM_BUILD_ROOT/usr/lib/{*.pm,Smokeping} $RPM_BUILD_ROOT%{_datadir}/%{name}
127 mv $RPM_BUILD_ROOT{/usr/htdocs/cropper,%{_cgi_bindir}}
128 mv $RPM_BUILD_ROOT%{_bindir}/smokeping_cgi $RPM_BUILD_ROOT%{_cgi_bindir}/smokeping.cgi
130 mv $RPM_BUILD_ROOT%{_mandir}/man1/{smokeping_cgi.1,smokeping.cgi.1}
131 # end of fixing paths
133 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
134 install %{SOURCE2} $RPM_BUILD_ROOT%{_wwwconfdir}/apache.conf
135 install %{SOURCE6} $RPM_BUILD_ROOT%{_wwwconfdir}/httpd.conf
136 install %{SOURCE4} $RPM_BUILD_ROOT%{_wwwconfdir}/lighttpd.conf
137 install %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/config
138 install %{SOURCE5} $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/%{name}.conf
142 rm -rf $RPM_BUILD_ROOT
145 %groupadd -g 207 %{name}
146 %useradd -u 207 -d /var/lib/%{name} -g %{name} -s /bin/false -c "Smokeping User" %{name}
147 %addusertogroup smokeping adm
150 /sbin/chkconfig --add %{name}
153 if [ "$1" = 0 ]; then
154 %service %{name} stop
155 /sbin/chkconfig --del %{name}
159 if [ "$1" = 0 ]; then
164 %triggerin cgi -- apache1 < 1.3.37-3, apache1-base
165 %webapp_register apache %{_webapp}
167 %triggerun cgi -- apache1 < 1.3.37-3, apache1-base
168 %webapp_unregister apache %{_webapp}
170 %triggerin cgi -- apache-base
171 %webapp_register httpd %{_webapp}
173 %triggerun cgi -- apache-base
174 %webapp_unregister httpd %{_webapp}
176 %triggerin cgi -- lighttpd
177 %webapp_register lighttpd %{_webapp}
179 %triggerun cgi -- lighttpd
180 %webapp_unregister lighttpd %{_webapp}
182 %triggerpostun -- %{name} < 2.0.5-0.3
183 # we put trigger on main package, because we can't trigger in new package
184 # this will create .rpmnew files when one installs -cgi package. but that's more than okay
185 if [ -f /etc/httpd/httpd.conf/99_%{name}.conf.rpmsave ]; then
186 install -d %{_wwwconfdir}
187 mv -f /etc/httpd/httpd.conf/99_%{name}.conf.rpmsave %{_wwwconfdir}/httpd.conf
190 %service -q httpd reload
192 %banner -e %{name} << EOF
193 The CGI program is available as %{name}-cgi package.
196 %triggerpostun -- %{name} < 2.4.2-3
197 find /var/lib/smokeping/rrd -type f -user root -group root -name \*.rrd -mtime -7 -exec chown smokeping \{\} \;
198 find /var/lib/smokeping/rrd -type d -user root -group root -exec chown smokeping \{\} \;
201 %defattr(644,root,root,755)
202 %doc CHANGES CONTRIBUTORS COPYRIGHT README TODO doc/*.txt doc/examples
203 %attr(755,root,root) %{_bindir}/smokeinfo
204 %attr(755,root,root) %{_bindir}/smokeping
205 %attr(755,root,root) %{_bindir}/tSmoke
206 %{_datadir}/smokeping
207 %exclude %{_cgi_bindir}/cropper
208 %exclude %{_datadir}/smokeping/smokeping.*cgi
209 %{_mandir}/man1/smokeping.1*
210 %{_mandir}/man1/smokeping.cgi.1*
211 %{_mandir}/man1/tSmoke.1*
216 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/basepage.html
217 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config
218 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config.dist
219 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/smokemail
220 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/smokeping_secrets
221 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/tmail
222 %attr(754,root,root) /etc/rc.d/init.d/smokeping
223 %dir %{_sharedstatedir}/%{name}
224 %dir %attr(775,root,smokeping) %{_sharedstatedir}/%{name}/rrd
225 %dir %attr(775,root,http) %{_sharedstatedir}/%{name}/img
226 %dir %attr(770,root,smokeping) /var/run/%{name}
227 /usr/lib/tmpfiles.d/%{name}.conf
230 %defattr(644,root,root,755)
231 %dir %attr(750,root,http) %{_wwwconfdir}
232 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_wwwconfdir}/apache.conf
233 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_wwwconfdir}/httpd.conf
234 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_wwwconfdir}/lighttpd.conf
235 %{_cgi_bindir}/cropper
236 %attr(755,root,root) %{_cgi_bindir}/smokeping.cgi