michael@686: ## michael@686: ## dhcpd.spec -- OpenPKG RPM Package Specification michael@686: ## Copyright (c) 2000-2011 OpenPKG Foundation e.V. michael@686: ## michael@686: ## Permission to use, copy, modify, and distribute this software for michael@686: ## any purpose with or without fee is hereby granted, provided that michael@686: ## the above copyright notice and this permission notice appear in all michael@686: ## copies. michael@686: ## michael@686: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED michael@686: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@686: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@686: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@686: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@686: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@686: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@686: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@686: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@686: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@686: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@686: ## SUCH DAMAGE. michael@686: ## michael@686: michael@686: # package version michael@687: %define V_opkg 4.2.4 michael@687: %define V_dist 4.2.4 michael@686: michael@686: # package information michael@686: Name: dhcpd michael@686: Summary: DHCP Daemon michael@686: URL: http://www.isc.org/products/DHCP/ michael@686: Vendor: Internet Software Consortium michael@686: Packager: OpenPKG Foundation e.V. michael@686: Distribution: OpenPKG Community michael@686: Class: BASE michael@686: Group: DHCP michael@686: License: ISC/BSD michael@686: Version: %{V_opkg} michael@687: Release: 20120800 michael@686: michael@686: # package options michael@686: %option with_fsl yes michael@686: michael@686: # list of sources michael@686: Source0: ftp://ftp.isc.org/isc/dhcp/dhcp-%{V_dist}/dhcp-%{V_dist}.tar.gz michael@686: Source1: dhcpd.conf michael@686: Source2: rc.dhcpd michael@686: Source3: fsl.dhcpd michael@686: Patch0: dhcpd.patch michael@686: michael@686: # build information michael@687: BuildPreReq: OpenPKG, openpkg >= 20100101, make michael@686: PreReq: OpenPKG, openpkg >= 20100101 michael@686: BuildPreReq: openssl michael@686: PreReq: openssl michael@686: %if "%{with_fsl}" == "yes" michael@686: BuildPreReq: fsl michael@686: PreReq: fsl michael@686: %endif michael@686: michael@686: %description michael@686: This is the ISC DHCP daemon reference implementation. michael@686: michael@686: %track michael@686: prog dhcpd = { michael@686: version = %{V_dist} michael@686: url = ftp://ftp.isc.org/isc/dhcp/ michael@686: regex = dhcp-(\d+\.\d+\.\d+) michael@686: } michael@686: michael@686: %prep michael@686: %setup -q -n dhcp-%{V_dist} michael@686: %patch -p0 michael@686: michael@686: %build michael@686: # configure program michael@686: %{l_shtool} subst \ michael@686: -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_PID[^"]*\).*;\1 "%{l_prefix}/var/dhcpd/run/dhcpd.pid";' \ michael@686: -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_DB[^"]*\).*;\1 "%{l_prefix}/var/dhcpd/db/dhcpd.leases";' \ michael@686: -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_CONF[^"]*\).*;\1 "%{l_prefix}/etc/dhcpd/dhcpd.conf";' \ michael@686: includes/site.h michael@687: confopts='' michael@687: case "%{l_platform -t}" in michael@687: *-sunos5.11 ) michael@687: confopts='--enable-use-sockets --enable-ipv4-pktinfo' michael@687: ;; michael@687: esac michael@686: CC="%{l_cc}" \ michael@686: CFLAGS="%{l_cflags -O}" \ michael@686: CPPFLAGS="%{l_cppflags} -DNOMINUM" \ michael@686: LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \ michael@686: LIBS="%{l_fsl_libs}" \ michael@686: ./configure \ michael@686: --prefix=%{l_prefix} \ michael@686: --mandir=%{l_prefix}/man \ michael@686: --sysconfdir=%{l_prefix}/etc/dhcpd \ michael@686: --localstatedir=%{l_prefix}/var/dhcpd \ michael@687: $confopts \ michael@686: --with-srv-lease-file=%{l_prefix}/var/dhcpd/db/dhcpd.leases \ michael@686: --with-cli-lease-file=%{l_prefix}/var/dhcpd/db/dhclient.leases \ michael@686: --with-srv-pid-file=%{l_prefix}/var/dhcpd/run/dhcpd.pid \ michael@686: --with-cli-pid-file=%{l_prefix}/var/dhcpd/run/dhclient.pid \ michael@687: --with-relay-pid-file=%{l_prefix}/var/dhcpd/run/dhrelay.pid michael@686: michael@686: # build program michael@687: %{l_make} %{l_mflags -O} michael@686: michael@686: %install michael@686: # install program michael@686: %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT michael@686: michael@686: # install default configuration michael@686: %{l_shtool} install -c -m 644 \ michael@686: %{SOURCE dhcpd.conf} \ michael@686: $RPM_BUILD_ROOT%{l_prefix}/etc/dhcpd/dhcpd.conf michael@686: michael@686: # post-adjust and strip down installation michael@686: rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/dhclient-script michael@686: rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/dhclient-script.8 michael@686: strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2>/dev/null || true michael@686: strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true michael@686: michael@686: # install run-command script michael@686: %{l_shtool} mkdir -f -p -m 755 \ michael@686: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d michael@686: %{l_shtool} install -c -m 755 %{l_value -s -a} \ michael@686: %{SOURCE rc.dhcpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ michael@686: michael@686: # install OSSP fsl configuration michael@686: %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl michael@686: %{l_shtool} install -c -m 644 %{l_value -s -a} \ michael@686: %{SOURCE fsl.dhcpd} \ michael@686: $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ michael@686: michael@686: # create run-time directories michael@686: %{l_shtool} mkdir -f -p -m 755 \ michael@686: $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/db \ michael@686: $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/run \ michael@686: $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/log michael@686: michael@686: # determine installation files michael@686: %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ michael@686: %{l_files_std} \ michael@686: '%config %{l_prefix}/etc/fsl/fsl.dhcpd' \ michael@686: '%config %{l_prefix}/etc/dhcpd/*' michael@686: michael@686: %files -f files michael@686: michael@686: %clean michael@686: michael@686: %post michael@686: if [ $1 -eq 1 ]; then michael@686: # display final hints on initial installation michael@686: ( echo "Before starting DHCP daemon, please set the configuration variable" michael@686: echo "\"dhcpd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the" michael@686: echo "used network interface." michael@686: ) | %{l_rpmtool} msg -b -t notice michael@686: fi michael@686: michael@686: # after upgrade, restart service michael@686: [ $1 -eq 2 ] || exit 0 michael@686: eval `%{l_rc} dhcpd status 2>/dev/null` michael@686: [ ".$dhcpd_active" = .yes ] && %{l_rc} dhcpd restart michael@686: exit 0 michael@686: michael@686: %preun michael@686: # before erase, stop service and remove log files michael@686: [ $1 -eq 0 ] || exit 0 michael@686: %{l_rc} dhcpd stop 2>/dev/null michael@686: rm -f $RPM_INSTALL_PREFIX/var/dhcpd/db/* >/dev/null 2>&1 || true michael@686: rm -f $RPM_INSTALL_PREFIX/var/dhcpd/run/* >/dev/null 2>&1 || true michael@686: exit 0 michael@686: