dhcpd/dhcpd.spec

Mon, 17 Sep 2012 19:05:03 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 17 Sep 2012 19:05:03 +0200
changeset 686
8402f4294f85
child 687
7d33a70799f3
permissions
-rw-r--r--

Import package vendor original spec for necessary manipulations.

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

mercurial