Miroslav Lichvar 6ced79
%define _vararpwatch %{_localstatedir}/lib/arpwatch
Miroslav Lichvar 6ced79
Miroslav Lichvar 6ced79
Name: arpwatch
Miroslav Lichvar 6ced79
Epoch: 14
Miroslav Lichvar 6ced79
Version: 2.1a15
Miroslav Lichvar f1b7b5
Release: 3%{?dist}
Miroslav Lichvar 6ced79
Summary: Network monitoring tools for tracking IP addresses on a network
Miroslav Lichvar 6ced79
Group: Applications/System
Miroslav Lichvar 6ced79
License: BSD
Miroslav Lichvar 6ced79
URL: http://ee.lbl.gov/
Miroslav Lichvar 6ced79
Requires(pre): shadow-utils 
Miroslav Lichvar 6ced79
Requires(post): /sbin/chkconfig
Miroslav Lichvar 6ced79
Requires(preun): /sbin/chkconfig /sbin/service
Miroslav Lichvar 6ced79
Requires(postun): /sbin/service
Miroslav Lichvar 6ced79
Requires: /usr/sbin/sendmail
Miroslav Lichvar 6ced79
BuildRequires: /usr/sbin/sendmail libpcap-devel
Miroslav Lichvar 6ced79
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Miroslav Lichvar 6ced79
Miroslav Lichvar 6ced79
Source0: ftp://ftp.ee.lbl.gov/arpwatch-%{version}.tar.gz
Miroslav Lichvar 6ced79
Source1: arpwatch.init
Miroslav Lichvar 6ced79
Source2: arpwatch.sysconfig
Miroslav Lichvar 6ced79
Patch1: arpwatch-2.1a4-fhs.patch
Miroslav Lichvar 6ced79
Patch2: arpwatch-2.1a10-man.patch
Miroslav Lichvar 6ced79
Patch3: arpwatch-drop.patch
Miroslav Lichvar 6ced79
Patch4: arpwatch-drop-man.patch
Miroslav Lichvar 6ced79
Patch5: arpwatch-addr.patch
Miroslav Lichvar 6ced79
Patch6: arpwatch-dir-man.patch
Miroslav Lichvar 6ced79
Patch7: arpwatch-scripts.patch
Miroslav Lichvar 6ced79
Patch8: arpwatch-2.1a15-nolocalpcap.patch
Miroslav Lichvar 6ced79
Miroslav Lichvar 6ced79
%description
Miroslav Lichvar 6ced79
The arpwatch package contains arpwatch and arpsnmp.  Arpwatch and
Miroslav Lichvar 6ced79
arpsnmp are both network monitoring tools.  Both utilities monitor
Miroslav Lichvar 6ced79
Ethernet or FDDI network traffic and build databases of Ethernet/IP
Miroslav Lichvar 6ced79
address pairs, and can report certain changes via email.
Miroslav Lichvar 6ced79
Miroslav Lichvar 6ced79
Install the arpwatch package if you need networking monitoring devices
Miroslav Lichvar 6ced79
which will automatically keep track of the IP addresses on your
Miroslav Lichvar 6ced79
network.
Miroslav Lichvar 6ced79
Miroslav Lichvar 6ced79
%prep
Miroslav Lichvar 6ced79
%setup -q
Miroslav Lichvar 6ced79
Miroslav Lichvar 6ced79
%patch1 -p1 -b .fhs
Miroslav Lichvar 6ced79
%patch2 -p1 -b .arpsnmpman
Miroslav Lichvar 6ced79
%patch3 -p1 -b .droproot
Miroslav Lichvar 6ced79
%patch4 -p0 -b .droprootman
Miroslav Lichvar 6ced79
%patch5 -p1 -b .mailuser
Miroslav Lichvar 6ced79
%patch6 -p1 -b .dirman
Miroslav Lichvar 6ced79
%patch7 -p1 -b .scripts
Miroslav Lichvar 6ced79
%patch8 -p1 -b .nolocalpcap
Miroslav Lichvar 6ced79
Miroslav Lichvar 6ced79
%build
Miroslav Lichvar 6ced79
%configure
Miroslav Lichvar 6ced79
make ARPDIR=%{_vararpwatch}
Miroslav Lichvar 6ced79
Miroslav Lichvar 6ced79
%install
Miroslav Lichvar 6ced79
rm -rf $RPM_BUILD_ROOT
Miroslav Lichvar 6ced79
Miroslav Lichvar 6ced79
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8
Miroslav Lichvar 6ced79
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
Miroslav Lichvar 6ced79
mkdir -p $RPM_BUILD_ROOT%{_vararpwatch}
Miroslav Lichvar 6ced79
mkdir -p $RPM_BUILD_ROOT%{_initrddir}
Miroslav Lichvar 6ced79
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
Miroslav Lichvar 6ced79
Miroslav Lichvar 6ced79
make DESTDIR=$RPM_BUILD_ROOT install install-man
Miroslav Lichvar 6ced79
Miroslav Lichvar 6ced79
# prepare awk scripts
Miroslav Lichvar 6ced79
perl -pi -e "s/\'/\'\\\'\'/g" *.awk
Miroslav Lichvar 6ced79
Miroslav Lichvar 6ced79
# and embed them
Miroslav Lichvar 6ced79
for i in arp2ethers massagevendor massagevendor-old; do
Miroslav Lichvar 6ced79
	cp -f $i $RPM_BUILD_ROOT%{_sbindir}
Miroslav Lichvar 6ced79
	for j in *.awk; do
Miroslav Lichvar 6ced79
		sed "s/-f\ *\(\<$j\>\)/\'\1\n\' /g" \
Miroslav Lichvar 6ced79
			< $RPM_BUILD_ROOT%{_sbindir}/$i \
