Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
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@687 | 25 | %define V_opkg 4.2.4 |
michael@687 | 26 | %define V_dist 4.2.4 |
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@687 | 39 | Release: 20120800 |
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@687 | 52 | BuildPreReq: OpenPKG, openpkg >= 20100101, make |
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@687 | 82 | confopts='' |
michael@687 | 83 | case "%{l_platform -t}" in |
michael@687 | 84 | *-sunos5.11 ) |
michael@687 | 85 | confopts='--enable-use-sockets --enable-ipv4-pktinfo' |
michael@687 | 86 | ;; |
michael@687 | 87 | esac |
michael@686 | 88 | CC="%{l_cc}" \ |
michael@686 | 89 | CFLAGS="%{l_cflags -O}" \ |
michael@686 | 90 | CPPFLAGS="%{l_cppflags} -DNOMINUM" \ |
michael@686 | 91 | LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \ |
michael@686 | 92 | LIBS="%{l_fsl_libs}" \ |
michael@686 | 93 | ./configure \ |
michael@686 | 94 | --prefix=%{l_prefix} \ |
michael@686 | 95 | --mandir=%{l_prefix}/man \ |
michael@686 | 96 | --sysconfdir=%{l_prefix}/etc/dhcpd \ |
michael@686 | 97 | --localstatedir=%{l_prefix}/var/dhcpd \ |
michael@687 | 98 | $confopts \ |
michael@686 | 99 | --with-srv-lease-file=%{l_prefix}/var/dhcpd/db/dhcpd.leases \ |
michael@686 | 100 | --with-cli-lease-file=%{l_prefix}/var/dhcpd/db/dhclient.leases \ |
michael@686 | 101 | --with-srv-pid-file=%{l_prefix}/var/dhcpd/run/dhcpd.pid \ |
michael@686 | 102 | --with-cli-pid-file=%{l_prefix}/var/dhcpd/run/dhclient.pid \ |
michael@687 | 103 | --with-relay-pid-file=%{l_prefix}/var/dhcpd/run/dhrelay.pid |
michael@686 | 104 | |
michael@686 | 105 | # build program |
michael@687 | 106 | %{l_make} %{l_mflags -O} |
michael@686 | 107 | |
michael@686 | 108 | %install |
michael@686 | 109 | # install program |
michael@686 | 110 | %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT |
michael@686 | 111 | |
michael@686 | 112 | # install default configuration |
michael@686 | 113 | %{l_shtool} install -c -m 644 \ |
michael@686 | 114 | %{SOURCE dhcpd.conf} \ |
michael@686 | 115 | $RPM_BUILD_ROOT%{l_prefix}/etc/dhcpd/dhcpd.conf |
michael@686 | 116 | |
michael@686 | 117 | # post-adjust and strip down installation |
michael@686 | 118 | rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/dhclient-script |
michael@686 | 119 | rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/dhclient-script.8 |
michael@686 | 120 | strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2>/dev/null || true |
michael@686 | 121 | strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true |
michael@686 | 122 | |
michael@686 | 123 | # install run-command script |
michael@686 | 124 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@686 | 125 | $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d |
michael@686 | 126 | %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
michael@686 | 127 | %{SOURCE rc.dhcpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
michael@686 | 128 | |
michael@686 | 129 | # install OSSP fsl configuration |
michael@686 | 130 | %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl |
michael@686 | 131 | %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
michael@686 | 132 | %{SOURCE fsl.dhcpd} \ |
michael@686 | 133 | $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ |
michael@686 | 134 | |
michael@686 | 135 | # create run-time directories |
michael@686 | 136 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@686 | 137 | $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/db \ |
michael@686 | 138 | $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/run \ |
michael@686 | 139 | $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/log |
michael@686 | 140 | |
michael@686 | 141 | # determine installation files |
michael@686 | 142 | %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
michael@686 | 143 | %{l_files_std} \ |
michael@686 | 144 | '%config %{l_prefix}/etc/fsl/fsl.dhcpd' \ |
michael@686 | 145 | '%config %{l_prefix}/etc/dhcpd/*' |
michael@686 | 146 | |
michael@686 | 147 | %files -f files |
michael@686 | 148 | |
michael@686 | 149 | %clean |
michael@686 | 150 | |
michael@686 | 151 | %post |
michael@686 | 152 | if [ $1 -eq 1 ]; then |
michael@686 | 153 | # display final hints on initial installation |
michael@686 | 154 | ( echo "Before starting DHCP daemon, please set the configuration variable" |
michael@686 | 155 | echo "\"dhcpd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the" |
michael@686 | 156 | echo "used network interface." |
michael@686 | 157 | ) | %{l_rpmtool} msg -b -t notice |
michael@686 | 158 | fi |
michael@686 | 159 | |
michael@686 | 160 | # after upgrade, restart service |
michael@686 | 161 | [ $1 -eq 2 ] || exit 0 |
michael@686 | 162 | eval `%{l_rc} dhcpd status 2>/dev/null` |
michael@686 | 163 | [ ".$dhcpd_active" = .yes ] && %{l_rc} dhcpd restart |
michael@686 | 164 | exit 0 |
michael@686 | 165 | |
michael@686 | 166 | %preun |
michael@686 | 167 | # before erase, stop service and remove log files |
michael@686 | 168 | [ $1 -eq 0 ] || exit 0 |
michael@686 | 169 | %{l_rc} dhcpd stop 2>/dev/null |
michael@686 | 170 | rm -f $RPM_INSTALL_PREFIX/var/dhcpd/db/* >/dev/null 2>&1 || true |
michael@686 | 171 | rm -f $RPM_INSTALL_PREFIX/var/dhcpd/run/* >/dev/null 2>&1 || true |
michael@686 | 172 | exit 0 |
michael@686 | 173 |