michael@64: ## michael@64: ## arpwatch.spec -- OpenPKG RPM Specification michael@571: ## Copyright (c) 2012 Michael Schloh von Bennewitz michael@64: ## michael@64: ## Permission to use, copy, modify, and distribute this software for michael@64: ## any purpose with or without fee is hereby granted, provided that michael@64: ## the above copyright notice and this permission notice appear in all michael@64: ## copies. michael@64: ## michael@64: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED michael@64: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@64: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@64: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@64: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@64: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@64: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@64: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@64: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@64: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@64: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@64: ## SUCH DAMAGE. michael@64: ## michael@64: michael@64: # package information michael@64: Name: arpwatch michael@64: Summary: Ethernet Address Monitor Program michael@64: URL: http://ee.lbl.gov/ michael@64: Vendor: Craig Leres michael@64: Packager: Michael Schloh von Bennewitz michael@387: Distribution: Europalab Networks Production michael@64: Class: EVAL michael@64: Group: Network michael@64: License: GPL michael@64: Version: 2.1a15 michael@571: Release: 20120800 michael@64: michael@64: # package options michael@64: %option with_fsl yes michael@64: michael@64: # list of sources michael@571: Source0: ftp://ftp.ee.lbl.gov/arpwatch-%{version}.tar.gz michael@64: Source1: rc.arpwatch michael@64: Source2: fsl.arpwatch michael@64: Patch0: arpwatch.patch michael@64: michael@64: # build information michael@571: BuildPreReq: OpenPKG, openpkg >= 20100101, libpcap, make michael@571: PreReq: OpenPKG, openpkg >= 20100101, libpcap michael@571: PreReq: MTA michael@64: %if "%{with_fsl}" == "yes" michael@64: BuildPreReq: fsl >= 1.2.0 michael@64: PreReq: fsl >= 1.2.0 michael@64: %endif michael@64: michael@64: %description michael@64: The arpwatch daemon monitors ethernet or fddi activity michael@64: and maintains a database of ethernet/ip address pairings. michael@64: It reports certain changes via email as well. michael@64: michael@64: %track michael@64: prog arpwatch = { michael@64: version = %{version} michael@64: url = ftp://ftp.ee.lbl.gov/ michael@571: regex = arpwatch-(__VER__)\.tar\.gz michael@64: } michael@64: michael@64: %prep michael@64: %setup -q michael@64: %patch -p0 michael@64: michael@64: # supply more detailed file path information michael@64: %{l_shtool} subst %{l_value -s l_prefix} \ michael@64: arpwatch.8 \ michael@64: arpsnmp.8 michael@64: michael@64: %build michael@64: # query for platform specific libraries michael@64: loclibs="" michael@64: case "%{l_platform -t}" in michael@64: *-sunos* ) loclibs="-lsocket -lnsl" ;; michael@64: esac michael@64: michael@64: # run the autoconf(1) generated configuration logic michael@64: CC="%{l_cc}" \ michael@64: CFLAGS="%{l_cflags -O}" \ michael@64: CPPFLAGS="%{l_cppflags}" \ michael@64: LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \ michael@64: LIBS="%{l_fsl_libs} $loclibs" \ michael@571: V_SENDMAIL=%{l_prefix}/sbin/sendmail \ michael@64: ./configure \ michael@64: --prefix=%{l_prefix} \ michael@64: --localstatedir=%{l_prefix}/var/arpwatch/run michael@64: michael@64: # run the native build logic using parallel make michael@64: %{l_make} %{l_mflags -O} michael@64: michael@64: %install michael@64: # create installation hierarchy michael@64: %{l_shtool} mkdir -f -p -m 755 \ michael@64: $RPM_BUILD_ROOT%{l_prefix}/sbin \ michael@64: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ michael@64: $RPM_BUILD_ROOT%{l_prefix}/man/man8 \ michael@64: $RPM_BUILD_ROOT%{l_prefix}/var/arpwatch/log \ michael@64: $RPM_BUILD_ROOT%{l_prefix}/var/arpwatch/run michael@64: michael@64: # run the native installation logic michael@64: %{l_make} %{l_mflags} install install-man install-data DESTDIR=$RPM_BUILD_ROOT michael@64: michael@64: # install runcommand script michael@64: %{l_shtool} install -c -m 755 %{l_value -s -a} \ michael@64: %{SOURCE rc.arpwatch} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ michael@64: michael@64: # install OSSP fsl configuration michael@64: %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl michael@64: %{l_shtool} install -c -m 644 %{l_value -s -a} \ michael@64: %{SOURCE fsl.arpwatch} \ michael@64: $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ michael@64: michael@64: # determine installation files michael@64: %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ michael@64: %{l_files_std} \ michael@64: '%not %dir %{l_prefix}/etc/fsl' \ michael@64: '%config %{l_prefix}/etc/fsl/fsl.arpwatch' michael@64: michael@64: %files -f files michael@64: michael@64: %clean michael@64: michael@64: %pre michael@64: # before upgrading package, record runtime status and stop service michael@64: [ $1 -eq 2 ] || exit 0 michael@64: eval `%{l_rc} arpwatch status 2>/dev/null | tee %{l_tmpfile}` michael@64: %{l_rc} arpwatch stop 2>/dev/null michael@64: exit 0 michael@64: michael@64: %post michael@64: if [ $1 -eq 1 ]; then michael@690: # after installing package, install codes and initial arp database michael@64: %{l_shtool} install -c -o %{l_musr} -g %{l_mgrp} -m 644 \ michael@571: %{_builddir}/arpwatch-%{version}/ethercodes.dat \ michael@64: $RPM_INSTALL_PREFIX/var/arpwatch/run/ michael@690: %{l_shtool} install -c -o %{l_musr} -g %{l_mgrp} -m 644 \ michael@690: /dev/null $RPM_INSTALL_PREFIX/var/arpwatch/run/arp.dat michael@64: michael@64: # after installing package, announce security provision lo0 michael@64: ( echo "Before starting the arpwatch daemon, set the config variables" michael@64: echo "\"arpwatch_iface\" and \"arpwatch_ipnet\" in $RPM_INSTALL_PREFIX/etc/rc.conf to" michael@64: echo "describe the network interface and block(s) to be monitored." michael@64: ) | %{l_rpmtool} msg -b -t notice michael@64: fi michael@64: if [ $1 -eq 2 ]; then michael@64: # after upgrading package, restore runtime status michael@64: eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} >/dev/null 2>&1 || true michael@64: [ ".$arpwatch_active" = .yes ] && %{l_rc} arpwatch start michael@64: fi michael@64: exit 0 michael@64: michael@64: %preun michael@64: # before removing package, stop service and remove log files michael@64: [ $1 -eq 0 ] || exit 0 michael@64: %{l_rc} arpwatch stop 2>/dev/null michael@64: rm -f $RPM_INSTALL_PREFIX/var/arpwatch/log/* >/dev/null 2>&1 || true michael@64: rm -f $RPM_INSTALL_PREFIX/var/arpwatch/run/* >/dev/null 2>&1 || true michael@64: exit 0 michael@64: