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