]>
Commit | Line | Data |
---|---|---|
559caf24 | 1 | # TODO |
f5b568c1 | 2 | # - IMPORTANT: resolve permission problem for webserver access to /usr/sbin/fping |
559caf24 ER |
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() | |
f5b568c1 | 6 | # - IMPORTANT: use other user than root for daemon (uid=stats perhaps) |
559caf24 | 7 | %include /usr/lib/rpm/macros.perl |
388ebc7d | 8 | Summary: Smokeping - a latency grapher that uses rrdtool |
6ad512fc | 9 | Summary(pl.UTF-8): Smokeping - narzędzie do tworzenia wykresów opóźnień sieci |
5ea8c23d | 10 | Name: smokeping |
67bd0c15 | 11 | Version: 2.0.9 |
12 | Release: 1 | |
124af368 | 13 | License: GPL v2 |
1a299ecf | 14 | Group: Networking/Utilities |
5ea8c23d | 15 | Source0: http://people.ee.ethz.ch/~oetiker/webtools/smokeping/pub/%{name}-%{version}.tar.gz |
0c2fa8d2 | 16 | # Source0-md5: 512c0bc38176451df7d664050b1283d9 |
5431036c | 17 | Source1: %{name}.init |
18 | Source2: %{name}.conf | |
388ebc7d | 19 | Source3: %{name}-config |
62d6eb9b | 20 | Source4: %{name}-lighttpd.conf |
34184b9d | 21 | URL: http://people.ee.ethz.ch/~oetiker/webtools/smokeping/ |
388ebc7d | 22 | BuildRequires: perl-tools-pod |
559caf24 | 23 | BuildRequires: rpm-perlprov >= 4.1-13 |
98129fad | 24 | BuildRequires: rpmbuild(macros) >= 1.268 |
6c4b45e4 | 25 | BuildRequires: rrdtool |
da8c17bb | 26 | BuildRequires: sed >= 4.0 |
7fda5b3d | 27 | Requires(post): sed >= 4.0 |
2dd8d950 | 28 | Requires(post,preun): /sbin/chkconfig |
09be0bea | 29 | Requires: fping |
7fda5b3d | 30 | Requires: rc-scripts |
d79c57a4 | 31 | Requires: rrdtool >= 1.2 |
5ea8c23d | 32 | BuildArch: noarch |
33 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
09be0bea | 34 | |
7fda5b3d ER |
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} | |
09be0bea | 40 | |
41 | %description | |
5ea8c23d | 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. | |
09be0bea | 45 | |
18270cb4 JR |
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. | |
09be0bea | 50 | |
7fda5b3d ER |
51 | %package cgi |
52 | Summary: CGI webinterface for smokeping | |
6ad512fc | 53 | Summary(pl.UTF-8): Interfejs WWW (CGI) do smokepinga |
7fda5b3d ER |
54 | Group: Applications/WWW |
55 | Requires: %{name} = %{version}-%{release} | |
56 | Requires: webapps | |
57 | ||
58 | %description cgi | |
02ab651c JB |
59 | CGI webinterface for smokeping. |
60 | ||
18270cb4 | 61 | %description cgi -l pl.UTF-8 |
02ab651c | 62 | Interfejs WWW (CGI) do smokepinga. |
7fda5b3d | 63 | |
09be0bea | 64 | %prep |
65 | %setup -q | |
66 | ||
7fda5b3d | 67 | decruft() { %{__sed} -i -e "s|$1|$2|g" `grep -lr "$1" *` ;} |
388ebc7d TP |
68 | |
69 | # eliminate Tobi's quirks | |
70 | decruft /usr/sepp/bin %{_bindir} | |
71 | ||
7fda5b3d | 72 | decruft /home/oetiker/data/projects/AADJ-smokeping/dist/etc %{_sysconfdir} |
388ebc7d TP |
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 | |
7fda5b3d | 82 | decruft "etc/config.dist" "%{_sysconfdir}/config" |
388ebc7d | 83 | |
d79c57a4 | 84 | sed -i -e 's@^#!/usr/bin/perl-5.8.4@#!/usr/bin/perl@' bin/smokeping.dist |
a3cca784 | 85 | sed -i -e 's#use lib qw(lib);#use lib qw(%{_datadir}/%{name});#' bin/smokeping.dist |
a929c3e9 | 86 | |
7fda5b3d ER |
87 | %build |
88 | %{__make} | |
89 | ||
09be0bea | 90 | %install |
5ea8c23d | 91 | rm -rf $RPM_BUILD_ROOT |
559caf24 | 92 | install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_sysconfdir},%{_wwwconfdir},%{_sbindir}} \ |
388ebc7d TP |
93 | $RPM_BUILD_ROOT{%{_datadir}/%{name},%{_sharedstatedir}/%{name}/{img,rrd},%{_cgi_bindir}} \ |
94 | $RPM_BUILD_ROOT%{_mandir}/man1 | |
95 | ||
7fda5b3d ER |
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 | |
559caf24 ER |
100 | install bin/smokeping.dist $RPM_BUILD_ROOT%{_sbindir}/smokeping |
101 | install bin/tSmoke.dist $RPM_BUILD_ROOT%{_sbindir}/tSmoke | |
388ebc7d TP |
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} | |
7fda5b3d ER |
105 | install %{SOURCE2} $RPM_BUILD_ROOT%{_wwwconfdir}/httpd.conf |
106 | install %{SOURCE2} $RPM_BUILD_ROOT%{_wwwconfdir}/apache.conf | |
62d6eb9b | 107 | install %{SOURCE4} $RPM_BUILD_ROOT%{_wwwconfdir}/lighttpd.conf |
7fda5b3d | 108 | install %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/config |
803924d1 | 109 | install doc/*.1 $RPM_BUILD_ROOT%{_mandir}/man1 |
09be0bea | 110 | |
09be0bea | 111 | %clean |
5ea8c23d | 112 | rm -rf $RPM_BUILD_ROOT |
09be0bea | 113 | |
114 | %post | |
388ebc7d TP |
115 | if [ "$1" = "1" ]; then |
116 | ||
7fda5b3d | 117 | firstgate=`route -n |awk '$1=="0.0.0.0" && $4 ~ /G/ {print $2}' | head -n 1` |
a1505cfd | 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 | |
7fda5b3d ER |
127 | " >> %{_sysconfdir}/config |
128 | for dns in `awk '$1 ~ /^nameserver/ {print $2}' /etc/resolv.conf | LC_ALL=C sort -u` ; do | |
a1505cfd | 129 | ((dnscnt++)) |
130 | echo "++ dns$dnscnt | |
131 | menu = DNS Server $dnscnt | |
132 | title = Domain Name Server $dnscnt | |
133 | host = $dns | |
7fda5b3d | 134 | " >> %{_sysconfdir}/config |
a1505cfd | 135 | done |
136 | ||
7fda5b3d | 137 | [ "$HOSTNAME" ] && %{__sed} -i -e "s|localhost|$HOSTNAME|g" %{_sysconfdir}/config |
a1505cfd | 138 | |
388ebc7d | 139 | fi |
a1505cfd | 140 | |
66b16793 | 141 | /sbin/chkconfig --add %{name} |
98129fad | 142 | %service %{name} restart |
aeac0cba | 143 | |
09be0bea | 144 | %preun |
98129fad ER |
145 | if [ "$1" = 0 ]; then |
146 | %service %{name} stop | |
66b16793 | 147 | /sbin/chkconfig --del %{name} |
7fda5b3d | 148 | fi |
aeac0cba | 149 | |
479f93eb | 150 | %triggerin cgi -- apache1 < 1.3.37-3, apache1-base |
7fda5b3d ER |
151 | %webapp_register apache %{_webapp} |
152 | ||
479f93eb | 153 | %triggerun cgi -- apache1 < 1.3.37-3, apache1-base |
7fda5b3d ER |
154 | %webapp_unregister apache %{_webapp} |
155 | ||
ddaf9421 | 156 | %triggerin cgi -- apache < 2.2.0, apache-base |
7fda5b3d ER |
157 | %webapp_register httpd %{_webapp} |
158 | ||
ddaf9421 | 159 | %triggerun cgi -- apache < 2.2.0, apache-base |
7fda5b3d ER |
160 | %webapp_unregister httpd %{_webapp} |
161 | ||
62d6eb9b PG |
162 | %triggerin -- lighttpd |
163 | %webapp_register lighttpd %{_webapp} | |
164 | ||
165 | %triggerun -- lighttpd | |
166 | %webapp_unregister lighttpd %{_webapp} | |
167 | ||
7fda5b3d ER |
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 | |
7fda5b3d ER |
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 | |
09be0bea | 174 | fi |
175 | ||
98129fad | 176 | %service -q httpd reload |
7fda5b3d ER |
177 | |
178 | %banner -e %{name} << EOF | |
179 | The CGI program is available as %{name}-cgi package. | |
180 | EOF | |
181 | ||
09be0bea | 182 | %files |
5ea8c23d | 183 | %defattr(644,root,root,755) |
856d406a | 184 | %doc CHANGES CONTRIBUTORS COPYRIGHT README TODO doc/*.txt doc/*.html |
559caf24 | 185 | %attr(755,root,root) %{_sbindir}/* |
388ebc7d | 186 | %{_datadir}/smokeping |
7fda5b3d | 187 | %exclude %{_datadir}/smokeping/*.cgi |
803924d1 | 188 | %{_mandir}/man1/*.1* |
7fda5b3d ER |
189 | %dir %{_sysconfdir} |
190 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/* | |
388ebc7d | 191 | %attr(754,root,root) /etc/rc.d/init.d/* |
388ebc7d TP |
192 | %dir %{_sharedstatedir}/%{name} |
193 | %{_sharedstatedir}/%{name}/rrd | |
559caf24 | 194 | %dir %attr(775,root,http) %{_sharedstatedir}/%{name}/img |
7fda5b3d ER |
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 | |
62d6eb9b | 201 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_wwwconfdir}/lighttpd.conf |
7fda5b3d | 202 | %attr(755,root,root) %{_cgi_bindir}/*.cgi |