michael@714: ## michael@714: ## arpd.spec -- OpenPKG RPM Package Specification michael@714: ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. michael@714: ## michael@714: ## Permission to use, copy, modify, and distribute this software for michael@714: ## any purpose with or without fee is hereby granted, provided that michael@714: ## the above copyright notice and this permission notice appear in all michael@714: ## copies. michael@714: ## michael@714: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED michael@714: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@714: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@714: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@714: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@714: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@714: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@714: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@714: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@714: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@714: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@714: ## SUCH DAMAGE. michael@714: ## michael@714: michael@714: # package information michael@714: Name: arpd michael@714: Summary: Address Resolution Protocol (ARP) Reply Daemon michael@714: URL: http://www.honeyd.org/tools.php michael@714: Vendor: Niels Provos, Dug Song michael@714: Packager: OpenPKG Foundation e.V. michael@714: Distribution: OpenPKG Community michael@714: Class: EVAL michael@714: Group: Mapping michael@714: License: GNU michael@714: Version: 0.2 michael@715: Release: 20120800 michael@714: michael@714: # package options michael@714: %option with_fsl yes michael@714: michael@714: # list of sources michael@714: Source0: http://www.citi.umich.edu/u/provos/honeyd/arpd-%{version}.tar.gz michael@714: Source1: rc.arpd michael@714: Source2: fsl.arpd michael@714: Patch0: arpd.patch michael@714: michael@714: # build information michael@715: BuildPreReq: OpenPKG, openpkg >= 20100101, libdnet, libpcap, libevent, gcc, make michael@715: PreReq: OpenPKG, openpkg >= 20100101, libdnet, libpcap, libevent michael@714: %if "%{with_fsl}" == "yes" michael@714: BuildPreReq: fsl michael@714: PreReq: fsl michael@714: %endif michael@714: michael@714: %description michael@714: Arpd is an Address Resolution Protocol (ARP) daemon which replies to michael@714: any ARP request for an IP address matching the specified destination michael@714: network with the hardware MAC address of the own interface, but only michael@714: after determining if another host already claims it. Any IP address michael@714: claimed by arpd is eventually forgotten after a period of inactivity michael@714: or after a hard timeout, and is relinquished if the real owner shows michael@714: up. This enables a single host to claim all unassigned addresses on michael@714: a LAN for network monitoring or simulation. michael@714: michael@714: %track michael@714: prog arpd = { michael@714: version = %{version} michael@714: url = http://www.honeyd.org/tools.php michael@714: regex = arpd-(__VER__)\.tar\.gz michael@714: } michael@714: michael@714: %prep michael@714: %setup -q -n arpd michael@714: %patch -p0 michael@714: %{l_shtool} subst \ michael@714: -e 's;LIBS=$DNETLIB;LIBS="$LIBS $DNETLIB";' \ michael@714: -e 's;CFLAGS=$DNETINC;CFLAGS="$CFLAGS $DNETINC";' \ michael@714: -e 's;net/bpf\.h;pcap-bpf.h;g' \ michael@714: configure michael@714: %{l_shtool} subst \ michael@714: -e 's;/var/run/arpd.pid;%{l_prefix}/var/arpd/arpd.pid;' \ michael@714: arpd.c arpd.8 michael@714: michael@714: %build michael@714: CC="%{l_cc}" \ michael@714: CFLAGS="%{l_cflags -O}" \ michael@714: CPPFLAGS="%{l_cppflags}" \ michael@714: LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \ michael@714: LIBS="%{l_fsl_libs} -lpcap" \ michael@714: ./configure \ michael@714: --prefix=%{l_prefix} \ michael@714: --with-libdnet=%{l_prefix} \ michael@714: --with-libpcap=%{l_prefix} \ michael@714: --with-libevent=%{l_prefix} michael@714: %{l_make} %{l_mflags} michael@714: michael@714: %install michael@714: # create directories michael@714: %{l_shtool} mkdir -f -p -m 755 \ michael@714: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ michael@714: $RPM_BUILD_ROOT%{l_prefix}/var/arpd michael@714: michael@714: # install files michael@714: %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT michael@714: %{l_shtool} install -c -m 755 %{l_value -s -a} \ michael@714: %{SOURCE rc.arpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ michael@714: michael@714: # install OSSP fsl configuration michael@714: %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl michael@714: %{l_shtool} install -c -m 644 %{l_value -s -a} \ michael@714: %{SOURCE fsl.arpd} \ michael@714: $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ michael@714: michael@714: # determine file list michael@714: %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ michael@714: %{l_files_std} \ michael@714: '%config %{l_prefix}/etc/fsl/fsl.arpd' \ michael@714: '%attr(750,%{l_susr},%{l_mgrp}) %{l_prefix}/var/arpd' michael@714: michael@714: %files -f files michael@714: michael@714: %clean michael@714: michael@714: %pre michael@714: # before upgrade, save status and stop service michael@714: [ $1 -eq 2 ] || exit 0 michael@714: eval `%{l_rc} arpd status 2>/dev/null | tee %{l_tmpfile}` michael@714: %{l_rc} arpd stop 2>/dev/null michael@714: exit 0 michael@714: michael@714: %post michael@714: if [ $1 -eq 1 ]; then michael@714: # display final hints on initial installation michael@714: ( echo "Before starting ARP daemon, please set the configuration variable" michael@714: echo "\"arpd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the" michael@714: echo "used network interface." michael@714: ) | %{l_rpmtool} msg -b -t notice michael@714: fi michael@714: if [ $1 -eq 2 ]; then michael@714: # after upgrade, restore status michael@714: eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} michael@714: [ ".$arpd_active" = .yes ] && %{l_rc} arpd start michael@714: fi michael@714: exit 0 michael@714: michael@714: %preun michael@714: # before erase, stop service and remove log files michael@714: [ $1 -eq 0 ] || exit 0 michael@714: %{l_rc} arpd stop 2>/dev/null michael@714: rm -f $RPM_INSTALL_PREFIX/var/arpd/*.log* >/dev/null 2>&1 || true michael@714: exit 0 michael@714: