]> git.pld-linux.org Git - packages/smokeping.git/blob - smokeping.spec
- use proper macro for adding user to group, no banner
[packages/smokeping.git] / smokeping.spec
1 # TODO
2 # - finish -cgi and main files, afaik templates/ needed only by -cgi
3 # - use .patch not decruft()
4 %include        /usr/lib/rpm/macros.perl
5 Summary:        Smokeping - a latency grapher that uses rrdtool
6 Summary(pl.UTF-8):      Smokeping - narzędzie do tworzenia wykresów opóźnień sieci
7 Name:           smokeping
8 Version:        2.4.2
9 Release:        4
10 License:        GPL v2+
11 Group:          Networking/Utilities
12 Source0:        http://oss.oetiker.ch/smokeping/pub/%{name}-%{version}.tar.gz
13 # Source0-md5:  eb8e7679fcad35e59d7c51f2328250a2
14 Source1:        %{name}.init
15 Source2:        %{name}.conf
16 Source3:        %{name}-config
17 Source4:        %{name}-lighttpd.conf
18 URL:            http://oss.oetiker.ch/smokeping/
19 BuildRequires:  perl-tools-pod
20 BuildRequires:  rpm-perlprov >= 4.1-13
21 BuildRequires:  rpmbuild(macros) >= 1.268
22 BuildRequires:  sed >= 4.0
23 Requires(post): sed >= 4.0
24 Requires(post,preun):   /sbin/chkconfig
25 Requires(post): findutils
26 Requires:       rc-scripts
27 Requires:       rrdtool >= 1.2
28 Suggests:       fping
29 Suggests:       perl(Authen::Radius)
30 Suggests:       perl(Authen::TacacsPlus)
31 Suggests:       perl(Net::DNS)
32 Suggests:       perl(Net::LDAP)
33 Suggests:       perl(Net::Telnet)
34 # NOTE: these modules are optional, not required:
35 #       Requires: perl(DBD::Pg)
36 #       Requires: perl(DBI)
37 #       Requires: perl(DB_File)
38 #       Requires: perl(Digest::SHA1)
39 #       Requires: perl(FreezeThaw)
40 #       Requires: perl(URI::Escape)
41 #       Requires: perl-Net-DNS
42 #       Requires: perl-SNMP_Session
43 #       Requires: perl-ldap
44 Provides:       user(%{name})
45 Provides:       group(%{name})
46 Suggests:       bind-utils
47 Suggests:       curl
48 Suggests:       echoping
49 Suggests:       openssh-clients
50 Suggests:       traceroute
51 BuildArch:      noarch
52 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
53
54 %define         _sysconfdir     /etc/%{name}
55 %define         _webapps        /etc/webapps
56 %define         _webapp         %{name}
57 %define         _wwwconfdir     %{_webapps}/%{_webapp}
58 %define         _cgi_bindir     %{_prefix}/share/%{name}
59
60 %description
61 SmokePing is a ICMP latency logging and graphing system. It consists
62 of a daemon process which organizes the latency measurements and a CGI
63 which presents the graphs with interesting smoke-like effects.
64
65 %description -l pl.UTF-8
66 Smokeping jest narzędziem do tworzenia wykresów aktywności sieci.
67 Używając pakietów ICMP zapisuje czas odpowiedzi poszczególnych hostów
68 i wyświetla je w postaci czytelnego wykresu.
69
70 %package cgi
71 Summary:        CGI webinterface for smokeping
72 Summary(pl.UTF-8):      Interfejs WWW (CGI) do smokepinga
73 Group:          Applications/WWW
74 Requires:       %{name} = %{version}-%{release}
75 Requires:       webapps
76
77 %description cgi
78 CGI webinterface for smokeping.
79
80 %description cgi -l pl.UTF-8
81 Interfejs WWW (CGI) do smokepinga.
82
83 %prep
84 %setup -q
85
86 decruft() { grep -lr "$1" . | xargs %{__sed} -i -e "s|$1|$2|g"; }
87
88 # eliminate Tobi's quirks
89 decruft /usr/sepp/bin %{_bindir}
90
91 # rrdtool package goes into standard perl tree
92 decruft '^use lib .*rrdtool.*;' ''
93
94 decruft /usr/bin/speedy-5.8.8 /usr/bin/speedy
95
96 sed -i -e '/\/home\/oposs\/smokeping\/software\/lib/d' htdocs/tr.cgi.dist
97 sed -i -e '/\/home\/oetiker\/checkouts\/smokeping\/trunk\/software\/lib/d' htdocs/smokeping.cgi.dist
98 sed -i -e 's|/home/oetiker/checkouts/smokeping/trunk/software/etc/config.dist|%{_sysconfdir}/config|' htdocs/smokeping.cgi.dist
99 # working config in wrong location
100 decruft "etc/config.dist" "%{_sysconfdir}/config"
101
102 sed -i -e 's#use lib qw(lib);#use lib qw(%{_datadir}/%{name});#' bin/smokeping.dist
103
104 sed -i -e 's#"cropper/#"/smokeping/cropper/#' etc/basepage.html.dist
105
106 %build
107 %{__make}
108
109 %install
110 rm -rf $RPM_BUILD_ROOT
111 install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_sysconfdir},%{_wwwconfdir},%{_sbindir}} \
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
115 install etc/basepage.html.dist $RPM_BUILD_ROOT%{_sysconfdir}/basepage.html
116 install etc/config.dist $RPM_BUILD_ROOT%{_sysconfdir}
117 install etc/smokemail.dist $RPM_BUILD_ROOT%{_sysconfdir}/smokemail
118 install etc/smokeping_secrets.dist $RPM_BUILD_ROOT%{_sysconfdir}/smokeping_secrets
119 install etc/tmail.dist $RPM_BUILD_ROOT%{_sysconfdir}/tmail
120 install bin/smokeping.dist $RPM_BUILD_ROOT%{_sbindir}/smokeping
121 install bin/tSmoke.dist $RPM_BUILD_ROOT%{_sbindir}/tSmoke
122 cp -r htdocs/{cropper,resource,script,tr.html} $RPM_BUILD_ROOT%{_cgi_bindir}
123 install htdocs/smokeping.cgi.dist $RPM_BUILD_ROOT%{_cgi_bindir}/smokeping.cgi
124 install htdocs/tr.cgi.dist $RPM_BUILD_ROOT%{_cgi_bindir}/tr.cgi
125 cp -r lib/* $RPM_BUILD_ROOT%{_datadir}/%{name}
126 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
127 install %{SOURCE2} $RPM_BUILD_ROOT%{_wwwconfdir}/httpd.conf
128 install %{SOURCE2} $RPM_BUILD_ROOT%{_wwwconfdir}/apache.conf
129 install %{SOURCE4} $RPM_BUILD_ROOT%{_wwwconfdir}/lighttpd.conf
130 install %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/config
131 install doc/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
132 # TODO: man(3) pages from subdirectories are packaged in %_docdir too, clean them up
133 install doc/{,Config/,Smokeping/{,matchers/,probes/,sorters/}}*.3 $RPM_BUILD_ROOT%{_mandir}/man3
134 install doc/*.5 $RPM_BUILD_ROOT%{_mandir}/man5
135 install doc/*.7 $RPM_BUILD_ROOT%{_mandir}/man7
136
137 %clean
138 rm -rf $RPM_BUILD_ROOT
139
140 %pre
141 %groupadd -g 207 %{name}
142 %useradd -u 207 -d /var/lib/%{name} -g %{name} -s /bin/false -c "Smokeping User" %{name}
143
144 %post
145 /sbin/chkconfig --add %{name}
146 %addusertogroup smokeping adm
147
148 %preun
149 if [ "$1" = 0 ]; then
150         %service %{name} stop
151         /sbin/chkconfig --del %{name}
152 fi
153
154 %postun
155 if [ "$1" = 0 ]; then
156         %userremove %{name}
157         %groupremove %{name}
158 fi
159
160 %triggerin cgi -- apache1 < 1.3.37-3, apache1-base
161 %webapp_register apache %{_webapp}
162
163 %triggerun cgi -- apache1 < 1.3.37-3, apache1-base
164 %webapp_unregister apache %{_webapp}
165
166 %triggerin cgi -- apache < 2.2.0, apache-base
167 %webapp_register httpd %{_webapp}
168
169 %triggerun cgi -- apache < 2.2.0, apache-base
170 %webapp_unregister httpd %{_webapp}
171
172 %triggerin cgi -- lighttpd
173 %webapp_register lighttpd %{_webapp}
174
175 %triggerun cgi -- lighttpd
176 %webapp_unregister lighttpd %{_webapp}
177
178 %triggerpostun -- %{name} < 2.0.5-0.3
179 # we put trigger on main package, because we can't trigger in new package
180 # this will create .rpmnew files when one installs -cgi package. but that's more than okay
181 if [ -f /etc/httpd/httpd.conf/99_%{name}.conf.rpmsave ]; then
182         install -d %{_wwwconfdir}
183         mv -f /etc/httpd/httpd.conf/99_%{name}.conf.rpmsave %{_wwwconfdir}/httpd.conf
184 fi
185
186 %service -q httpd reload
187
188 %banner -e %{name} << EOF
189 The CGI program is available as %{name}-cgi package.
190 EOF
191
192 %triggerpostun -- %{name} < 2.4.2-3
193 find /var/lib/smokeping/rrd -type f -user root -group root -name \*.rrd -mtime -7 -exec chown smokeping \{\} \;
194 find /var/lib/smokeping/rrd -type d -user root -group root -exec chown smokeping \{\} \;
195
196 %files
197 %defattr(644,root,root,755)
198 %doc CHANGES CONTRIBUTORS COPYRIGHT README TODO doc/*.html doc/*.txt doc/Config doc/Smokeping doc/examples
199 %attr(755,root,root) %{_sbindir}/smokeping
200 %attr(755,root,root) %{_sbindir}/tSmoke
201 %{_datadir}/smokeping
202 %exclude %{_cgi_bindir}/cropper
203 %exclude %{_datadir}/smokeping/smokeping.cgi
204 %exclude %{_cgi_bindir}/resource
205 %exclude %{_cgi_bindir}/script
206 %exclude %{_datadir}/smokeping/tr.cgi
207 %exclude %{_datadir}/smokeping/tr.html
208 %{_mandir}/man1/smokeping.1*
209 %{_mandir}/man1/smokeping.cgi.1*
210 %{_mandir}/man1/tSmoke.1*
211 %{_mandir}/man3/*.3*
212 %{_mandir}/man5/*.5*
213 %{_mandir}/man7/*.7*
214 %dir %{_sysconfdir}
215 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/basepage.html
216 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config
217 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config.dist
218 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/smokemail
219 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/smokeping_secrets
220 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/tmail
221 %attr(754,root,root) /etc/rc.d/init.d/smokeping
222 %dir %{_sharedstatedir}/%{name}
223 %dir %attr(775,root,smokeping) %{_sharedstatedir}/%{name}/rrd
224 %dir %attr(775,root,http) %{_sharedstatedir}/%{name}/img
225 %dir %attr(770,root,smokeping) /var/run/%{name}
226
227 %files cgi
228 %defattr(644,root,root,755)
229 %dir %attr(750,root,http) %{_wwwconfdir}
230 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_wwwconfdir}/apache.conf
231 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_wwwconfdir}/httpd.conf
232 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_wwwconfdir}/lighttpd.conf
233 %{_cgi_bindir}/cropper
234 %attr(755,root,root) %{_cgi_bindir}/smokeping.cgi
235 %{_cgi_bindir}/resource
236 %{_cgi_bindir}/script
237 %attr(755,root,root) %{_cgi_bindir}/tr.cgi
238 %{_cgi_bindir}/tr.html
This page took 0.086097 seconds and 4 git commands to generate.