File arpwatch.spec of Package arpwatch

# spec file for package arpwatch
# Copyright (c) 2021 SUSE LLC
# 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

#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
  %define _fillupdir %{_localstatedir}/adm/fillup-templates
Name:           arpwatch
Version:        2.1a15
Release:        0
Summary:        Tool to keep track of Ethernet<->IP address pairings
License:        BSD-3-Clause
Group:          Productivity/Networking/Diagnostic
Source:         %{name}-%{version}.tar.bz2
Source10:       arpwatch@.service
Source11:       sysconfig.arpwatch
Source12:       arpwatch.service
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
Patch8:         arpwatch-2.1a15-massagevendor.patch
Patch9:         getnameinfo.patch
# PATCH-Fix-Upstream -- --
Patch10:        0001-Ignore-802.1Q-frames.patch
Patch11:        report-iface.patch
Patch12:        arpwatch-MAC.patch
Patch13:        arpwatch-exit.patch
Patch14:        arp2ethers.patch
BuildRequires:  libpcap-devel
BuildRequires:  postfix
BuildRequires:  systemd-rpm-macros
Requires:       arpwatch-ethercodes
Requires(post): %fillup_prereq
Requires(post): coreutils

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 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  This package is only
needed if you want to build the arpwatch-ethercodes package.

%autosetup -p1

%make_build ARPDIR=%{_localstatedir}/lib/arpwatch

mkdir -p \
    %{buildroot}/%{_tmpfilesdir} \
    %{buildroot}/%{_sbindir} \
    %{buildroot}/%{_datadir}/arpwatch \
    %{buildroot}/%{_mandir}/man8 \
# ethercodes.dat is in the arpwatch-ethercodes package
rm -f %{buildroot}/%{_datadir}/arpwatch/ethercodes.dat
for file in massagevendor euppertolower.awk duplicates.awk p.awk; do
	cp -p ${file} %{buildroot}/%{_datadir}/arpwatch
make DESTDIR=%{buildroot} install-man
install -Dm 0644 %{SOURCE10} %{buildroot}/%{_unitdir}/arpwatch@.service
install -Dm 0644 %{SOURCE12} %{buildroot}/%{_unitdir}/arpwatch.service
ln -s service %{buildroot}%{_sbindir}/rcarpwatch
install -Dm 0644 %{SOURCE11} \
# own the database files
cat > %{buildroot}%{_tmpfilesdir}/arpwatch.conf <<EOF
# See tmpfiles.d(5) for details
d /var/lib/arpwatch - - - -
f /var/lib/arpwatch/arp.dat - - - -
mkdir %{buildroot}%{_bindir}
install -m 0755 arp2ethers %{buildroot}%{_bindir}

%service_add_pre arpwatch.service

%service_del_preun arpwatch.service

%tmpfiles_create %{_tmpfilesdir}/arpwatch.conf
%service_add_post arpwatch.service

%service_del_postun arpwatch.service

%ghost %dir %{_localstatedir}/lib/arpwatch
%ghost %{_localstatedir}/lib/arpwatch/arp.dat

%files ethercodes-build

openSUSE Build Service is sponsored by