-
Notifications
You must be signed in to change notification settings - Fork 6
/
bwctl.spec.in
197 lines (171 loc) · 6.3 KB
/
bwctl.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
Name: bwctl
Summary: bwctl - network throughput tester
Version: @VERSION@
Release: @PATCH_LEVEL@%{?dist}
License: ASL 2.0
Group: *Development/Libraries*
URL: http://e2epi.internet2.edu/bwctl/
Source: %{name}-%{version}.tar.gz
Packager: Aaron Brown <aaron@internet2.edu>
BuildRequires: libtool, I2util
%if 0%{?el7}
BuildRequires: systemd
%endif
Requires: bwctl-client, bwctl-server, iperf3 >= 3.0.11
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
%description
BWCTL is a command line client application and a scheduling and policy daemon
that wraps Iperf, Thrulay or nuttcp.
%files
%package client
Summary: bwctl client
Group: Applications/Network
Requires: iperf, iperf3 >= 3.0.11
%description client
bwctl command line tool for scheduling bandwidth measurements with a bwctl
server.
%package server
Summary: bwctl server
Group: Applications/Network
%if 0%{?el7}
%{?systemd_requires: %systemd_requires}
%else
Requires: chkconfig, initscripts
%endif
Requires: I2util, shadow-utils, coreutils
Requires: iperf, iperf3 >= 3.0.11
%description server
bwctl server
%package devel
Group: Development/Libraries
Summary: bwctl library headers.
%description devel
This package includes header files, and static link libraries for building
applications that use the bwctl library.
# Thrulay and I2Util get installed, but really, shouldn't be instaled.
#%define _unpackaged_files_terminate_build 0
%prep
%setup -q
%build
# The CFLAGS defined here enable some hardening options for gcc
# -fstack-protector-all -Wstack-protector:
# Put numbers at the beginning of each stack frame and check that they
# are the same. If a stack buffer if overflowed, it writes over the
# canary number and then on return when that number is checked, it won't
# be the same and the program will exit with a "Stack smashing detected"
# error instead of being exploited.
# -D_FORTIFY_SOURCE=2
# Does some checking for potentially exploitable code patterns in the
# source such overflowing a statically defined buffer.
CFLAGS="-fstack-protector-all -Wstack-protector -D_FORTIFY_SOURCE=2"
%configure --prefix=%{_prefix} --with-thrulay=no --with-I2util=no --with-iperf3 --enable-nuttcp --enable-debug
make
%install
%makeinstall
%{__install} -D -p -m 0644 conf/bwctld.service %{buildroot}%{_unitdir}/bwctl-server.service
%{__install} -D -p -m 0755 conf/bwctld.init %{buildroot}%{_sysconfdir}/rc.d/init.d/bwctl-server
%{__install} -D -p -m 0755 conf/bwctld.limits %{buildroot}%{_sysconfdir}/bwctl-server/bwctl-server.limits
%{__install} -D -p -m 0755 conf/bwctld.limits %{buildroot}%{_sysconfdir}/bwctl-server/bwctl-server.limits.default
%{__install} -D -p -m 0755 conf/bwctld.conf %{buildroot}%{_sysconfdir}/bwctl-server/bwctl-server.conf
%{__install} -D -p -m 0755 conf/bwctld.conf %{buildroot}%{_sysconfdir}/bwctl-server/bwctl-server.conf.default
%clean
rm -rf $RPM_BUILD_ROOT
%post server
%if 0%{?el7}
%systemd_post bwctl-server.service
if [ "$1" = "1" ]; then
/usr/sbin/useradd -r -s /bin/nologin -d /tmp bwctl || :
systemctl enable bwctl-server.service
systemctl start bwctl-server.service
fi
%else
if [ "$1" = "1" ]; then
# If this is a first time install, add the users and enable it by default
/sbin/chkconfig --add bwctl-server
/usr/sbin/useradd -r -s /bin/nologin -d /tmp bwctl || :
else
#handle pre 1.6 upgrade
if [ -e "/etc/bwctld/bwctld.conf" ]; then
mv %{_sysconfdir}/bwctl-server/bwctl-server.conf %{_sysconfdir}/bwctl-server/bwctl-server.conf.bak
mv /etc/bwctld/bwctld.conf %{_sysconfdir}/bwctl-server/bwctl-server.conf
elif [ -e "/etc/bwctld/bwctld.conf.rpmsave" ]; then
mv %{_sysconfdir}/bwctl-server/bwctl-server.conf %{_sysconfdir}/bwctl-server/bwctl-server.conf.bak
mv /etc/bwctld/bwctld.conf.rpmsave %{_sysconfdir}/bwctl-server/bwctl-server.conf
fi
if [ -e "/etc/bwctld/bwctld.limits" ]; then
mv %{_sysconfdir}/bwctl-server/bwctl-server.limits %{_sysconfdir}/bwctl-server/bwctl-server.limits.bak
mv /etc/bwctld/bwctld.limits %{_sysconfdir}/bwctl-server/bwctl-server.limits
elif [ -e "/etc/bwctld/bwctld.limits.rpmsave" ]; then
mv %{_sysconfdir}/bwctl-server/bwctl-server.limits %{_sysconfdir}/bwctl-server/bwctl-server.limits.bak
mv /etc/bwctld/bwctld.limits.rpmsave %{_sysconfdir}/bwctl-server/bwctl-server.limits
fi
if [ -e "/etc/bwctld/bwctld.keys" ]; then
if [ -e "%{_sysconfdir}/bwctl-server/bwctl-server.keys" ]; then
mv %{_sysconfdir}/bwctl-server/bwctl-server.keys %{_sysconfdir}/bwctl-server/bwctl-server.keys.bak
fi
mv /etc/bwctld/bwctld.keys %{_sysconfdir}/bwctl-server/bwctl-server.keys
fi
#make sure bwctl-server starts if bwctld was running
/sbin/service bwctld stop 2> /dev/null || :
chkconfig --list bwctld 2> /dev/null | grep -q on
if [ $? -eq 0 ]; then
/sbin/chkconfig --add bwctl-server
/sbin/service bwctl-server restart
else
/sbin/service bwctl-server cond-restart
fi
/sbin/chkconfig --del bwctld 2> /dev/null || :
fi
%endif
%preun server
%if 0%{?el7}
%systemd_preun bwctl-server.service
%else
if [ "$1" = "0" ]; then
# If this is an actual uninstall, stop the service and remove its links
/sbin/chkconfig --del bwctl-server
/sbin/service bwctl-server stop
fi
%endif
%postun server
%if 0%{?el7}
%systemd_postun_with_restart bwctl-server.service
%endif
if [ "$1" = "0" ]; then
# If this is an actual uninstall, delete the user after the software has been removed
/usr/sbin/userdel bwctl || :
fi
%files client
%defattr(-,root,root,0755)
%license LICENSE
%doc README
%{_bindir}/bwctl
%{_bindir}/bwping
%{_bindir}/bwtraceroute
%{_mandir}/man1/bwctl.1.gz
%{_mandir}/man1/bwping.1.gz
%{_mandir}/man1/bwtraceroute.1.gz
%files server
%defattr(-,root,root,0755)
%license LICENSE
%doc README contrib/sample_hook.pl
%{_bindir}/bwctld
%{_mandir}/man5/*
%{_mandir}/man8/*
%config(noreplace) %{_sysconfdir}/bwctl-server/*
%if 0%{?el7}
%{_unitdir}/bwctl-server.service
%else
%{_sysconfdir}/rc.d/init.d/bwctl-server
%endif
%files devel
%defattr(-,root,root,0755)
%license LICENSE
%{_libdir}/libbwlib.a
%{_includedir}/bwctl/*
%changelog
* Fri Aug 20 2010 Tom Throckmorton <throck@mcnc.org> - 1.3-4
- minor spec changes to enable rebuilds via mock
- disable I2util, thrulay at buildtime; enable nuttcp
* Fri Jan 11 2008 aaron@internet2.edu 1.0-1
- Initial RPM