1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/arpwatch/arpwatch.spec Fri Jan 09 19:02:45 2009 +0100 1.3 @@ -0,0 +1,176 @@ 1.4 +## 1.5 +## arpwatch.spec -- OpenPKG RPM Specification 1.6 +## Copyright (c) 2009 Michael Schloh von Bennewitz <michael@schloh.com> 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 + 1.28 +# package information 1.29 +Name: arpwatch 1.30 +Summary: Ethernet Address Monitor Program 1.31 +URL: http://ee.lbl.gov/ 1.32 +Vendor: Craig Leres 1.33 +Packager: Michael Schloh von Bennewitz 1.34 +Distribution: MSvB Recherche Production 1.35 +Class: EVAL 1.36 +Group: Network 1.37 +License: GPL 1.38 +Version: 2.1a15 1.39 +Release: 20090106 1.40 + 1.41 +# package options 1.42 +%option with_fsl yes 1.43 + 1.44 +# list of sources 1.45 +Source0: ftp://ftp.ee.lbl.gov/arpwatch.tar.gz 1.46 +Source1: rc.arpwatch 1.47 +Source2: fsl.arpwatch 1.48 +Patch0: arpwatch.patch 1.49 + 1.50 +# build information 1.51 +Prefix: %{l_prefix} 1.52 +BuildRoot: %{l_buildroot} 1.53 +BuildPreReq: OpenPKG, openpkg >= 20040130, libpcap 1.54 +PreReq: OpenPKG, openpkg >= 20040130, libpcap 1.55 +%if "%{with_fsl}" == "yes" 1.56 +BuildPreReq: fsl >= 1.2.0 1.57 +PreReq: fsl >= 1.2.0 1.58 +%endif 1.59 +AutoReq: no 1.60 +AutoReqProv: no 1.61 + 1.62 +%description 1.63 + The arpwatch daemon monitors ethernet or fddi activity 1.64 + and maintains a database of ethernet/ip address pairings. 1.65 + It reports certain changes via email as well. 1.66 + 1.67 +%track 1.68 + prog arpwatch = { 1.69 + disabled 1.70 + comment = "msvb: tracking is disabled as sources are unversioned" 1.71 + version = %{version} 1.72 + url = ftp://ftp.ee.lbl.gov/ 1.73 + regex = arpwatch-\.tar\.gz 1.74 + } 1.75 + 1.76 +%prep 1.77 + %setup -q 1.78 + 1.79 + # before patching, correct unconsistent file modes 1.80 + chmod u+w * 1.81 + 1.82 + %patch -p0 1.83 + 1.84 + # supply more detailed file path information 1.85 + %{l_shtool} subst %{l_value -s l_prefix} \ 1.86 + arpwatch.8 \ 1.87 + arpsnmp.8 1.88 + 1.89 +%build 1.90 + # query for platform specific libraries 1.91 + loclibs="" 1.92 + case "%{l_platform -t}" in 1.93 + *-sunos* ) loclibs="-lsocket -lnsl" ;; 1.94 + esac 1.95 + 1.96 + # run the autoconf(1) generated configuration logic 1.97 + CC="%{l_cc}" \ 1.98 + CFLAGS="%{l_cflags -O}" \ 1.99 + CPPFLAGS="%{l_cppflags}" \ 1.100 + LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \ 1.101 + LIBS="%{l_fsl_libs} $loclibs" \ 1.102 + ./configure \ 1.103 + --prefix=%{l_prefix} \ 1.104 + --localstatedir=%{l_prefix}/var/arpwatch/run 1.105 + 1.106 + # run the native build logic using parallel make 1.107 + %{l_make} %{l_mflags -O} 1.108 + 1.109 +%install 1.110 + # remove previously existing installations 1.111 + rm -rf $RPM_BUILD_ROOT 1.112 + 1.113 + # create installation hierarchy 1.114 + %{l_shtool} mkdir -f -p -m 755 \ 1.115 + $RPM_BUILD_ROOT%{l_prefix}/sbin \ 1.116 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ 1.117 + $RPM_BUILD_ROOT%{l_prefix}/man/man8 \ 1.118 + $RPM_BUILD_ROOT%{l_prefix}/var/arpwatch/log \ 1.119 + $RPM_BUILD_ROOT%{l_prefix}/var/arpwatch/run 1.120 + 1.121 + # run the native installation logic 1.122 + %{l_make} %{l_mflags} install install-man install-data DESTDIR=$RPM_BUILD_ROOT 1.123 + 1.124 + # install runcommand script 1.125 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 1.126 + %{SOURCE rc.arpwatch} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 1.127 + 1.128 + # install OSSP fsl configuration 1.129 + %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl 1.130 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 1.131 + %{SOURCE fsl.arpwatch} \ 1.132 + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ 1.133 + 1.134 + # determine installation files 1.135 + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 1.136 + %{l_files_std} \ 1.137 + '%not %dir %{l_prefix}/etc/fsl' \ 1.138 + '%config %{l_prefix}/etc/fsl/fsl.arpwatch' 1.139 + 1.140 +%files -f files 1.141 + 1.142 +%clean 1.143 + rm -rf $RPM_BUILD_ROOT 1.144 + 1.145 +%pre 1.146 + # before upgrading package, record runtime status and stop service 1.147 + [ $1 -eq 2 ] || exit 0 1.148 + eval `%{l_rc} arpwatch status 2>/dev/null | tee %{l_tmpfile}` 1.149 + %{l_rc} arpwatch stop 2>/dev/null 1.150 + exit 0 1.151 + 1.152 +%post 1.153 + if [ $1 -eq 1 ]; then 1.154 + # after installing package, generate initial arp database 1.155 + %{l_shtool} install -c -o %{l_musr} -g %{l_mgrp} -m 644 \ 1.156 + %{_builddir}/arpwatch-%{version}/arp.dat \ 1.157 + $RPM_INSTALL_PREFIX/var/arpwatch/run/ 1.158 + 1.159 + # after installing package, announce security provision lo0 1.160 + ( echo "Before starting the arpwatch daemon, set the config variables" 1.161 + echo "\"arpwatch_iface\" and \"arpwatch_ipnet\" in $RPM_INSTALL_PREFIX/etc/rc.conf to" 1.162 + echo "describe the network interface and block(s) to be monitored." 1.163 + ) | %{l_rpmtool} msg -b -t notice 1.164 + fi 1.165 + if [ $1 -eq 2 ]; then 1.166 + # after upgrading package, restore runtime status 1.167 + eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} >/dev/null 2>&1 || true 1.168 + [ ".$arpwatch_active" = .yes ] && %{l_rc} arpwatch start 1.169 + fi 1.170 + exit 0 1.171 + 1.172 +%preun 1.173 + # before removing package, stop service and remove log files 1.174 + [ $1 -eq 0 ] || exit 0 1.175 + %{l_rc} arpwatch stop 2>/dev/null 1.176 + rm -f $RPM_INSTALL_PREFIX/var/arpwatch/log/* >/dev/null 2>&1 || true 1.177 + rm -f $RPM_INSTALL_PREFIX/var/arpwatch/run/* >/dev/null 2>&1 || true 1.178 + exit 0 1.179 +