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: eb8e7679fcad35e59d7c51f2328250a2
13 Source3: %{name}-config
14 Source4: %{name}-lighttpd.conf
15 URL: http://oss.oetiker.ch/smokeping/
16 BuildRequires: perl-tools-pod
17 BuildRequires: rpm-perlprov >= 4.1-13
18 BuildRequires: rpmbuild(macros) >= 1.268
19 BuildRequires: sed >= 4.0
20 Requires(post): sed >= 4.0
21 Requires(post,preun): /sbin/chkconfig
22 Requires(postun): /usr/sbin/groupdel
23 Requires(postun): /usr/sbin/userdel
24 Requires(pre): /bin/id
25 Requires(pre): /usr/bin/getgid
26 Requires(pre): /usr/lib/rpm/user_group.sh
27 Requires(pre): /usr/sbin/groupadd
28 Requires(pre): /usr/sbin/useradd
29 Requires(pre): /usr/sbin/usermod
30 Requires(triggerpostun): findutils
31 Requires: rc-scripts >= 0.4.1.23
32 Requires: rrdtool >= 1.2
34 Suggests: perl(Authen::Radius)
35 Suggests: perl(Authen::TacacsPlus)
36 Suggests: perl(Net::DNS)
37 Suggests: perl(Net::LDAP)
38 Suggests: perl(Net::Telnet)
39 # NOTE: these modules are optional, not required:
40 # Requires: perl(DBD::Pg)
42 # Requires: perl(DB_File)
43 # Requires: perl(Digest::SHA1)
44 # Requires: perl(FreezeThaw)
45 # Requires: perl(URI::Escape)
46 # Requires: perl-Net-DNS
47 # Requires: perl-SNMP_Session
49 Provides: user(%{name})
50 Provides: group(%{name})
54 Suggests: openssh-clients
57 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
59 %define _sysconfdir /etc/%{name}
60 %define _webapps /etc/webapps
61 %define _webapp %{name}
62 %define _wwwconfdir %{_webapps}/%{_webapp}
63 %define _cgi_bindir %{_prefix}/share/%{name}
66 SmokePing is a ICMP latency logging and graphing system. It consists
67 of a daemon process which organizes the latency measurements and a CGI
68 which presents the graphs with interesting smoke-like effects.
70 %description -l pl.UTF-8
71 Smokeping jest narzędziem do tworzenia wykresów aktywności sieci.
72 Używając pakietów ICMP zapisuje czas odpowiedzi poszczególnych hostów
73 i wyświetla je w postaci czytelnego wykresu.
76 Summary: CGI webinterface for smokeping
77 Summary(pl.UTF-8): Interfejs WWW (CGI) do smokepinga
78 Group: Applications/WWW
79 Requires: %{name} = %{version}-%{release}
83 CGI webinterface for smokeping.
85 %description cgi -l pl.UTF-8
86 Interfejs WWW (CGI) do smokepinga.
91 decruft() { grep -lr "$1" . | xargs %{__sed} -i -e "s|$1|$2|g"; }
93 # eliminate Tobi's quirks
94 decruft /usr/sepp/bin %{_bindir}
96 # rrdtool package goes into standard perl tree
97 decruft '^use lib .*rrdtool.*;' ''
99 decruft /usr/bin/speedy-5.8.8 %{_bindir}/speedy
101 sed -i -e '/\/home\/oposs\/smokeping\/software\/lib/d' htdocs/tr.cgi.dist
102 sed -i -e '/\/home\/oetiker\/checkouts\/smokeping\/trunk\/software\/lib/d' htdocs/smokeping.cgi.dist
103 sed -i -e 's|/home/oetiker/checkouts/smokeping/trunk/software/etc/config.dist|%{_sysconfdir}/config|' htdocs/smokeping.cgi.dist
104 # working config in wrong location
105 decruft "etc/config.dist" "%{_sysconfdir}/config"
107 sed -i -e 's#use lib qw(lib);#use lib qw(%{_datadir}/%{name});#' bin/smokeping.dist
109 sed -i -e 's#"cropper/#"/smokeping/cropper/#' etc/basepage.html.dist
115 rm -rf $RPM_BUILD_ROOT
116 install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_sysconfdir},%{_wwwconfdir},%{_sbindir}} \
117 $RPM_BUILD_ROOT{%{_datadir}/%{name},%{_sharedstatedir}/%{name}/{img,rrd},%{_cgi_bindir}} \
118 $RPM_BUILD_ROOT{%{_mandir}/man{1,3,5,7},/var/run/%{name}}
120 install etc/basepage.html.dist $RPM_BUILD_ROOT%{_sysconfdir}/basepage.html
121 install etc/config.dist $RPM_BUILD_ROOT%{_sysconfdir}
122 install etc/smokemail.dist $RPM_BUILD_ROOT%{_sysconfdir}/smokemail
123 install etc/smokeping_secrets.dist $RPM_BUILD_ROOT%{_sysconfdir}/smokeping_secrets
124 install etc/tmail.dist $RPM_BUILD_ROOT%{_sysconfdir}/tmail
125 install bin/smokeping.dist $RPM_BUILD_ROOT%{_sbindir}/smokeping
126 install bin/tSmoke.dist $RPM_BUILD_ROOT%{_sbindir}/tSmoke
127 cp -r htdocs/{cropper,resource,script,tr.html} $RPM_BUILD_ROOT%{_cgi_bindir}
128 install htdocs/smokeping.cgi.dist $RPM_BUILD_ROOT%{_cgi_bindir}/smokeping.cgi
129 install htdocs/tr.cgi.dist $RPM_BUILD_ROOT%{_cgi_bindir}/tr.cgi
130 cp -r lib/* $RPM_BUILD_ROOT%{_datadir}/%{name}
131 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
132 install %{SOURCE2} $RPM_BUILD_ROOT%{_wwwconfdir}/httpd.conf
133 install %{SOURCE2} $RPM_BUILD_ROOT%{_wwwconfdir}/apache.conf
134 install %{SOURCE4} $RPM_BUILD_ROOT%{_wwwconfdir}/lighttpd.conf
135 install %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/config
136 install doc/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
137 # TODO: man(3) pages from subdirectories are packaged in %_docdir too, clean them up
138 install doc/{,Config/,Smokeping/{,matchers/,probes/,sorters/}}*.3 $RPM_BUILD_ROOT%{_mandir}/man3
139 install doc/*.5 $RPM_BUILD_ROOT%{_mandir}/man5
140 install doc/*.7 $RPM_BUILD_ROOT%{_mandir}/man7
143 rm -rf $RPM_BUILD_ROOT
146 %groupadd -g 207 %{name}
147 %useradd -u 207 -d /var/lib/%{name} -g %{name} -s /bin/false -c "Smokeping User" %{name}
148 %addusertogroup smokeping adm
151 /sbin/chkconfig --add %{name}
154 if [ "$1" = 0 ]; then
155 %service %{name} stop
156 /sbin/chkconfig --del %{name}
160 if [ "$1" = 0 ]; then
165 %triggerin cgi -- apache1 < 1.3.37-3, apache1-base
166 %webapp_register apache %{_webapp}
168 %triggerun cgi -- apache1 < 1.3.37-3, apache1-base
169 %webapp_unregister apache %{_webapp}
171 %triggerin cgi -- apache < 2.2.0, apache-base
172 %webapp_register httpd %{_webapp}
174 %triggerun cgi -- apache < 2.2.0, apache-base
175 %webapp_unregister httpd %{_webapp}
177 %triggerin cgi -- lighttpd
178 %webapp_register lighttpd %{_webapp}
180 %triggerun cgi -- lighttpd
181 %webapp_unregister lighttpd %{_webapp}
183 %triggerpostun -- %{name} < 2.0.5-0.3
184 # we put trigger on main package, because we can't trigger in new package
185 # this will create .rpmnew files when one installs -cgi package. but that's more than okay
186 if [ -f /etc/httpd/httpd.conf/99_%{name}.conf.rpmsave ]; then
187 install -d %{_wwwconfdir}
188 mv -f /etc/httpd/httpd.conf/99_%{name}.conf.rpmsave %{_wwwconfdir}/httpd.conf
191 %service -q httpd reload
193 %banner -e %{name} << EOF
194 The CGI program is available as %{name}-cgi package.
197 %triggerpostun -- %{name} < 2.4.2-3
198 find /var/lib/smokeping/rrd -type f -user root -group root -name \*.rrd -mtime -7 -exec chown smokeping \{\} \;
199 find /var/lib/smokeping/rrd -type d -user root -group root -exec chown smokeping \{\} \;
202 %defattr(644,root,root,755)
203 %doc CHANGES CONTRIBUTORS COPYRIGHT README TODO doc/*.html doc/*.txt doc/Config doc/Smokeping doc/examples
204 %attr(755,root,root) %{_sbindir}/smokeping
205 %attr(755,root,root) %{_sbindir}/tSmoke
206 %{_datadir}/smokeping
207 %exclude %{_cgi_bindir}/cropper
208 %exclude %{_datadir}/smokeping/smokeping.cgi
209 %exclude %{_cgi_bindir}/resource
210 %exclude %{_cgi_bindir}/script
211 %exclude %{_datadir}/smokeping/tr.cgi
212 %exclude %{_datadir}/smokeping/tr.html
213 %{_mandir}/man1/smokeping.1*
214 %{_mandir}/man1/smokeping.cgi.1*
215 %{_mandir}/man1/tSmoke.1*
220 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/basepage.html
221 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config
222 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config.dist
223 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/smokemail
224 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/smokeping_secrets
225 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/tmail
226 %attr(754,root,root) /etc/rc.d/init.d/smokeping
227 %dir %{_sharedstatedir}/%{name}
228 %dir %attr(775,root,smokeping) %{_sharedstatedir}/%{name}/rrd
229 %dir %attr(775,root,http) %{_sharedstatedir}/%{name}/img
230 %dir %attr(770,root,smokeping) /var/run/%{name}
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
240 %{_cgi_bindir}/resource
241 %{_cgi_bindir}/script
242 %attr(755,root,root) %{_cgi_bindir}/tr.cgi
243 %{_cgi_bindir}/tr.html