1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/arpd/arpd.spec Thu Oct 04 20:26:02 2012 +0200 1.3 @@ -0,0 +1,158 @@ 1.4 +## 1.5 +## arpd.spec -- OpenPKG RPM Package Specification 1.6 +## Copyright (c) 2000-2008 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 information 1.28 +Name: arpd 1.29 +Summary: Address Resolution Protocol (ARP) Reply Daemon 1.30 +URL: http://www.honeyd.org/tools.php 1.31 +Vendor: Niels Provos, Dug Song 1.32 +Packager: OpenPKG Foundation e.V. 1.33 +Distribution: OpenPKG Community 1.34 +Class: EVAL 1.35 +Group: Mapping 1.36 +License: GNU 1.37 +Version: 0.2 1.38 +Release: 20080101 1.39 + 1.40 +# package options 1.41 +%option with_fsl yes 1.42 + 1.43 +# list of sources 1.44 +Source0: http://www.citi.umich.edu/u/provos/honeyd/arpd-%{version}.tar.gz 1.45 +Source1: rc.arpd 1.46 +Source2: fsl.arpd 1.47 +Patch0: arpd.patch 1.48 + 1.49 +# build information 1.50 +Prefix: %{l_prefix} 1.51 +BuildRoot: %{l_buildroot} 1.52 +BuildPreReq: OpenPKG, openpkg >= 20060823, libdnet, libpcap, libevent, gcc, make 1.53 +PreReq: OpenPKG, openpkg >= 20060823, libdnet, libpcap, libevent 1.54 +%if "%{with_fsl}" == "yes" 1.55 +BuildPreReq: fsl 1.56 +PreReq: fsl 1.57 +%endif 1.58 +AutoReq: no 1.59 +AutoReqProv: no 1.60 + 1.61 +%description 1.62 + Arpd is an Address Resolution Protocol (ARP) daemon which replies to 1.63 + any ARP request for an IP address matching the specified destination 1.64 + network with the hardware MAC address of the own interface, but only 1.65 + after determining if another host already claims it. Any IP address 1.66 + claimed by arpd is eventually forgotten after a period of inactivity 1.67 + or after a hard timeout, and is relinquished if the real owner shows 1.68 + up. This enables a single host to claim all unassigned addresses on 1.69 + a LAN for network monitoring or simulation. 1.70 + 1.71 +%track 1.72 + prog arpd = { 1.73 + version = %{version} 1.74 + url = http://www.honeyd.org/tools.php 1.75 + regex = arpd-(__VER__)\.tar\.gz 1.76 + } 1.77 + 1.78 +%prep 1.79 + %setup -q -n arpd 1.80 + %patch -p0 1.81 + %{l_shtool} subst \ 1.82 + -e 's;LIBS=$DNETLIB;LIBS="$LIBS $DNETLIB";' \ 1.83 + -e 's;CFLAGS=$DNETINC;CFLAGS="$CFLAGS $DNETINC";' \ 1.84 + -e 's;net/bpf\.h;pcap-bpf.h;g' \ 1.85 + configure 1.86 + %{l_shtool} subst \ 1.87 + -e 's;/var/run/arpd.pid;%{l_prefix}/var/arpd/arpd.pid;' \ 1.88 + arpd.c arpd.8 1.89 + 1.90 +%build 1.91 + CC="%{l_cc}" \ 1.92 + CFLAGS="%{l_cflags -O}" \ 1.93 + CPPFLAGS="%{l_cppflags}" \ 1.94 + LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \ 1.95 + LIBS="%{l_fsl_libs} -lpcap" \ 1.96 + ./configure \ 1.97 + --prefix=%{l_prefix} \ 1.98 + --with-libdnet=%{l_prefix} \ 1.99 + --with-libpcap=%{l_prefix} \ 1.100 + --with-libevent=%{l_prefix} 1.101 + %{l_make} %{l_mflags} 1.102 + 1.103 +%install 1.104 + rm -rf $RPM_BUILD_ROOT 1.105 + 1.106 + # create directories 1.107 + %{l_shtool} mkdir -f -p -m 755 \ 1.108 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ 1.109 + $RPM_BUILD_ROOT%{l_prefix}/var/arpd 1.110 + 1.111 + # install files 1.112 + %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT 1.113 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 1.114 + %{SOURCE rc.arpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 1.115 + 1.116 + # install OSSP fsl configuration 1.117 + %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl 1.118 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 1.119 + %{SOURCE fsl.arpd} \ 1.120 + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ 1.121 + 1.122 + # determine file list 1.123 + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 1.124 + %{l_files_std} \ 1.125 + '%config %{l_prefix}/etc/fsl/fsl.arpd' \ 1.126 + '%attr(750,%{l_susr},%{l_mgrp}) %{l_prefix}/var/arpd' 1.127 + 1.128 +%files -f files 1.129 + 1.130 +%clean 1.131 + rm -rf $RPM_BUILD_ROOT 1.132 + 1.133 +%pre 1.134 + # before upgrade, save status and stop service 1.135 + [ $1 -eq 2 ] || exit 0 1.136 + eval `%{l_rc} arpd status 2>/dev/null | tee %{l_tmpfile}` 1.137 + %{l_rc} arpd stop 2>/dev/null 1.138 + exit 0 1.139 + 1.140 +%post 1.141 + if [ $1 -eq 1 ]; then 1.142 + # display final hints on initial installation 1.143 + ( echo "Before starting ARP daemon, please set the configuration variable" 1.144 + echo "\"arpd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the" 1.145 + echo "used network interface." 1.146 + ) | %{l_rpmtool} msg -b -t notice 1.147 + fi 1.148 + if [ $1 -eq 2 ]; then 1.149 + # after upgrade, restore status 1.150 + eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} 1.151 + [ ".$arpd_active" = .yes ] && %{l_rc} arpd start 1.152 + fi 1.153 + exit 0 1.154 + 1.155 +%preun 1.156 + # before erase, stop service and remove log files 1.157 + [ $1 -eq 0 ] || exit 0 1.158 + %{l_rc} arpd stop 2>/dev/null 1.159 + rm -f $RPM_INSTALL_PREFIX/var/arpd/*.log* >/dev/null 2>&1 || true 1.160 + exit 0 1.161 +