arpwatch/arpwatch.spec
2024-03-01 08:30:17 +00:00

185 lines
5.8 KiB
RPMSpec

%global pkgstatedir %{_sharedstatedir}/arpwatch
%global _hardened_build 1
Name: arpwatch
Epoch: 14
Version: 3.5
Release: 2
Summary: Network monitoring tools for tracking IP addresses on a network
License: BSD-3-Clause
URL: http://ee.lbl.gov/
Source0: https://ee.lbl.gov/downloads/arpwatch/arpwatch-%{version}.tar.gz
Source1: arpwatch.service
Source2: ethercodes-20110707.dat.bz2
Source3: arpwatch.sysconfig
BuildRequires: libpcap-devel systemd sendmail python3-devel
BuildRequires: gcc make
Requires(pre): shadow-utils
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
Requires: sendmail python3
Patch1: arpwatch-3.1-man-references.patch
Patch2: arpwatch-3.2-change-user.patch
Patch3: arpwatch-3.1-arp2ethers-sort-invocation.patch
Patch4: arpwatch-3.1-arpfetch-stray-rm.patch
Patch5: arpwatch-3.2-no-usr-local-path.patch
Patch6: arpwatch-3.1-configure-no-local-pcap.patch
Patch7: arpwatch-3.1-all-zero-bogon.patch
Patch8: arpwatch-3.5-exitcode.patch
Patch9: arpwatch-3.5-devlookup.patch
Patch10: arpwatch-3.3-c99.patch
Patch11: arpwatch-add-sw64-architecture.patch
%description
The arpwatch package contains arpwatch and arpsnmp. Arpwatch and
arpsnmp are both network monitoring tools that monitor ethernet or
FDDI network traffic and maintain a database of ethernet/ip address
pairings.
%package help
Summary: arpwatch help and arpsnmp help
%description help
The arpwatch-help package provides the help manual function separately.
%prep
%autosetup -n %{name}-%{version} -p1
# Substitute absolute paths to awk scripts in shell scripts
sed -r -i 's|(-f *)([^[:blank:]+]\.awk)|\1%{_datadir}/arpwatch/\2|' arp2ethers
sed -r -i 's|/usr/local/arpwatch|%{pkgstatedir}|g' *.8.in *.sh.in *.sh
sed -r -i 's|/usr/local/bin/python|/usr/bin/python3|g' update-ethercodes.sh.in
awk '/^ \* / { print substr($0, 4); } /^ \*\// { exit }' arpwatch.c | tee LICENSE
%build
%set_build_flags
# Prior to version 3.4, this was handled by the configure script. If it is not
# defined, the build failes because time.h is not included in report.c. This
# regregression was reported upstream by email to arpwatch@ee.lbl.gov on
# 2023-09-06.
export CPPFLAGS="${CPPFLAGS-} -DTIME_WITH_SYS_TIME=1"
%configure --with-sendmail=/usr/sbin/sendmail PYTHON=/usr/bin/python3
%make_build ARPDIR=%{pkgstatedir}
%install
install -d $RPM_BUILD_ROOT%{_mandir}/man8
install -d $RPM_BUILD_ROOT%{_sbindir}
install -d $RPM_BUILD_ROOT%{_datadir}/arpwatch
install -d $RPM_BUILD_ROOT%{pkgstatedir}
install -d $RPM_BUILD_ROOT%{_unitdir}
install -d $RPM_BUILD_ROOT%{_prefix}/etc/rc.d
%make_install
install -p -t $RPM_BUILD_ROOT%{_datadir}/arpwatch -m 0644 *.awk
install -p -t $RPM_BUILD_ROOT%{_sbindir} arp2ethers
install -p massagevendor.py $RPM_BUILD_ROOT%{_sbindir}/massagevendor
install -p -t $RPM_BUILD_ROOT%{pkgstatedir} -m0644 *.dat
touch $RPM_BUILD_ROOT%{pkgstatedir}/arp.dat- $RPM_BUILD_ROOT%{pkgstatedir}/arp.dat.new
install -p -t $RPM_BUILD_ROOT%{_unitdir} -m 0644 %{SOURCE1}
install -d $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
install -p -m 0644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/arpwatch
install -p -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{pkgstatedir}/ethercodes.dat.bz2
bunzip2 -f %{buildroot}%{pkgstatedir}/ethercodes.dat.bz2
# Remove legacy init scripts:
rm -rvf %{buildroot}%{_prefix}/etc/rc.d
%pre
getent group arpwatch >/dev/null || groupadd -f -g 77 -r arpwatch
if ! getent passwd arpwatch >/dev/null
then
if ! getent passwd 77 >/dev/null
then
useradd -r -u 77 -g arpwatch \
-d %{pkgstatedir} -s /sbin/nologin \
-c "Service user for arpwatch" arpwatch
else
useradd -r -g arpwatch \
-d %{pkgstatedir} -s /sbin/nologin \
-c "Service user for arpwatch" arpwatch
fi
fi
exit 0
%preun
%systemd_preun arpwatch.service
%post
%systemd_post arpwatch.service
%postun
%systemd_postun_with_restart arpwatch.service
%files
%license LICENSE
%doc README CHANGES arpfetch
%attr(0755,-,-)%{_sbindir}/arpwatch
%attr(0755,-,-)%{_sbindir}/arpsnmp
%{_sbindir}/arp2ethers
%{_sbindir}/massagevendor
%dir %{_datadir}/arpwatch
%{_datadir}/arpwatch/*.awk
%{_unitdir}/arpwatch.service
%config(noreplace) %{_sysconfdir}/sysconfig/arpwatch
%attr(1775,-,arpwatch) %dir %{pkgstatedir}
%attr(0644,arpwatch,arpwatch) %verify(not md5 size mtime) %config(noreplace) %{pkgstatedir}/arp.dat
%attr(0644,arpwatch,arpwatch) %verify(not md5 size mtime) %config(noreplace) %{pkgstatedir}/arp.dat-
%attr(0600,arpwatch,arpwatch) %verify(not md5 size mtime) %ghost %{pkgstatedir}/arp.dat.new
%attr(0644,-,arpwatch) %verify(not md5 size mtime) %config(noreplace) %{pkgstatedir}/ethercodes.dat
%files help
%{_mandir}/man8/*.8*
%changelog
* Fri Mar 01 2024 yanglu<yanglu72@h-partners.com> - 14:3.5-2
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:fix install info error
* Mon Jan 08 2024 yanglu<yanglu72@h-partners.com> - 14:3.5-1
- Type:requirements
- Id:NA
- SUG:NA
- DESC:update arpwatch version to 3.5
* Thu Oct 26 2023 yanglu<yanglu72@h-partners.com> - 14:3.3-1
- Type:requirements
- Id:NA
- SUG:NA
- DESC:update arpwatch version to 3.3
* Thu Jul 28 2022 wuzx<wuzx1226@qq.com> - 14:2.1a15-48
- Type:feature
- Id:NA
- SUG:NA
- DESC:Added sw64 patch
* Fri Jun 25 2021 lijingyuan <lijingyuan3@huawei.com> - 14:2.1a15-47
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:Added the gcc dependency
* Thu Mar 25 2021 liulong <liulong20@huawei.com> - 14:2.1a15-46
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:Modify the changelog description.
* Tue Dec 15 2020 xihaochen <xihaochen@huawei.com> - 14:2.1a15-45
- Type:requirements
- Id:NA
- SUG:NA
- DESC:remove sensitive keywords and update source url
* Fri Sep 06 2019 Alex Chao <zhaolei746@huawei.com> - 14:2.1a15-44
- Package init