dhcpd/dhcpd.spec

changeset 686
8402f4294f85
child 687
7d33a70799f3
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dhcpd/dhcpd.spec	Mon Sep 17 19:05:03 2012 +0200
     1.3 @@ -0,0 +1,167 @@
     1.4 +##
     1.5 +##  dhcpd.spec -- OpenPKG RPM Package Specification
     1.6 +##  Copyright (c) 2000-2011 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 version
    1.28 +%define       V_opkg 4.2.3
    1.29 +%define       V_dist 4.2.3
    1.30 +
    1.31 +#   package information
    1.32 +Name:         dhcpd
    1.33 +Summary:      DHCP Daemon
    1.34 +URL:          http://www.isc.org/products/DHCP/
    1.35 +Vendor:       Internet Software Consortium
    1.36 +Packager:     OpenPKG Foundation e.V.
    1.37 +Distribution: OpenPKG Community
    1.38 +Class:        BASE
    1.39 +Group:        DHCP
    1.40 +License:      ISC/BSD
    1.41 +Version:      %{V_opkg}
    1.42 +Release:      20111211
    1.43 +
    1.44 +#   package options
    1.45 +%option       with_fsl  yes
    1.46 +
    1.47 +#   list of sources
    1.48 +Source0:      ftp://ftp.isc.org/isc/dhcp/dhcp-%{V_dist}/dhcp-%{V_dist}.tar.gz
    1.49 +Source1:      dhcpd.conf
    1.50 +Source2:      rc.dhcpd
    1.51 +Source3:      fsl.dhcpd
    1.52 +Patch0:       dhcpd.patch
    1.53 +
    1.54 +#   build information
    1.55 +BuildPreReq:  OpenPKG, openpkg >= 20100101
    1.56 +PreReq:       OpenPKG, openpkg >= 20100101
    1.57 +BuildPreReq:  openssl
    1.58 +PreReq:       openssl
    1.59 +%if "%{with_fsl}" == "yes"
    1.60 +BuildPreReq:  fsl
    1.61 +PreReq:       fsl
    1.62 +%endif
    1.63 +
    1.64 +%description
    1.65 +    This is the ISC DHCP daemon reference implementation.
    1.66 +
    1.67 +%track
    1.68 +    prog dhcpd = {
    1.69 +        version   = %{V_dist}
    1.70 +        url       = ftp://ftp.isc.org/isc/dhcp/
    1.71 +        regex     = dhcp-(\d+\.\d+\.\d+)
    1.72 +    }
    1.73 +
    1.74 +%prep
    1.75 +    %setup -q -n dhcp-%{V_dist}
    1.76 +    %patch -p0
    1.77 +
    1.78 +%build
    1.79 +    #   configure program
    1.80 +    %{l_shtool} subst \
    1.81 +        -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_PID[^"]*\).*;\1 "%{l_prefix}/var/dhcpd/run/dhcpd.pid";' \
    1.82 +        -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_DB[^"]*\).*;\1 "%{l_prefix}/var/dhcpd/db/dhcpd.leases";' \
    1.83 +        -e 's;^[^#]*\(#define[^_]*_PATH_DHCPD_CONF[^"]*\).*;\1 "%{l_prefix}/etc/dhcpd/dhcpd.conf";' \
    1.84 +        includes/site.h
    1.85 +    CC="%{l_cc}" \
    1.86 +    CFLAGS="%{l_cflags -O}" \
    1.87 +    CPPFLAGS="%{l_cppflags} -DNOMINUM" \
    1.88 +    LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
    1.89 +    LIBS="%{l_fsl_libs}" \
    1.90 +    ./configure \
    1.91 +        --prefix=%{l_prefix} \
    1.92 +        --mandir=%{l_prefix}/man \
    1.93 +        --sysconfdir=%{l_prefix}/etc/dhcpd \
    1.94 +        --localstatedir=%{l_prefix}/var/dhcpd \
    1.95 +        --with-srv-lease-file=%{l_prefix}/var/dhcpd/db/dhcpd.leases \
    1.96 +        --with-cli-lease-file=%{l_prefix}/var/dhcpd/db/dhclient.leases \
    1.97 +        --with-srv-pid-file=%{l_prefix}/var/dhcpd/run/dhcpd.pid \
    1.98 +        --with-cli-pid-file=%{l_prefix}/var/dhcpd/run/dhclient.pid \
    1.99 +        --with-relay-pid-file=%{l_prefix}/var/dhcpd/run/dhrelay.pid \
   1.100 +        --disable-dhcpv6
   1.101 +
   1.102 +    #   build program
   1.103 +    %{l_make} %{l_mflags}
   1.104 +
   1.105 +%install
   1.106 +    #   install program
   1.107 +    %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   1.108 +
   1.109 +    #   install default configuration
   1.110 +    %{l_shtool} install -c -m 644 \
   1.111 +        %{SOURCE dhcpd.conf} \
   1.112 +        $RPM_BUILD_ROOT%{l_prefix}/etc/dhcpd/dhcpd.conf
   1.113 +
   1.114 +    #   post-adjust and strip down installation
   1.115 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/dhclient-script
   1.116 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/dhclient-script.8
   1.117 +    strip $RPM_BUILD_ROOT%{l_prefix}/bin/*  2>/dev/null || true
   1.118 +    strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true
   1.119 +
   1.120 +    #   install run-command script
   1.121 +    %{l_shtool} mkdir -f -p -m 755 \
   1.122 +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   1.123 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   1.124 +        %{SOURCE rc.dhcpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   1.125 +
   1.126 +    #   install OSSP fsl configuration
   1.127 +    %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   1.128 +    %{l_shtool} install -c -m 644 %{l_value -s -a} \
   1.129 +        %{SOURCE fsl.dhcpd} \
   1.130 +        $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   1.131 +
   1.132 +    #   create run-time directories
   1.133 +    %{l_shtool} mkdir -f -p -m 755 \
   1.134 +        $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/db \
   1.135 +        $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/run \
   1.136 +        $RPM_BUILD_ROOT%{l_prefix}/var/dhcpd/log
   1.137 +
   1.138 +    #   determine installation files
   1.139 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   1.140 +        %{l_files_std} \
   1.141 +        '%config %{l_prefix}/etc/fsl/fsl.dhcpd' \
   1.142 +        '%config %{l_prefix}/etc/dhcpd/*'
   1.143 +
   1.144 +%files -f files
   1.145 +
   1.146 +%clean
   1.147 +
   1.148 +%post
   1.149 +    if [ $1 -eq 1 ]; then
   1.150 +        #   display final hints on initial installation
   1.151 +        ( echo "Before starting DHCP daemon, please set the configuration variable"
   1.152 +          echo "\"dhcpd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the"
   1.153 +          echo "used network interface."
   1.154 +        ) | %{l_rpmtool} msg -b -t notice
   1.155 +    fi
   1.156 +
   1.157 +    #   after upgrade, restart service
   1.158 +    [ $1 -eq 2 ] || exit 0
   1.159 +    eval `%{l_rc} dhcpd status 2>/dev/null`
   1.160 +    [ ".$dhcpd_active" = .yes ] && %{l_rc} dhcpd restart
   1.161 +    exit 0
   1.162 +
   1.163 +%preun
   1.164 +    #   before erase, stop service and remove log files
   1.165 +    [ $1 -eq 0 ] || exit 0
   1.166 +    %{l_rc} dhcpd stop 2>/dev/null
   1.167 +    rm -f $RPM_INSTALL_PREFIX/var/dhcpd/db/*  >/dev/null 2>&1 || true
   1.168 +    rm -f $RPM_INSTALL_PREFIX/var/dhcpd/run/* >/dev/null 2>&1 || true
   1.169 +    exit 0
   1.170 +

mercurial