]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/blob - dhcp/dhcp.nm
dhcp: Add systemd file for dhclient.
[people/amarx/ipfire-3.x.git] / dhcp / dhcp.nm
1 ###############################################################################
2 # IPFire.org - An Open Source Firewall Solution #
3 # Copyright (C) - IPFire Development Team <info@ipfire.org> #
4 ###############################################################################
5
6 name = dhcp
7 version = 4.2.2
8 release = 2
9
10 groups = Networking/Daemons
11 url = http://isc.org/products/DHCP/
12 license = ISC
13 summary = Dynamic host configuration protocol software.
14
15 description
16 DHCP (Dynamic Host Configuration Protocol) is a protocol which allows
17 individual devices on an IP network to get their own network
18 configuration information (IP address, subnetmask, broadcast address,
19 etc.) from a DHCP server. The overall purpose of DHCP is to make it
20 easier to administer a large network.
21 end
22
23 source_dl = ftp://ftp.isc.org/isc/dhcp/
24
25 # Apply patches in a special order.
26 patches = \
27 dhcp-4.2.2-remove-bind.patch \
28 dhcp-4.2.0-errwarn-message.patch \
29 dhcp-4.2.2-options.patch \
30 dhcp-4.2.0-release-by-ifup.patch \
31 dhcp-4.2.0-dhclient-decline-backoff.patch \
32 dhcp-4.2.0-unicast-bootp.patch \
33 dhcp-4.2.2-dhclient-usage.patch \
34 dhcp-4.2.0-default-requested-options.patch \
35 dhcp-4.2.2-xen-checksum.patch \
36 dhcp-4.2.1-manpages.patch \
37 dhcp-4.2.0-paths.patch \
38 dhcp-4.2.2-CLOEXEC.patch \
39 dhcp-4.2.0-inherit-leases.patch \
40 dhcp-4.2.0-garbage-chars.patch \
41 dhcp-4.2.0-missing-ipv6-not-fatal.patch \
42 dhcp-4.2.0-add_timeout_when_NULL.patch \
43 dhcp-4.2.1-64_bit_lease_parse.patch \
44 dhcp-4.2.2-capability.patch \
45 dhcp-4.2.0-logpid.patch \
46 dhcp-4.2.0-UseMulticast.patch \
47 dhcp-4.2.1-sendDecline.patch \
48 dhcp-4.2.1-retransmission.patch \
49 dhcp-4.2.2-rfc3442-classless-static-routes.patch \
50 dhcp-4.2.0-honor-expired.patch \
51 dhcp-4.2.0-noprefixavail.patch \
52 dhcp-4.2.2-sharedlib.patch \
53 dhcp-4.2.0-PPP.patch \
54 dhcp-4.2.2-lpf-ib.patch \
55 dhcp-4.2.2-improved-xid.patch \
56 dhcp-4.2.2-gpxe-cid.patch \
57 dhcp-4.2.2-systemtap.patch
58
59 build
60 requires
61 autoconf
62 automake
63 bind-devel>=9
64 bind-devel<10
65 groff
66 libtool
67 openldap-devel
68 libcap-ng-devel
69 end
70
71 CFLAGS += \
72 -fno-strict-aliasing \
73 -D_GNU_SOURCE \
74 -Wl,--as-needed
75
76 configure_options += \
77 --sysconfdir=/etc \
78 --with-srv-lease-file=/var/lib/dhcpd/dhcpd.leases \
79 --with-srv6-lease-file=/var/lib/dhcpd/dhcp6.leases \
80 --with-cli-lease-file=/var/lib/dhclient/dhclient.leases \
81 --with-cli6-lease-file=/var/lib/dhclient/dhclient6.leases \
82 --with-srv-pid-file=/run/dhcpd.pid \
83 --with-srv6-pid-file=/run/dhcpd6.pid \
84 --with-cli-pid-file=/run/dhclient.pid \
85 --with-cli6-pid-file=/run/dhclient6.pid \
86 --with-relay-pid-file=/run/dhcrelay.pid \
87 --with-ldap \
88 --with-ldapcrypto \
89 --with-libbind=/usr/include/ \
90 --with-libbind-libs=/usr/lib/ \
91 --disable-static \
92 --enable-paranoia \
93 --enable-early-chroot
94
95 prepare_cmds
96 # Remove bundled BIND source
97 rm -rvf %{DIR_APP}/bind/bind.tar.gz
98
99 # Regenerate build environment
100 libtoolize --copy --force
101 autoreconf --verbose --force --install
102 end
103
104 install_cmds
105 rm -vf %{BUILDROOT}/etc/dhclient.conf
106
107 # Move the client to /sbin, create dirs
108 # and remove the default config.
109 mkdir -pv %{BUILDROOT}/sbin
110 mv -v %{BUILDROOT}/usr/sbin/dhclient %{BUILDROOT}/sbin/dhclient
111
112 install -v -m 755 %{DIR_SOURCE}/dhclient-script \
113 %{BUILDROOT}/sbin/dhclient-script
114
115 # Create runtime folders.
116 mkdir -pv %{BUILDROOT}/var/lib/dhclient
117 mkdir -pv %{BUILDROOT}/var/lib/dhcpd
118
119 # Create empty lease files.
120 touch %{BUILDROOT}/var/lib/dhclient/dhclient.leases
121 touch %{BUILDROOT}/var/lib/dhclient/dhclient6.leases
122 touch %{BUILDROOT}/var/lib/dhcpd/dhcpd.leases
123 touch %{BUILDROOT}/var/lib/dhcpd/dhcpd6.leases
124 end
125 end
126
127 packages
128 package %{name}
129
130 requires
131 dhcp-common
132 end
133
134 prerequires += shadow-utils
135
136 script prein
137 getent group dhcpd >/dev/null || groupadd -r dhcpd
138 getent passwd dhcpd >/dev/null || \
139 useradd -r -g dhcpd -d /var/lib/dhcpd -s /sbin/nologin \
140 -c "User for the DHCP server" dhcpd
141 exit 0
142 end
143
144 # Just search for new unit files that were just installed.
145 script postin
146 /bin/systemctl daemon-reload >/dev/null 2>&1 || :
147 end
148
149 # Disable the service that is to be removed and stop it if it is still running.
150 script preun
151 /bin/systemctl --no-reload disable dhcpd.service >/dev/null 2>&1 || :
152 /bin/systemctl --no-reload disable dhcpd6.service >/dev/null 2>&1 || :
153 /bin/systemctl --no-reload disable dhcrelay.service >/dev/null 2>&1 || :
154 /bin/systemctl stop dhcpd.service >/dev/null 2>&1 || :
155 /bin/systemctl stop dhcpd6.service >/dev/null 2>&1 || :
156 /bin/systemctl stop dhcrelay.service >/dev/null 2>&1 || :
157 end
158
159 # Just tell systemd that unitfiles have been removed.
160 script postun
161 /bin/systemctl daemon-reload >/dev/null 2>&1 || :
162 end
163
164 # Try to restart the service if it is running.
165 script postup
166 /bin/systemctl daemon-reload >/dev/null 2>&1 || :
167 /bin/systemctl try-restart dhcpd.service >/dev/null 2>&1 || :
168 /bin/systemctl try-restart dhcpd6.service >/dev/null 2>&1 || :
169 /bin/systemctl try-restart dhcrelay.service >/dev/null 2>&1 || :
170 end
171 end
172
173 package dhclient
174 summary = DHCP client daemon and dhclient-script.
175 description = %{summary}
176
177 requires
178 dhcp-common
179 end
180
181 files
182 /sbin
183 /usr/share/man/man5/dhclient*
184 /usr/share/man/man8/dhclient*
185 /var/lib/dhclient
186 end
187 end
188
189 package %{name}-common
190 summary = Common files used by the dhcp client and server.
191 description = %{summary}
192
193 files
194 /usr/bin/
195 /usr/share/man/man1/omshell.1*
196 /usr/share/man/man5/dhcp-options.5*
197 /usr/share/man/man5/dhcp-eval.5*
198 end
199 end
200
201 package %{name}-libs
202 template LIBS
203 end
204
205 package %{name}-devel
206 template DEVEL
207 end
208
209 package %{name}-debuginfo
210 template DEBUGINFO
211 end
212 end