Thu, 15 Sep 2011 11:49:33 +0200
Resynchronize with upstream package maintainer version.
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.1
26 %define V_dist 4.2.1
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: 20110424
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 %patch -p0
79 %build
80 # configure program
81 %{l_shtool} subst \
82 -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_PID[^"]*\).*;\1 "%{l_prefix}/var/dhcpd/run/dhcpd.pid";' \
83 -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_DB[^"]*\).*;\1 "%{l_prefix}/var/dhcpd/db/dhcpd.leases";' \
84 -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_CONF[^"]*\).*;\1 "%{l_prefix}/etc/dhcpd/dhcpd.conf";' \
85 includes/site.h
86 CC="%{l_cc}" \
87 CFLAGS="%{l_cflags -O}" \
88 CPPFLAGS="%{l_cppflags} -DNOMINUM" \
89 LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
90 LIBS="%{l_fsl_libs}" \
91 ./configure \
92 --prefix=%{l_prefix} \
93 --mandir=%{l_prefix}/man \
94 --sysconfdir=%{l_prefix}/etc/dhcpd \
95 --localstatedir=%{l_prefix}/var/dhcpd \
96 --with-srv-lease-file=%{l_prefix}/var/dhcpd/db/dhcpd.leases \
97 --with-cli-lease-file=%{l_prefix}/var/dhcpd/db/dhclient.leases \
98 --with-srv-pid-file=%{l_prefix}/var/dhcpd/run/dhcpd.pid \
99 --with-cli-pid-file=%{l_prefix}/var/dhcpd/run/dhclient.pid \
100 --with-relay-pid-file=%{l_prefix}/var/dhcpd/run/dhrelay.pid \
101 --disable-dhcpv6
103 # build program
104 %{l_make} %{l_mflags}
106 %install
107 # clean up build cruft
108 rm -rf $RPM_BUILD_ROOT
110 # install program
111 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
113 # install default configuration
114 %{l_shtool} install -c -m 644 \
115 %{SOURCE dhcpd.conf} \
116 $RPM_BUILD_ROOT%{l_prefix}/etc/dhcpd/dhcpd.conf
118 # post-adjust and strip down installation
119 rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/dhclient-script
120 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/dhclient-script.8
121 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2>/dev/null || true
122 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true
124 # install run-command script
125 %{l_shtool} mkdir -f -p -m 755 \
126 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
127 %{l_shtool} install -c -m 755 %{l_value -s -a} \
128 %{SOURCE rc.dhcpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
130 # install OSSP fsl configuration
131 %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
132 %{l_shtool} install -c -m 644 %{l_value -s -a} \
133 %{SOURCE fsl.dhcpd} \
134 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
136 # create run-time directories
137 %{l_shtool} mkdir -f -p -m 755 \
138 $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/db \
139 $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/run \
140 $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/log
142 # determine installation files
143 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
144 %{l_files_std} \
145 '%config %{l_prefix}/etc/fsl/fsl.dhcpd' \
146 '%config %{l_prefix}/etc/dhcpd/*'
148 %files -f files
150 %clean
151 rm -rf $RPM_BUILD_ROOT
153 %post
154 if [ $1 -eq 1 ]; then
155 # display final hints on initial installation
156 ( echo "Before starting DHCP daemon, please set the configuration variable"
157 echo "\"dhcpd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the"
158 echo "used network interface."
159 ) | %{l_rpmtool} msg -b -t notice
160 fi
162 # after upgrade, restart service
163 [ $1 -eq 2 ] || exit 0
164 eval `%{l_rc} dhcpd status 2>/dev/null`
165 [ ".$dhcpd_active" = .yes ] && %{l_rc} dhcpd restart
166 exit 0
168 %preun
169 # before erase, stop service and remove log files
170 [ $1 -eq 0 ] || exit 0
171 %{l_rc} dhcpd stop 2>/dev/null
172 rm -f $RPM_INSTALL_PREFIX/var/dhcpd/db/* >/dev/null 2>&1 || true
173 rm -f $RPM_INSTALL_PREFIX/var/dhcpd/run/* >/dev/null 2>&1 || true
174 exit 0