dhcpd/dhcpd.spec

Thu, 04 Oct 2012 20:30:05 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 04 Oct 2012 20:30:05 +0200
changeset 715
c10fb90893b9
parent 686
8402f4294f85
permissions
-rw-r--r--

Correct out of date build configuration, porting to Solaris 11 network
link infrastructure and new libpcap logic. This additionally allows for
device drivers in subdirectories of /dev. Correct packaged nmap
personalities and signatures to work out of the box. Finally, hack
arpd logic to properly close sockets and quit on TERM by repeating
signaling in the run command script. Sadly, all this fails to correct
the run time behaviour of honeyd which fails to bind to the IP layer.

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

mercurial