-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdhcp-forwarder.spec.in
267 lines (189 loc) · 7.47 KB
/
dhcp-forwarder.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
## --*- rpm-spec -*--
# Copyright (C) 2004, 2008, 2014
# Enrico Scholz <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
## This package understands the following switches:
## --without dietlibc ... disable usage of dietlibc
## --without minit ... disable creation of 'minit' subpackage
## --with fedora ... enable fedora.us specific parts
%define uid 11
%define useradd /usr/sbin/%{?_with_fedora:fedora-}useradd %{?_with_fedora:%uid}
%define groupadd /usr/sbin/%{?_with_fedora:fedora-}groupadd %{?_with_fedora:%uid}
%define userdel /usr/sbin/%{?_with_fedora:fedora-}userdel
%define groupdel /usr/sbin/%{?_with_fedora:fedora-}groupdel
%define username dhcp-fwd
%define homedir %_var/lib/%username
%define minitdir %_sysconfdir/minit
%define minitsvcdir %minitdir/services/dhcp-fwd
%define service dhcp-fwd
%{!?release_func:%define release_func() %1}
Summary: A DHCP relay agent
Name: dhcp-forwarder
Version: @VERSION@
Release: %release_func 0
Epoch: 0
License: GPLv3
Group: System Environment/Daemons
URL: http://www.tu-chemnitz.de/~ensc/dhcp-fwd
Source0: http://www.tu-chemnitz.de/~ensc/dhcp-fwd/files/%name-%version.tar.bz2
BuildRoot: %_tmppath/%name-%version-%release-root
Requires: init(dhcp-forwarder)
%{!?_without_dietlibc:BuildRequires: dietlibc}
## The Requires(...) which depend on the '--with fedora' switch
%{!?_with_fedora:Requires(pre): /usr/sbin/useradd /usr/sbin/groupadd}
%{!?_with_fedora:Requires(postun): /usr/sbin/userdel /usr/sbin/groupdel}
%{?_with_fedora:Requires(pre): fedora-usermgmt}
%{?_with_fedora:Requires(postun): fedora-usermgmt}
%package sysv
Summary: SysV initscripts for dhcp-forwarder
Group: System Environment/Base
Provides: init(dhcp-forwarder) = sysv
Requires: %name = %epoch:%version-%release
Requires(preun): %name initscripts
Requires(postun): %name initscripts
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
%package minit
Summary: minit initscripts for dhcp-forwarder
Group: System Environment/Base
Provides: init(dhcp-forwarder) = minit
Requires: %name = %epoch:%version-%release
Requires(pre): minit-setup
Requires(postun): minit-setup
%description
dhcp-fwd forwards DHCP messages between subnets with different sublayer
broadcast domains. It is similar to the DHCP relay agent dhcrelay of
ISC's DHCP, but has the following important features:
* Runs as non-root in a chroot-environment
* Uses AF_INET sockets which makes it possible to filter incoming
messages with packetfilters
* The DHCP agent IDs can be defined freely
* Has a small memory footprint when using dietlibc
%description sysv
dhcp-fwd forwards DHCP messages between subnets with different sublayer
broadcast domains.
This package provides the scripts which can be used to start dhcp-forwarder
with the SysV initconcept.
%description minit
dhcp-fwd forwards DHCP messages between subnets with different sublayer
broadcast domains.
This package provides the scripts which can be used to start dhcp-forwarder
with the minit initconcept.
##---------------------------------------------
%prep
%setup -q
##---------------------------------------------
%build
%configure \
--enable-release \
--with-initrddir=%_initrddir \
%{?_without_dietlibc:--disable-dietlibc}
%__make %{?_smp_mflags}
##---------------------------------------------
%install
rm -rf $RPM_BUILD_ROOT
%__make DESTDIR=$RPM_BUILD_ROOT install install-contrib
%__install -d -m700 $RPM_BUILD_ROOT%homedir
%{?_without_minit:rm -rf $RPM_BUILD_ROOT%minitsvcdir}
##---------------------------------------------
%check
%__make check
##---------------------------------------------
%clean
rm -rf $RPM_BUILD_ROOT
%pre
%groupadd -r %username &>/dev/null || :
%useradd -r -s /sbin/nologin -M -c 'DHCP Forwarder user' \
-d %homedir -g %username %username &>/dev/null || :
%postun
if test "$1" = "0"; then
%userdel %username &>/dev/null || :
%groupdel %username &>/dev/null || :
fi
%post sysv
/sbin/chkconfig --add %service
%preun sysv
if test "$1" = "0"; then
%_initrddir/%service stop >/dev/null
/sbin/chkconfig --del %service
fi
%postun sysv
test "$1" = 0 || %_initrddir/%service condrestart &>/dev/null
%files
%defattr(-,root,root,-)
%doc AUTHORS COPYING ChangeLog NEWS README THANKS
%_mandir/*/*
%config(noreplace) %_sysconfdir/dhcp-fwd.conf
%_sbindir/*
## *DO NOT* add %defattr(-,dhcp-fwd,dhcp-fwd); the homedir is used for
## the chroot() only and there is no reason why the setuid()'ed daemon
## needs any kind of access there
%homedir
%files sysv
%defattr(-,root,root,-)
%config %_initrddir/*
%config(noreplace) %_sysconfdir/sysconfig/*
%if 0%{!?_without_minit:1}
%files minit
%defattr(-,root,root,-)
%dir %minitsvcdir
%minitsvcdir/run
%minitsvcdir/respawn
%config(noreplace) %minitsvcdir/params
%endif
%changelog
* Thu Aug 19 2004 Enrico Scholz <[email protected]> - 0:0.6.1-0
- added support for 'fedora-usermgmt' (enabled with '--with fedora' switch)
* Thu Jun 17 2004 Enrico Scholz <[email protected]> - 0:0.6.1-0
- conditionalized build of -minit subpackage
* Thu Aug 7 2003 Enrico Scholz <[email protected]> 0:0.5.1-0
- added minit support
- removed superfluous %%doc attribute of %%_mandir entries
- removed superfluous curlies
- use 'install-contrib' and cleaned up %%install section
- moved /etc/sysconfig/* file into -sysv subpackage; it is not used by
-minit anymore
- minor cleanups
* Wed Jul 30 2003 Enrico Scholz <[email protected]> 0:0.5-0.fdr.1
- updated to version 0.5
* Tue May 27 2003 Enrico Scholz <[email protected]> 0:0.4-0.fdr.2
- create and remove group explicitely
- s/adduser/useradd/
- removed dependency on initscripts by calling the service-script in
the %%post/%%preun scriptlets directly
- do not call '--install-contrib' anymore; it creates too much
clutter to make sure that the initscripts will be installed into
%%_initrddir but not in /etc/init.d. Instead of, install the
scripts manually.
* Fri May 2 2003 Enrico Scholz <[email protected]> 0:0.4-0.fdr.1
- cleanups
- applied fedora.us naming scheme
* Wed Aug 28 2002 Enrico Scholz <[email protected]> 0.3.1-1
- Added /etc/sysconfig/dhcp-fwd file
* Fri Jul 12 2002 Enrico Scholz <[email protected]> 0.2.5-2
- Renamed username from dhcpfwd to dhcp-fwd
- Adjusted URL
* Fri Jul 12 2002 Enrico Scholz <[email protected]> 0.2.5-1
- version 0.2.5
- Fixed some typos
- Added some PreReq's
- Enhanced %postun script
* Mon Jun 17 2002 Enrico Scholz <[email protected]> 0.2-2
- Described purpose of the %%homedir and its handling
* Fri Jun 14 2002 Enrico Scholz <[email protected]> 0.2-1
- Added manpage
* Thu Jun 13 2002 Enrico Scholz <[email protected]> 0.1-0.3
- Added --without dietlibc option
* Sat Jun 1 2002 Enrico Scholz <[email protected]>
- Initial build.