File arpwatch.spec of Package arpwatch

#
# spec file for package arpwatch
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#



Name:           arpwatch
BuildRequires:  libpcap-devel postfix
Url:            http://www-nrg.ee.lbl.gov/nrg.html
License:        BSD3c
Group:          Productivity/Networking/Diagnostic
Requires:       arpwatch-ethercodes
PreReq:         /usr/bin/touch %insserv_prereq %fillup_prereq
Summary:        Arpwatch Keeps Track of Ethernet and IP Address Pairings
Version:        2.1a15
Release:        132
Source:         %{name}-%{version}.tar.bz2
Source10:       arpwatch.init
Source11:       sysconfig.arpwatch
Patch0:         arpwatch-2.1a11-chrootbuild.diff
Patch1:         arpwatch-no-source-zero.dif
Patch3:         arpwatch-2.1a11-tokenring.diff
Patch4:         arpwatch-2.1a11-hname-overflow.dif
Patch5:         arpwatch-2.1a11-drop-privs-manpage.dif
Patch6:         arpwatch-2.1a11-drop-privs.dif
Patch7:         arpwatch-2.1a11-emailaddr.dif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Arpwatch keeps track of Ethernet and IP address pairings. It logs
activity to syslog and reports certain changes via e-mail.

%package ethercodes-build
License:        BSD3c
Group:          Productivity/Networking/Diagnostic
Summary:        Tool to create ethercodes.dat from IEEE.org meta data

%description ethercodes-build
Tool and required files to create the ethercodes.dat file from the OUI
and company ID data as provided by IEEE.org.  This package is only
needed if you want to build the arpwatch-ethercodes package.

%prep
%setup -q
%patch -P 0 -E
%patch1 -p1 -E
%patch3 -p1 -E
%patch4 -p1 -E
%patch5 -p1 -E
%patch6 -p1 -E
%patch7 -p1 -E

%build
%configure 
%{__make} ARPDIR=/var/lib/arpwatch %{?_smp_mflags}

%install
mkdir -p \
	$RPM_BUILD_ROOT/etc/init.d \
	$RPM_BUILD_ROOT/%{_sbindir} \
	$RPM_BUILD_ROOT/%{_datadir}/arpwatch \
	$RPM_BUILD_ROOT/%{_mandir}/man8 \
	$RPM_BUILD_ROOT/var/adm/fillup-templates
%makeinstall
# ethercodes.dat is in the arpwatch-ethercodes package
rm -f $RPM_BUILD_ROOT/%{_datadir}/arpwatch/ethercodes.dat
for file in massagevendor euppertolower.awk duplicates.awk p.awk; do
	cp -p ${file} $RPM_BUILD_ROOT/%{_datadir}/arpwatch
done
make DESTDIR=$RPM_BUILD_ROOT install-man
install -m 0754 $RPM_SOURCE_DIR/arpwatch.init $RPM_BUILD_ROOT/etc/init.d/arpwatch
ln -sf ../../etc/init.d/arpwatch $RPM_BUILD_ROOT/%{_sbindir}/rcarpwatch
cp -p ${RPM_SOURCE_DIR}/sysconfig.arpwatch $RPM_BUILD_ROOT/var/adm/fillup-templates
# own the database files
touch $RPM_BUILD_ROOT/var/lib/arpwatch/arp.dat
touch $RPM_BUILD_ROOT/var/lib/arpwatch/arp.dat-

%preun
%stop_on_removal arpwatch

%post
%fillup_and_insserv
if [ ! -f var/lib/arpwatch/arp.dat ]; then
	touch var/lib/arpwatch/arp.dat
fi

%postun
%restart_on_update arpwatch
%insserv_cleanup

%files
%defattr(-,root,root)
%config /etc/init.d/arpwatch
%{_sbindir}/arpsnmp
%{_sbindir}/arpwatch
%{_sbindir}/rcarpwatch
%dir /var/lib/arpwatch
%ghost %config(noreplace) /var/lib/arpwatch/arp.dat
%ghost %config(noreplace) /var/lib/arpwatch/arp.dat-
/var/adm/fillup-templates/sysconfig.arpwatch
%doc %{_mandir}/man8/arpsnmp.8.gz
%doc %{_mandir}/man8/arpwatch.8.gz
%doc CHANGES FILES INSTALL README

%files ethercodes-build
%defattr(-,root,root)
%{_datadir}/arpwatch

%changelog
openSUSE Build Service is sponsored by