Tue, 28 Aug 2012 18:36:35 +0200
Correct the paths of patched scripts, refine password generation,
mitigate fdatasync(2) detection problems, correct dependencies, remove
outdated autoconf components, correct conf file paths and attributes,
complete and correct log file rotation handing, and note warnings
useful for diagnosing builds.
1 ##
2 ## dhcpd.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2011 OpenPKG Foundation e.V. <http://openpkg.net/>
4 ##
5 ## Permission to use, copy, modify, and distribute this software for
6 ## any purpose with or without fee is hereby granted, provided that
7 ## the above copyright notice and this permission notice appear in all
8 ## copies.
9 ##
10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE.
22 ##
24 # package version
25 %define V_opkg 4.2.2
26 %define V_dist 4.2.2
28 # package information
29 Name: dhcpd
30 Summary: DHCP Daemon
31 URL: http://www.isc.org/products/DHCP/
32 Vendor: Internet Software Consortium
33 Packager: OpenPKG Foundation e.V.
34 Distribution: OpenPKG Community
35 Class: BASE
36 Group: DHCP
37 License: ISC/BSD
38 Version: %{V_opkg}
39 Release: 20110914
41 # package options
42 %option with_fsl yes
44 # list of sources
45 Source0: ftp://ftp.isc.org/isc/dhcp/dhcp-%{V_dist}.tar.gz
46 Source1: dhcpd.conf
47 Source2: rc.dhcpd
48 Source3: fsl.dhcpd
49 Patch0: dhcpd.patch
51 # build information
52 Prefix: %{l_prefix}
53 BuildRoot: %{l_buildroot}
54 BuildPreReq: OpenPKG, openpkg >= 20060823
55 PreReq: OpenPKG, openpkg >= 20060823
56 BuildPreReq: openssl
57 PreReq: openssl
58 %if "%{with_fsl}" == "yes"
59 BuildPreReq: fsl
60 PreReq: fsl
61 %endif
62 AutoReq: no
63 AutoReqProv: no
65 %description
66 This is the ISC DHCP daemon reference implementation.
68 %track
69 prog dhcpd = {
70 version = %{V_dist}
71 url = ftp://ftp.isc.org/isc/dhcp/
72 regex = dhcp-(\d+\.\d+\.\d+)\.tar\.gz
73 }
75 %prep
76 %setup -q -n dhcp-%{V_dist}
77 ( echo "/* Placeholder to remove conflicting symbol 'struct option' */"
78 echo "/* which is sometimes present in both getopt.h and tree.h */"
79 ) >includes/getopt.h
80 %patch -p0
82 %build
83 # configure program
84 %{l_shtool} subst \
85 -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_PID[^"]*\).*;\1 "%{l_prefix}/var/dhcpd/run/dhcpd.pid";' \
86 -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_DB[^"]*\).*;\1 "%{l_prefix}/var/dhcpd/db/dhcpd.leases";' \
87 -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_CONF[^"]*\).*;\1 "%{l_prefix}/etc/dhcpd/dhcpd.conf";' \
88 includes/site.h
89 CC="%{l_cc}" \
90 CFLAGS="%{l_cflags -O}" \
91 CPPFLAGS="%{l_cppflags} -DNOMINUM" \
92 LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
93 LIBS="%{l_fsl_libs}" \
94 ./configure \
95 --prefix=%{l_prefix} \
96 --mandir=%{l_prefix}/man \
97 --sysconfdir=%{l_prefix}/etc/dhcpd \
98 --localstatedir=%{l_prefix}/var/dhcpd \
99 --with-srv-lease-file=%{l_prefix}/var/dhcpd/db/dhcpd.leases \
100 --with-cli-lease-file=%{l_prefix}/var/dhcpd/db/dhclient.leases \
101 --with-srv-pid-file=%{l_prefix}/var/dhcpd/run/dhcpd.pid \
102 --with-cli-pid-file=%{l_prefix}/var/dhcpd/run/dhclient.pid \
103 --with-relay-pid-file=%{l_prefix}/var/dhcpd/run/dhrelay.pid \
104 --disable-dhcpv6
106 # build program
107 %{l_make} %{l_mflags}
109 %install
110 # clean up build cruft
111 rm -rf $RPM_BUILD_ROOT
113 # install program
114 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
116 # install default configuration
117 %{l_shtool} install -c -m 644 \
118 %{SOURCE dhcpd.conf} \
119 $RPM_BUILD_ROOT%{l_prefix}/etc/dhcpd/dhcpd.conf
121 # post-adjust and strip down installation
122 rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/dhclient-script
123 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/dhclient-script.8
124 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2>/dev/null || true
125 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true
127 # install run-command script
128 %{l_shtool} mkdir -f -p -m 755 \
129 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
130 %{l_shtool} install -c -m 755 %{l_value -s -a} \
131 %{SOURCE rc.dhcpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
133 # install OSSP fsl configuration
134 %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
135 %{l_shtool} install -c -m 644 %{l_value -s -a} \
136 %{SOURCE fsl.dhcpd} \
137 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
139 # create run-time directories
140 %{l_shtool} mkdir -f -p -m 755 \
141 $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/db \
142 $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/run \
143 $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/log
145 # determine installation files
146 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
147 %{l_files_std} \
148 '%config %{l_prefix}/etc/fsl/fsl.dhcpd' \
149 '%config %{l_prefix}/etc/dhcpd/*'
151 %files -f files
153 %clean
154 rm -rf $RPM_BUILD_ROOT
156 %post
157 if [ $1 -eq 1 ]; then
158 # display final hints on initial installation
159 ( echo "Before starting DHCP daemon, please set the configuration variable"
160 echo "\"dhcpd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the"
161 echo "used network interface."
162 ) | %{l_rpmtool} msg -b -t notice
163 fi
165 # after upgrade, restart service
166 [ $1 -eq 2 ] || exit 0
167 eval `%{l_rc} dhcpd status 2>/dev/null`
168 [ ".$dhcpd_active" = .yes ] && %{l_rc} dhcpd restart
169 exit 0
171 %preun
172 # before erase, stop service and remove log files
173 [ $1 -eq 0 ] || exit 0
174 %{l_rc} dhcpd stop 2>/dev/null
175 rm -f $RPM_INSTALL_PREFIX/var/dhcpd/db/* >/dev/null 2>&1 || true
176 rm -f $RPM_INSTALL_PREFIX/var/dhcpd/run/* >/dev/null 2>&1 || true
177 exit 0