LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File arpwatch.spec of Package arpwatch (Project security)

#
# spec file for package arpwatch
#
# Copyright (c) 2013 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/
#

%if 0%{?suse_version} > 1140
%define has_systemd 1
%endif

%if 0%{?has_systemd}
%if 0%{?suse_version} < 1230
%define _unitdir /lib/systemd/system
%else
%define _unitdir /usr/lib/systemd/system
%endif
%endif

Name:           arpwatch
BuildRequires:  libpcap-devel
BuildRequires:  postfix
%if 0%{?has_systemd}
BuildRequires:  systemd
%{?systemd_requires}
%endif
Url:            http://www-nrg.ee.lbl.gov/nrg.html
Requires:       arpwatch-ethercodes
%if 0%{?suse_version} <= 1140
PreReq:         /usr/bin/touch %insserv_prereq %fillup_prereq
%else
PreReq:         /usr/bin/touch %fillup_prereq
%endif
Summary:        Arpwatch Keeps Track of Ethernet and IP Address Pairings
License:        BSD-3-Clause
Group:          Productivity/Networking/Diagnostic
Version:        2.1a15
Release:        0
Source:         %{name}-%{version}.tar.bz2
%if 0%{?has_systemd}
Source10:       arpwatch.service
%else
Source10:       arpwatch.init
%endif
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
Summary:        Tool to create ethercodes.dat from IEEE.org meta data
Group:          Productivity/Networking/Diagnostic

%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 \
%if 0%{?has_systemd}
    $RPM_BUILD_ROOT/%{_unitdir} \
%else
    $RPM_BUILD_ROOT/etc/init.d \
%endif
    $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
%if 0%{?has_systemd}
install -m 0754 $RPM_SOURCE_DIR/arpwatch.service $RPM_BUILD_ROOT/%{_unitdir}
%else
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
%endif
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
%if 0%{?has_systemd}
%service_del_preun arpwatch.service
%else
%stop_on_removal arpwatch
%endif

%post
%if 0%{?has_systemd}
%service_add_post arpwatch.service
%fillup_only
%else
%fillup_and_insserv
%endif
if [ ! -f var/lib/arpwatch/arp.dat ]; then
	touch var/lib/arpwatch/arp.dat
fi

%postun
%if 0%{?has_systemd}
%service_del_postun arpwatch.service
%else
%restart_on_update arpwatch
%insserv_cleanup
%endif

%files
%defattr(-,root,root)
%if 0%{?has_systemd}
%{_unitdir}/arpwatch.service
%else
%config /etc/init.d/arpwatch
%{_sbindir}/rcarpwatch
%endif
%{_sbindir}/arpsnmp
%{_sbindir}/arpwatch
%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 README

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

%changelog