]> git.pld-linux.org Git - packages/smokeping.git/blob - smokeping.spec
- updated URLs
[packages/smokeping.git] / smokeping.spec
1 # TODO
2 # - IMPORTANT: resolve permission problem for webserver access to /usr/sbin/fping
3 # - generated config does not always match the used webserver vhost (don't autogenerate it at all?)
4 # - finish -cgi and main files, afaik templates/ needed only by -cgi
5 # - use .patch not decruft()
6 # - IMPORTANT: use other user than root for daemon (uid=stats perhaps)
7 %include        /usr/lib/rpm/macros.perl
8 Summary:        Smokeping - a latency grapher that uses rrdtool
9 Summary(pl.UTF-8):      Smokeping - narzędzie do tworzenia wykresów opóźnień sieci
10 Name:           smokeping
11 Version:        2.0.9
12 Release:        1
13 License:        GPL v2
14 Group:          Networking/Utilities
15 Source0:        http://oss.oetiker.ch/smokeping/pub/%{name}-%{version}.tar.gz
16 # Source0-md5:  512c0bc38176451df7d664050b1283d9
17 Source1:        %{name}.init
18 Source2:        %{name}.conf
19 Source3:        %{name}-config
20 Source4:        %{name}-lighttpd.conf
21 URL:            http://oss.oetiker.ch/smokeping/
22 BuildRequires:  perl-tools-pod
23 BuildRequires:  rpm-perlprov >= 4.1-13
24 BuildRequires:  rpmbuild(macros) >= 1.268
25 BuildRequires:  rrdtool
26 BuildRequires:  sed >= 4.0
27 Requires(post): sed >= 4.0
28 Requires(post,preun):   /sbin/chkconfig
29 Requires:       fping
30 Requires:       rc-scripts
31 Requires:       rrdtool >= 1.2
32 BuildArch:      noarch
33 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
34
35 %define         _sysconfdir     /etc/%{name}
36 %define         _webapps        /etc/webapps
37 %define         _webapp         %{name}
38 %define         _wwwconfdir     %{_webapps}/%{_webapp}
39 %define         _cgi_bindir     %{_prefix}/share/%{name}
40
41 %description
42 SmokePing is a ICMP latency logging and graphing system. It consists
43 of a daemon process which organizes the latency measurements and a CGI
44 which presents the graphs with interesting smoke-like effects.
45
46 %description -l pl.UTF-8
47 Smokeping jest narzędziem do tworzenia wykresów aktywności sieci.
48 Używając pakietów ICMP zapisuje czas odpowiedzi poszczególnych hostów
49 i wyświetla je w postaci czytelnego wykresu.
50
51 %package cgi
52 Summary:        CGI webinterface for smokeping
53 Summary(pl.UTF-8):      Interfejs WWW (CGI) do smokepinga
54 Group:          Applications/WWW
55 Requires:       %{name} = %{version}-%{release}
56 Requires:       webapps
57
58 %description cgi
59 CGI webinterface for smokeping.
60
61 %description cgi -l pl.UTF-8
62 Interfejs WWW (CGI) do smokepinga.
63
64 %prep
65 %setup -q
66
67 decruft() { %{__sed} -i -e "s|$1|$2|g" `grep -lr "$1" *` ;}
68
69 # eliminate Tobi's quirks
70 decruft /usr/sepp/bin %{_bindir}
71
72 decruft /home/oetiker/data/projects/AADJ-smokeping/dist/etc     %{_sysconfdir}
73 decruft /home/oetiker/data/projects/AADJ-smokeping/dist/lib     %{_datadir}/%{name}
74
75 # rrdtool package goes into standard perl tree
76 decruft '^use lib .*rrdtool.*;' ''
77
78 # there's no SpeedyCGI for apache2? use regular perl...
79 decruft %{_bindir}/speedy %{_bindir}/perl
80
81 # working config in wrong location
82 decruft "etc/config.dist" "%{_sysconfdir}/config"
83
84 sed -i -e 's@^#!/usr/bin/perl-5.8.4@#!/usr/bin/perl@' bin/smokeping.dist
85 sed -i -e 's#use lib qw(lib);#use lib qw(%{_datadir}/%{name});#' bin/smokeping.dist
86
87 %build
88 %{__make}
89
90 %install
91 rm -rf $RPM_BUILD_ROOT
92 install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_sysconfdir},%{_wwwconfdir},%{_sbindir}} \
93         $RPM_BUILD_ROOT{%{_datadir}/%{name},%{_sharedstatedir}/%{name}/{img,rrd},%{_cgi_bindir}} \
94         $RPM_BUILD_ROOT%{_mandir}/man1
95
96 install etc/basepage.html.dist $RPM_BUILD_ROOT%{_sysconfdir}/basepage.html
97 install etc/config.dist $RPM_BUILD_ROOT%{_sysconfdir}
98 #install etc/config-echoping.dist $RPM_BUILD_ROOT%{_sysconfdir}/config-echoping
99 install etc/smokemail.dist $RPM_BUILD_ROOT%{_sysconfdir}/smokemail
100 install bin/smokeping.dist $RPM_BUILD_ROOT%{_sbindir}/smokeping
101 install bin/tSmoke.dist $RPM_BUILD_ROOT%{_sbindir}/tSmoke
102 install htdocs/smokeping.cgi.dist $RPM_BUILD_ROOT%{_cgi_bindir}/smokeping.cgi
103 cp -r lib/* $RPM_BUILD_ROOT%{_datadir}/%{name}
104 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
105 install %{SOURCE2} $RPM_BUILD_ROOT%{_wwwconfdir}/httpd.conf
106 install %{SOURCE2} $RPM_BUILD_ROOT%{_wwwconfdir}/apache.conf
107 install %{SOURCE4} $RPM_BUILD_ROOT%{_wwwconfdir}/lighttpd.conf
108 install %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/config
109 install doc/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
110
111 %clean
112 rm -rf $RPM_BUILD_ROOT
113
114 %post
115 if [ "$1" = "1" ]; then
116
117 firstgate=`route -n |awk '$1=="0.0.0.0" && $4 ~ /G/ {print $2}' | head -n 1`
118 echo "
119 + gateway
120  menu   = Default Gateway
121  title  = Default Gateway Router
122  host   = $firstgate
123
124 + dns
125  menu   = DNS Servers
126  title  = Domain Name Servers
127         " >> %{_sysconfdir}/config
128 for dns in `awk '$1 ~ /^nameserver/ {print $2}' /etc/resolv.conf | LC_ALL=C sort -u` ; do
129 ((dnscnt++))
130 echo "++ dns$dnscnt
131   menu  = DNS Server $dnscnt
132   title = Domain Name Server $dnscnt
133   host  = $dns
134         " >> %{_sysconfdir}/config
135 done
136
137 [ "$HOSTNAME" ] && %{__sed} -i -e "s|localhost|$HOSTNAME|g" %{_sysconfdir}/config
138
139 fi
140
141 /sbin/chkconfig --add %{name}
142 %service %{name} restart
143
144 %preun
145 if [ "$1" = 0 ]; then
146         %service %{name} stop
147         /sbin/chkconfig --del %{name}
148 fi
149
150 %triggerin cgi -- apache1 < 1.3.37-3, apache1-base
151 %webapp_register apache %{_webapp}
152
153 %triggerun cgi -- apache1 < 1.3.37-3, apache1-base
154 %webapp_unregister apache %{_webapp}
155
156 %triggerin cgi -- apache < 2.2.0, apache-base
157 %webapp_register httpd %{_webapp}
158
159 %triggerun cgi -- apache < 2.2.0, apache-base
160 %webapp_unregister httpd %{_webapp}
161
162 %triggerin -- lighttpd
163 %webapp_register lighttpd %{_webapp}
164
165 %triggerun -- lighttpd
166 %webapp_unregister lighttpd %{_webapp}
167
168 %triggerpostun -- %{name} < 2.0.5-0.3
169 # we put trigger on main package, because we can't trigger in new package
170 # this will create .rpmnew files when one installs -cgi package. but that's more than okay
171 if [ -f /etc/httpd/httpd.conf/99_%{name}.conf.rpmsave ]; then
172         install -d %{_wwwconfdir}
173         mv -f /etc/httpd/httpd.conf/99_%{name}.conf.rpmsave %{_wwwconfdir}/httpd.conf
174 fi
175
176 %service -q httpd reload
177
178 %banner -e %{name} << EOF
179 The CGI program is available as %{name}-cgi package.
180 EOF
181
182 %files
183 %defattr(644,root,root,755)
184 %doc CHANGES CONTRIBUTORS COPYRIGHT README TODO doc/*.txt doc/*.html
185 %attr(755,root,root) %{_sbindir}/*
186 %{_datadir}/smokeping
187 %exclude %{_datadir}/smokeping/*.cgi
188 %{_mandir}/man1/*.1*
189 %dir %{_sysconfdir}
190 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*
191 %attr(754,root,root) /etc/rc.d/init.d/*
192 %dir %{_sharedstatedir}/%{name}
193 %{_sharedstatedir}/%{name}/rrd
194 %dir %attr(775,root,http) %{_sharedstatedir}/%{name}/img
195
196 %files cgi
197 %defattr(644,root,root,755)
198 %dir %attr(750,root,http) %{_wwwconfdir}
199 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_wwwconfdir}/apache.conf
200 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_wwwconfdir}/httpd.conf
201 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_wwwconfdir}/lighttpd.conf
202 %attr(755,root,root) %{_cgi_bindir}/*.cgi
This page took 0.076592 seconds and 4 git commands to generate.