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-Config-Grammar
21 BuildRequires: perl-rrdtool
22 BuildRequires: perl-tools-pod
23 BuildRequires: rpm-perlprov >= 4.1-13
24 BuildRequires: rpmbuild(macros) >= 1.268
25 BuildRequires: sed >= 4.0
26 Requires(post): sed >= 4.0
27 Requires(post,preun): /sbin/chkconfig
28 Requires(postun): /usr/sbin/groupdel
29 Requires(postun): /usr/sbin/userdel
30 Requires(pre): /bin/id
31 Requires(pre): /usr/bin/getgid
32 Requires(pre): /usr/lib/rpm/user_group.sh
33 Requires(pre): /usr/sbin/groupadd
34 Requires(pre): /usr/sbin/useradd
35 Requires(pre): /usr/sbin/usermod
36 Requires(triggerpostun): findutils
37 Requires: perl-Config-Grammar
38 Requires: rc-scripts >= 0.4.1.23
39 Requires: rrdtool >= 1.2
44 Suggests: openssh-clients
46 Provides: group(%{name})
47 Provides: user(%{name})
49 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
51 %define _noautoprovfiles %{_datadir}/%{name}
52 %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
54 # How to obtain _noautoreq:
55 # 1. comment out _noauto* macros
56 # 2. repackage smokeping
57 # 3. select Provides from repackage output
58 # 4. xclip -o | sed 's/ perl/\nperl/g' | awk '{print $1}' | sort -u > perlprov
59 # 5. select Requires from repackage output
60 # 6. xclip -o | sed 's/ perl/\nperl/g' | awk '{print $1}' | sort -u > perlreq
61 # 7. cat perlprov perlprov perlreq | awk '{print $1}' | sort | uniq -c | grep '^ 2 ' | awk '{print $2}' | tr '\n' ' '
63 %define _sysconfdir /etc/%{name}
64 %define _webapps /etc/webapps
65 %define _webapp %{name}
66 %define _wwwconfdir %{_webapps}/%{_webapp}
67 %define _cgi_bindir %{_prefix}/share/%{name}
70 SmokePing is a ICMP latency logging and graphing system. It consists
71 of a daemon process which organizes the latency measurements and a CGI
72 which presents the graphs with interesting smoke-like effects.
74 %description -l pl.UTF-8
75 Smokeping jest narzędziem do tworzenia wykresów aktywności sieci.
76 Używając pakietów ICMP zapisuje czas odpowiedzi poszczególnych hostów
77 i wyświetla je w postaci czytelnego wykresu.
80 Summary: CGI webinterface for smokeping
81 Summary(pl.UTF-8): Interfejs WWW (CGI) do smokepinga
82 Group: Applications/WWW
83 Requires: %{name} = %{version}-%{release}
85 Requires: webserver(access)
86 Requires: webserver(alias)
87 Requires: webserver(cgi)
88 Conflicts: apache-base < 2.4.0-1
91 CGI webinterface for smokeping.
93 %description cgi -l pl.UTF-8
94 Interfejs WWW (CGI) do smokepinga.
102 #sed -i -e 's,^Net::.*$,,' PERL_MODULES
104 sed -i -e 's#@prefix@/etc/\(.*\).dist#/etc/smokeping/\1#' etc/config.dist.in
105 sed -i -e 's#@prefix@/etc/#/etc/smokeping/#' etc/config.dist.in
113 rm -rf $RPM_BUILD_ROOT
114 install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_sysconfdir},%{_wwwconfdir}} \
115 $RPM_BUILD_ROOT{%{_datadir}/%{name},%{_sharedstatedir}/%{name}/{img,rrd},%{_cgi_bindir}} \
116 $RPM_BUILD_ROOT{%{_mandir}/man{1,3,5,7},/var/run/%{name}} \
117 $RPM_BUILD_ROOT%{systemdtmpfilesdir}
119 %{__make} install DESTDIR=$RPM_BUILD_ROOT
121 # start of fixing paths
122 for f in basepage.html smokemail smokeping_secrets tmail; do
123 mv $RPM_BUILD_ROOT/etc/smokeping/{$f.dist,$f}
126 rm -rf $RPM_BUILD_ROOT/etc/smokeping/examples
128 mv $RPM_BUILD_ROOT%{_prefix}/lib/{*.pm,Smokeping} $RPM_BUILD_ROOT%{_datadir}/%{name}
130 mv $RPM_BUILD_ROOT{%{_prefix}/htdocs/cropper,%{_cgi_bindir}}
131 mv $RPM_BUILD_ROOT%{_bindir}/smokeping_cgi $RPM_BUILD_ROOT%{_cgi_bindir}/smokeping.cgi
133 mv $RPM_BUILD_ROOT%{_mandir}/man1/{smokeping_cgi.1,smokeping.cgi.1}
134 # end of fixing paths
136 cp -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
137 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_wwwconfdir}/apache.conf
138 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_wwwconfdir}/httpd.conf
139 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_wwwconfdir}/lighttpd.conf
140 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/config
141 cp -p %{SOURCE5} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
145 rm -rf $RPM_BUILD_ROOT
148 %groupadd -g 207 %{name}
149 %useradd -u 207 -d /var/lib/%{name} -g %{name} -s /bin/false -c "Smokeping User" %{name}
150 %addusertogroup smokeping adm
153 /sbin/chkconfig --add %{name}
156 if [ "$1" = 0 ]; then
157 %service %{name} stop
158 /sbin/chkconfig --del %{name}
162 if [ "$1" = 0 ]; then
167 %triggerin cgi -- apache1 < 1.3.37-3, apache1-base
168 %webapp_register apache %{_webapp}
170 %triggerun cgi -- apache1 < 1.3.37-3, apache1-base
171 %webapp_unregister apache %{_webapp}
173 %triggerin cgi -- apache-base
174 %webapp_register httpd %{_webapp}
176 %triggerun cgi -- apache-base
177 %webapp_unregister httpd %{_webapp}
179 %triggerin cgi -- lighttpd
180 %webapp_register lighttpd %{_webapp}
182 %triggerun cgi -- lighttpd
183 %webapp_unregister lighttpd %{_webapp}
185 %triggerpostun -- %{name} < 2.0.5-0.3
186 # we put trigger on main package, because we can't trigger in new package
187 # this will create .rpmnew files when one installs -cgi package. but that's more than okay
188 if [ -f /etc/httpd/httpd.conf/99_%{name}.conf.rpmsave ]; then
189 install -d %{_wwwconfdir}
190 mv -f /etc/httpd/httpd.conf/99_%{name}.conf.rpmsave %{_wwwconfdir}/httpd.conf
193 %service -q httpd reload
195 %banner -e %{name} << EOF
196 The CGI program is available as %{name}-cgi package.
199 %triggerpostun -- %{name} < 2.4.2-3
200 find /var/lib/smokeping/rrd -type f -user root -group root -name \*.rrd -mtime -7 -exec chown smokeping \{\} \;
201 find /var/lib/smokeping/rrd -type d -user root -group root -exec chown smokeping \{\} \;
204 %defattr(644,root,root,755)
205 %doc CHANGES CONTRIBUTORS COPYRIGHT README TODO doc/*.txt doc/examples
206 %attr(755,root,root) %{_bindir}/smokeinfo
207 %attr(755,root,root) %{_bindir}/smokeping
208 %attr(755,root,root) %{_bindir}/tSmoke
209 %{_datadir}/smokeping
210 %exclude %{_cgi_bindir}/cropper
211 %exclude %{_datadir}/smokeping/smokeping.*cgi
212 %{_mandir}/man1/smokeping.1*
213 %{_mandir}/man1/smokeping.cgi.1*
214 %{_mandir}/man1/tSmoke.1*
219 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/basepage.html
220 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config
221 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config.dist
222 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/smokemail
223 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/smokeping_secrets
224 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/tmail
225 %attr(754,root,root) /etc/rc.d/init.d/smokeping
226 %dir %{_sharedstatedir}/%{name}
227 %dir %attr(775,root,smokeping) %{_sharedstatedir}/%{name}/rrd
228 %dir %attr(775,root,http) %{_sharedstatedir}/%{name}/img
229 %dir %attr(770,root,smokeping) /var/run/%{name}
230 %{systemdtmpfilesdir}/%{name}.conf
233 %defattr(644,root,root,755)
234 %dir %attr(750,root,http) %{_wwwconfdir}
235 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_wwwconfdir}/apache.conf
236 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_wwwconfdir}/httpd.conf
237 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_wwwconfdir}/lighttpd.conf
238 %{_cgi_bindir}/cropper
239 %attr(755,root,root) %{_cgi_bindir}/smokeping.cgi