1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dhcpd/dhcpd.spec Tue Jan 06 23:40:39 2009 +0100 1.3 @@ -0,0 +1,164 @@ 1.4 +## 1.5 +## dhcpd.spec -- OpenPKG RPM Package Specification 1.6 +## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/> 1.7 +## 1.8 +## Permission to use, copy, modify, and distribute this software for 1.9 +## any purpose with or without fee is hereby granted, provided that 1.10 +## the above copyright notice and this permission notice appear in all 1.11 +## copies. 1.12 +## 1.13 +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 1.14 +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1.15 +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1.16 +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 1.17 +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.18 +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.19 +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 1.20 +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 1.21 +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 1.22 +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 1.23 +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1.24 +## SUCH DAMAGE. 1.25 +## 1.26 + 1.27 +# package information 1.28 +Name: dhcpd 1.29 +Summary: DHCP Daemon 1.30 +URL: http://www.isc.org/products/DHCP/ 1.31 +Vendor: Internet Software Consortium 1.32 +Packager: OpenPKG Foundation e.V. 1.33 +Distribution: OpenPKG Community 1.34 +Class: BASE 1.35 +Group: DHCP 1.36 +License: ISC/BSD 1.37 +Version: 4.1.0 1.38 +Release: 20081220 1.39 + 1.40 +# package options 1.41 +%option with_fsl yes 1.42 + 1.43 +# list of sources 1.44 +Source0: ftp://ftp.isc.org/isc/dhcp/dhcp-%{version}.tar.gz 1.45 +Source1: dhcpd.conf 1.46 +Source2: rc.dhcpd 1.47 +Source3: fsl.dhcpd 1.48 + 1.49 +# build information 1.50 +Prefix: %{l_prefix} 1.51 +BuildRoot: %{l_buildroot} 1.52 +BuildPreReq: OpenPKG, openpkg >= 20060823 1.53 +PreReq: OpenPKG, openpkg >= 20060823 1.54 +%if "%{with_fsl}" == "yes" 1.55 +BuildPreReq: fsl 1.56 +PreReq: fsl 1.57 +%endif 1.58 +AutoReq: no 1.59 +AutoReqProv: no 1.60 + 1.61 +%description 1.62 + This is the ISC DHCP daemon reference implementation. 1.63 + 1.64 +%track 1.65 + prog dhcpd = { 1.66 + version = %{version} 1.67 + url = ftp://ftp.isc.org/isc/dhcp/ 1.68 + regex = dhcp-(\d+\.\d+\.\d+)\.tar\.gz 1.69 + } 1.70 + 1.71 +%prep 1.72 + %setup -q -n dhcp-%{version} 1.73 + 1.74 +%build 1.75 + # configure program 1.76 + %{l_shtool} subst \ 1.77 + -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_PID[^"]*\).*;\1 "%{l_prefix}/var/dhcpd/run/dhcpd.pid";' \ 1.78 + -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_DB[^"]*\).*;\1 "%{l_prefix}/var/dhcpd/db/dhcpd.leases";' \ 1.79 + -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_CONF[^"]*\).*;\1 "%{l_prefix}/etc/dhcpd/dhcpd.conf";' \ 1.80 + includes/site.h 1.81 + CC="%{l_cc}" \ 1.82 + CFLAGS="%{l_cflags -O}" \ 1.83 + CPPFLAGS="%{l_cppflags} -DNOMINUM" \ 1.84 + LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \ 1.85 + LIBS="%{l_fsl_libs}" \ 1.86 + ./configure \ 1.87 + --prefix=%{l_prefix} \ 1.88 + --mandir=%{l_prefix}/man \ 1.89 + --sysconfdir=%{l_prefix}/etc/dhcpd \ 1.90 + --localstatedir=%{l_prefix}/var/dhcpd \ 1.91 + --with-srv-lease-file=%{l_prefix}/var/dhcpd/db/dhcpd.leases \ 1.92 + --with-cli-lease-file=%{l_prefix}/var/dhcpd/db/dhclient.leases \ 1.93 + --with-srv-pid-file=%{l_prefix}/var/dhcpd/run/dhcpd.pid \ 1.94 + --with-cli-pid-file=%{l_prefix}/var/dhcpd/run/dhclient.pid \ 1.95 + --with-relay-pid-file=%{l_prefix}/var/dhcpd/run/dhrelay.pid 1.96 + 1.97 + # build program 1.98 + %{l_make} %{l_mflags} 1.99 + 1.100 +%install 1.101 + # install program 1.102 + rm -rf $RPM_BUILD_ROOT 1.103 + %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT 1.104 + 1.105 + # install default configuration 1.106 + %{l_shtool} install -c -m 644 \ 1.107 + %{SOURCE dhcpd.conf} \ 1.108 + $RPM_BUILD_ROOT%{l_prefix}/etc/dhcpd/dhcpd.conf 1.109 + 1.110 + # post-adjust and strip down installation 1.111 + rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/dhclient-script 1.112 + rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/dhclient-script.8 1.113 + strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2>/dev/null || true 1.114 + strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true 1.115 + 1.116 + # install run-command script 1.117 + %{l_shtool} mkdir -f -p -m 755 \ 1.118 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d 1.119 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 1.120 + %{SOURCE rc.dhcpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 1.121 + 1.122 + # install OSSP fsl configuration 1.123 + %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl 1.124 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 1.125 + %{SOURCE fsl.dhcpd} \ 1.126 + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ 1.127 + 1.128 + # create run-time directories 1.129 + %{l_shtool} mkdir -f -p -m 755 \ 1.130 + $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/db \ 1.131 + $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/run \ 1.132 + $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/log 1.133 + 1.134 + # determine installation files 1.135 + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 1.136 + %{l_files_std} \ 1.137 + '%config %{l_prefix}/etc/fsl/fsl.dhcpd' \ 1.138 + '%config %{l_prefix}/etc/dhcpd/*' 1.139 + 1.140 +%files -f files 1.141 + 1.142 +%clean 1.143 + rm -rf $RPM_BUILD_ROOT 1.144 + 1.145 +%post 1.146 + if [ $1 -eq 1 ]; then 1.147 + # display final hints on initial installation 1.148 + ( echo "Before starting DHCP daemon, please set the configuration variable" 1.149 + echo "\"dhcpd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the" 1.150 + echo "used network interface." 1.151 + ) | %{l_rpmtool} msg -b -t notice 1.152 + fi 1.153 + 1.154 + # after upgrade, restart service 1.155 + [ $1 -eq 2 ] || exit 0 1.156 + eval `%{l_rc} dhcpd status 2>/dev/null` 1.157 + [ ".$dhcpd_active" = .yes ] && %{l_rc} dhcpd restart 1.158 + exit 0 1.159 + 1.160 +%preun 1.161 + # before erase, stop service and remove log files 1.162 + [ $1 -eq 0 ] || exit 0 1.163 + %{l_rc} dhcpd stop 2>/dev/null 1.164 + rm -f $RPM_INSTALL_PREFIX/var/dhcpd/db/* >/dev/null 2>&1 || true 1.165 + rm -f $RPM_INSTALL_PREFIX/var/dhcpd/run/* >/dev/null 2>&1 || true 1.166 + exit 0 1.167 +