forked from perfsonar/owamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
owamp.spec.in
373 lines (323 loc) · 11.7 KB
/
owamp.spec.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
Name: owamp
Summary: owamp - one-way delay tester
Version: @VERSION@
Release: @PATCH_LEVEL@%{?dist}
License: ASL 2.0
Group: *Development/Libraries*
URL: http://e2epi.internet2.edu/owamp/
Source: %{name}-%{version}.tar.gz
Packager: Aaron Brown <aaron@internet2.edu>
BuildRequires: libtool, I2util, libcap-devel, openssl-devel, systemd, selinux-policy-devel
Requires: owamp-client, owamp-server, I2util
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
%description
OWAMP is a client/server package that allows one to measure the latency between
hosts. Unlike ping, which can only measure the bidirectional delay, OWAMP
enables you to measure the unidirectional delay between two hosts.
%files
%package -n twamp
Summary: twamp - two-way delay tester
Requires: twamp-client, twamp-server, I2util
%description -n twamp
TWAMP is a client/server package that allows one to measure the latency between
hosts.
%files -n twamp
%package -n owamp-client
Summary: owamp client
Group: Applications/Network
%description -n owamp-client
owamp command line utilities for performing owamp measurements with an owamp
server.
%package -n twamp-client
Summary: twamp client
Group: Applications/Network
%description -n twamp-client
twamp command line utilities for performing twamp measurements with an twamp
server.
%package -n owamp-server
Summary: owamp server
Group: Applications/Network
%if 0%{?el7}
Requires: shadow-utils, coreutils
%{?systemd_requires: %systemd_requires}
# SELinux support
Requires: policycoreutils-python, libselinux-utils
Requires(post): selinux-policy-targeted, policycoreutils-python
Requires(postun): policycoreutils-python
%else
Requires: chkconfig, initscripts, shadow-utils, coreutils
%endif
%description -n owamp-server
owamp server
%package -n twamp-server
Summary: twamp server
Group: Applications/Network
%if 0%{?el7}
Requires: shadow-utils, coreutils
%{?systemd_requires: %systemd_requires}
# SELinux support
Requires: policycoreutils-python, libselinux-utils
Requires(post): selinux-policy-targeted, policycoreutils-python
Requires(postun): policycoreutils-python
%else
Requires: chkconfig, initscripts, shadow-utils, coreutils
%endif
%description -n twamp-server
twamp server
#%package devel
#Group: Development/Libraries
#Summary: owamp library headers.
#%description devel
#This package includes header files, and static link libraries for building
#applications that use the owamp library.
# Thrulay and I2Util get installed, but really, shouldn't be instaled.
%define _unpackaged_files_terminate_build 0
%pre -n owamp-client
/usr/sbin/groupadd -r owamp 2> /dev/null || :
/usr/sbin/useradd -g owamp -r -s /bin/nologin -d /tmp owamp 2> /dev/null || :
%pre -n twamp-client
/usr/sbin/groupadd -r twamp 2> /dev/null || :
/usr/sbin/useradd -g twamp -r -s /bin/nologin -d /tmp twamp 2> /dev/null || :
%pre -n owamp-server
/usr/sbin/groupadd -r owamp 2> /dev/null || :
/usr/sbin/useradd -g owamp -r -s /bin/nologin -d /tmp owamp 2> /dev/null || :
%pre -n twamp-server
/usr/sbin/groupadd -r twamp 2> /dev/null || :
/usr/sbin/useradd -g twamp -r -s /bin/nologin -d /tmp twamp 2> /dev/null || :
%prep
%setup -q
%build
%configure --with-I2util=no
make
make -f /usr/share/selinux/devel/Makefile -C selinux owamp-server.pp
make -f /usr/share/selinux/devel/Makefile -C selinux twamp-server.pp
%install
%makeinstall
%{__install} -D -p -m 0644 conf/owampd.service %{buildroot}%{_unitdir}/owamp-server.service
%{__install} -D -p -m 0755 conf/owampd.init %{buildroot}%{_sysconfdir}/rc.d/init.d/owamp-server
%{__install} -D -p -m 0644 conf/owampd.limits %{buildroot}%{_sysconfdir}/owamp-server/owamp-server.limits
%{__install} -D -p -m 0644 conf/owampd.rpm.conf %{buildroot}%{_sysconfdir}/owamp-server/owamp-server.conf
%{__install} -D -p -m 0644 conf/owampd.limits %{buildroot}%{_sysconfdir}/owamp-server/owamp-server.limits.default
%{__install} -D -p -m 0644 conf/owampd.rpm.conf %{buildroot}%{_sysconfdir}/owamp-server/owampd.conf.default
%{__install} -D -p -m 0755 conf/owampd-cleanup %{buildroot}%{_sysconfdir}/cron.daily/owamp-server
%{__install} -D -p -m 0644 conf/twampd.service %{buildroot}%{_unitdir}/twamp-server.service
%{__install} -D -p -m 0755 conf/twampd.init %{buildroot}%{_sysconfdir}/rc.d/init.d/twamp-server
%{__install} -D -p -m 0644 conf/twampd.rpm.conf %{buildroot}%{_sysconfdir}/twamp-server/twamp-server.conf
%{__install} -D -p -m 0644 conf/twampd.rpm.conf %{buildroot}%{_sysconfdir}/twamp-server/twamp-server.conf.default
%{__install} -D -p -m 0644 conf/twampd.limits %{buildroot}%{_sysconfdir}/twamp-server/twamp-server.limits
%{__install} -D -p -m 0644 conf/twampd.limits %{buildroot}%{_sysconfdir}/twamp-server/twamp-server.limits.default
mkdir -p %{buildroot}/usr/share/selinux/packages/
mv selinux/*.pp %{buildroot}/usr/share/selinux/packages/
rm -rf %{buildroot}/usr/lib/perfsonar/selinux
%check
make check
%clean
rm -rf $RPM_BUILD_ROOT
%post -n owamp-client
setcap "cap_net_raw+p" %{_bindir}/owping
setcap "cap_net_raw+p" %{_bindir}/powstream
%post -n owamp-server
#create data dir (must be prior to selinux)
mkdir -p /var/lib/owamp/hierarchy
chown -R owamp:owamp /var/lib/owamp
%if 0%{?el7}
semodule -n -i %{_datadir}/selinux/packages/owamp-server.pp
semanage port -a -t owamp_port_t -p tcp 861 2>/dev/null
semanage port -a -t owamp_test_port_t -p udp 8760-9960 2>/dev/null
if /usr/sbin/selinuxenabled; then
/usr/sbin/load_policy
restorecon -iR /etc/owamp-server /usr/bin/owampd \
/usr/lib/systemd/system/owamp-server.service \
/var/lib/owamp /var/run/owamp-server.*
fi
%systemd_post owamp-server.service
if [ "$1" = "1" ]; then
systemctl enable owamp-server.service
systemctl start owamp-server.service
fi
%else
if [ "$1" = "1" ]; then
/sbin/chkconfig --add owamp-server
mkdir -p /var/lib/owamp/hierarchy
chown -R owamp:owamp /var/lib/owamp
else
#handle pre 1.6 upgrade
if [ -e "/etc/owampd/owampd.conf" ]; then
mv %{_sysconfdir}/owamp-server/owamp-server.conf %{_sysconfdir}/owamp-server/owamp-server.conf.bak
mv /etc/owampd/owampd.conf %{_sysconfdir}/owamp-server/owamp-server.conf
elif [ -e "/etc/owampd/owampd.conf.rpmsave" ]; then
mv %{_sysconfdir}/owamp-server/owamp-server.conf %{_sysconfdir}/owamp-server/owamp-server.conf.bak
mv /etc/owampd/owampd.conf.rpmsave %{_sysconfdir}/owamp-server/owamp-server.conf
fi
if [ -e "/etc/owampd/owampd.limits" ]; then
mv %{_sysconfdir}/owamp-server/owamp-server.limits %{_sysconfdir}/owamp-server/owamp-server.limits.bak
mv /etc/owampd/owampd.limits %{_sysconfdir}/owamp-server/owamp-server.limits
elif [ -e "/etc/owampd/owampd.limits.rpmsave" ]; then
mv %{_sysconfdir}/owamp-server/owamp-server.limits %{_sysconfdir}/owamp-server/owamp-server.limits.bak
mv /etc/owampd/owampd.limits.rpmsave %{_sysconfdir}/owamp-server/owamp-server.limits
fi
#make sure owamp-server starts if owampd was running
/sbin/service owampd stop 2> /dev/null || :
chkconfig --list owampd 2> /dev/null | grep -q on
if [ $? -eq 0 ]; then
/sbin/chkconfig --add owamp-server
/sbin/service owamp-server restart
else
/sbin/service owamp-server cond-restart
fi
/sbin/chkconfig --del owampd 2> /dev/null || :
fi
%endif
%preun -n owamp-server
%if 0%{?el7}
%systemd_preun owamp-server.service
%else
if [ "$1" = "0" ]; then
/sbin/chkconfig --del owamp-server
/sbin/service owamp-server stop
fi
%endif
%postun -n owamp-server
%if 0%{?el7}
%systemd_postun_with_restart owamp-server.service
if [ $1 -eq 0 ]; then
semanage port -d -p tcp 861
semanage port -d -p udp 8760-9960
semodule -n -r owamp-server
if /usr/sbin/selinuxenabled; then
/usr/sbin/load_policy
restorecon -iR /etc/owamp-server /usr/bin/owampd \
/usr/lib/systemd/system/owamp-server.service \
/var/lib/owamp /var/run/owamp-server.*
fi
fi
%endif
if [ "$1" = "0" ]; then
/usr/sbin/userdel owamp || :
fi
%post -n twamp-client
setcap "cap_net_raw+p" %{_bindir}/twping
%post -n twamp-server
#create data dir (must be prior to selinux)
mkdir -p /var/lib/twamp
chown -R twamp:twamp /var/lib/twamp
%if 0%{?el7}
semodule -n -i %{_datadir}/selinux/packages/twamp-server.pp
semanage port -a -t twamp_port_t -p tcp 862 2>/dev/null
semanage port -a -t twamp_test_port_t -p udp 18760-19960 2>/dev/null
if /usr/sbin/selinuxenabled; then
/usr/sbin/load_policy
restorecon -iR /etc/twamp-server /usr/bin/twampd \
/usr/lib/systemd/system/twamp-server.service \
/var/lib/twamp /var/run/twamp-server.*
fi
%systemd_post twamp-server.service
if [ "$1" = "1" ]; then
systemctl enable twamp-server.service
systemctl start twamp-server.service
fi
%else
if [ "$1" = "1" ]; then
/sbin/chkconfig --add twamp-server
mkdir -p /var/lib/twamp
chown -R twamp:twamp /var/lib/twamp
else
#make sure twamp-server starts if twampd was running
/sbin/service twampd stop 2> /dev/null || :
chkconfig --list twampd 2> /dev/null | grep -q on
if [ $? -eq 0 ]; then
/sbin/chkconfig --add twamp-server
/sbin/service twamp-server restart
else
/sbin/service twamp-server cond-restart
fi
/sbin/chkconfig --del twampd 2> /dev/null || :
fi
%endif
%preun -n twamp-server
%if 0%{?el7}
%systemd_preun twamp-server.service
%else
if [ "$1" = "0" ]; then
/sbin/chkconfig --del twamp-server
/sbin/service twamp-server stop
fi
%endif
%postun -n twamp-server
%if 0%{?el7}
%systemd_postun_with_restart twamp-server.service
if [ $1 -eq 0 ]; then
semanage port -d -p tcp 862
semanage port -d -p udp 18760-19960
semodule -n -r twamp-server
if /usr/sbin/selinuxenabled; then
/usr/sbin/load_policy
restorecon -iR /etc/twamp-server /usr/bin/twampd \
/usr/lib/systemd/system/twamp-server.service \
/var/lib/twamp /var/run/twamp-server.*
fi
fi
%endif
if [ "$1" = "0" ]; then
/usr/sbin/userdel twamp || :
fi
%files -n owamp-client
%defattr(0644,root,root,0755)
%license LICENSE
%doc README
%attr(0755,root,root) %{_bindir}/owfetch
%attr(0755,root,root) %{_bindir}/owping
%attr(0755,root,root) %{_bindir}/owstats
%attr(0755,root,root) %{_bindir}/owup
%attr(0755,root,root) %{_bindir}/powstream
%{_mandir}/man1/owfetch.1.gz
%{_mandir}/man1/owping.1.gz
%{_mandir}/man1/owstats.1.gz
%{_mandir}/man1/owup.1.gz
%{_mandir}/man1/powstream.1.gz
%files -n twamp-client
%defattr(0644,root,root,0755)
%license LICENSE
%attr(0755,root,root) %{_bindir}/twping
%{_mandir}/man1/twping.1.gz
%files -n owamp-server
%license LICENSE
%defattr(0644,root,root,0755)
%attr(0755,root,root) %{_bindir}/owampd
%{_mandir}/man5/owamp*
%{_mandir}/man8/owamp*
%config(noreplace) %{_sysconfdir}/owamp-server/*
%if 0%{?el7}
%{_unitdir}/owamp-server.service
%attr(0644,root,root) %{_datadir}/selinux/packages/owamp-server.pp
%else
%attr(0755,root,root) %{_sysconfdir}/rc.d/init.d/owamp-server
%endif
%attr(0755,root,root) %{_sysconfdir}/cron.daily/owamp-server
%files -n twamp-server
%defattr(0644,root,root,0755)
%license LICENSE
%attr(0755,root,root) %{_bindir}/twampd
%{_mandir}/man5/twamp*
%{_mandir}/man8/twamp*
%config(noreplace) %{_sysconfdir}/twamp-server/*
%if 0%{?el7}
%{_unitdir}/twamp-server.service
%attr(0644,root,root) %{_datadir}/selinux/packages/twamp-server.pp
%else
%{_sysconfdir}/rc.d/init.d/twamp-server
%endif
#%files devel
#%defattr(0644,root,root,0755)
#%license LICENSE
#%{_libdir}/libbwlib.a
#%{_includedir}/owamp/*
%changelog
* Thu Mar 26 2009 aaron@internet2.edu 1.0-4
- Make upgrading work more seamlessly
* Thu Mar 26 2009 aaron@internet2.edu 1.0-3
- Make sure that /var/lib/owamp is created on install
* Mon Feb 02 2009 aaron@internet2.edu 1.0-2
- Fix the example owampd.limits location
* Fri Aug 22 2008 aaron@internet2.edu 1.0-1
- Initial RPM