Miroslav Lichvar 6ced79
			| sed "s/$j\$//;tx;b;:x;r$j" \
Miroslav Lichvar 6ced79
			> $RPM_BUILD_ROOT%{_sbindir}/$i.x
Miroslav Lichvar 6ced79
		mv -f $RPM_BUILD_ROOT%{_sbindir}/$i{.x,}
Miroslav Lichvar 6ced79
	done
Miroslav Lichvar 6ced79
	chmod 755 $RPM_BUILD_ROOT%{_sbindir}/$i
Miroslav Lichvar 6ced79
done
Miroslav Lichvar 6ced79
Miroslav Lichvar 6ced79
install -m644 *.dat $RPM_BUILD_ROOT%{_vararpwatch}
Miroslav Lichvar 6ced79
install -m755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/arpwatch
Miroslav Lichvar 6ced79
install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/arpwatch
Miroslav Lichvar 6ced79
Miroslav Lichvar 6ced79
%clean
Miroslav Lichvar 6ced79
rm -rf $RPM_BUILD_ROOT
Miroslav Lichvar 6ced79
Miroslav Lichvar 6ced79
%post
Miroslav Lichvar 6ced79
/sbin/chkconfig --add arpwatch
Miroslav Lichvar 6ced79
Miroslav Lichvar 6ced79
%pre
Miroslav Lichvar f1b7b5
if ! getent group arpwatch &> /dev/null; then
Miroslav Lichvar f1b7b5
	getent group pcap 2> /dev/null | grep -q 77 &&
Miroslav Lichvar f1b7b5
		/usr/sbin/groupmod -n arpwatch pcap 2> /dev/null ||
Miroslav Lichvar f1b7b5
		/usr/sbin/groupadd -g 77 arpwatch 2> /dev/null
Miroslav Lichvar f1b7b5
fi
Miroslav Lichvar f1b7b5
if ! getent passwd arpwatch &> /dev/null; then
Miroslav Lichvar f1b7b5
	getent passwd pcap 2> /dev/null | grep -q 77 &&
Miroslav Lichvar f1b7b5
		/usr/sbin/usermod -l arpwatch -g 77 \
Miroslav Lichvar f1b7b5
			-d %{_vararpwatch} pcap 2> /dev/null ||
Miroslav Lichvar f1b7b5
		/usr/sbin/useradd -u 77 -g 77 -s /sbin/nologin \
Miroslav Lichvar f1b7b5
			-M -r -d %{_vararpwatch} arpwatch 2> /dev/null
Miroslav Lichvar f1b7b5
fi
Miroslav Lichvar 6ced79
:
Miroslav Lichvar 6ced79
Miroslav Lichvar 6ced79
%postun
Miroslav Lichvar 6ced79
if [ "$1" -ge 1 ]; then
Miroslav Lichvar 6ced79
	/sbin/service arpwatch condrestart &> /dev/null
Miroslav Lichvar 6ced79
fi
Miroslav Lichvar 6ced79
:
Miroslav Lichvar 6ced79
Miroslav Lichvar 6ced79
%preun
Miroslav Lichvar 6ced79
if [ "$1" -eq 0 ]; then
Miroslav Lichvar 6ced79
	/sbin/service arpwatch stop &> /dev/null
Miroslav Lichvar 6ced79
	/sbin/chkconfig --del arpwatch
Miroslav Lichvar 6ced79
fi
Miroslav Lichvar 6ced79
:
Miroslav Lichvar 6ced79
Miroslav Lichvar 6ced79
%files
Miroslav Lichvar 6ced79
%defattr(-,root,root)
Miroslav Lichvar 6ced79
%doc README CHANGES arpfetch
Miroslav Lichvar 6ced79
%{_sbindir}/arpwatch
Miroslav Lichvar 6ced79
%{_sbindir}/arpsnmp
Miroslav Lichvar 6ced79
%{_sbindir}/arp2ethers
Miroslav Lichvar 6ced79
%{_sbindir}/massagevendor
Miroslav Lichvar 6ced79
%{_sbindir}/massagevendor-old
Miroslav Lichvar 6ced79
%{_mandir}/man8/arpwatch.8*
Miroslav Lichvar 6ced79
%{_mandir}/man8/arpsnmp.8*
Miroslav Lichvar 6ced79
%{_initrddir}/arpwatch
Miroslav Lichvar 6ced79
%config(noreplace) %{_sysconfdir}/sysconfig/arpwatch
Miroslav Lichvar f1b7b5
%defattr(-,arpwatch,arpwatch)
Miroslav Lichvar 6ced79
%dir %{_vararpwatch}
Miroslav Lichvar 6ced79
%verify(not md5 size mtime) %config(noreplace) %{_vararpwatch}/arp.dat
Miroslav Lichvar 6ced79
%verify(not md5 size mtime) %config %{_vararpwatch}/ethercodes.dat
Miroslav Lichvar 6ced79
Miroslav Lichvar 6ced79
%changelog
Miroslav Lichvar f1b7b5
* Mon Jan 15 2007 Miroslav Lichvar <mlichvar@redhat.com> 14:2.1a15-3
Miroslav Lichvar f1b7b5
- rename pcap user to arpwatch
Miroslav Lichvar f1b7b5
Miroslav Lichvar 6ced79
* Tue Nov 28 2006 Miroslav Lichvar <mlichvar@redhat.com> 14:2.1a15-2
Miroslav Lichvar 6ced79
- split from tcpdump package (#193657)
Miroslav Lichvar 6ced79
- update to 2.1a15
Miroslav Lichvar 6ced79
- clean up files in /var
Miroslav Lichvar 6ced79
- force linking with system libpcap