SHA256
1
0
forked from pool/iputils
iputils/iputils.spec

189 lines
5.6 KiB
RPMSpec

#
# spec file for package iputils
#
# Copyright (c) 2018 SUSE LINUX 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: iputils
Version: s20161105
Release: 0
Summary: IPv4 and IPv6 Networking Utilities
License: BSD-3-Clause AND GPL-2.0-or-later
Group: Productivity/Networking/Other
Url: https://github.com/iputils/iputils
Source0: https://github.com/iputils/iputils/archive/%{version}.tar.gz
Source1: rarpd.service
Patch8: iputils-sec-ping-unblock.diff
Patch9: iputils-ping-interrupt.diff
# PATCH-FIX-UPSTREAM iputils-remove-bogus-check-required-for-2.4.9-kernels.patch tiwai@suse.de - boo#927831
Patch10: iputils-remove-bogus-check-required-for-2.4.9-kernels.patch
Patch11: iputils-ping-fix-pmtu-for-ipv6.patch
# PATCH-FIX-OPENSUSE iputils-add-license-info.diff jcaamano@suse.com - bnc#1082788
Patch12: iputils-add-license-info.diff
BuildRequires: docbook_3
BuildRequires: iso_ent
BuildRequires: libcap-devel
BuildRequires: libopenssl-devel
BuildRequires: opensp
BuildRequires: perl-SGMLS
BuildRequires: pkgconfig
BuildRequires: systemd-rpm-macros
# For Makefile modifications
BuildRequires: sed
BuildRequires: pkgconfig(libidn)
Requires(pre): permissions
# I have spotted at least two packages (yast-printer and dhcp-client) that need
# /bin/ping and /sbin/arping but they do not seem to use them with absolute
# paths so we may be lukcy and no further changes are necessary.
Provides: /bin/ping
Provides: /sbin/arping
%description
This package contains some small network tools for IPv4 and IPv6 like
rdisc, ping, arping and tracepath.
%package -n rarpd
Summary: Reverse Address Resolution Protocol Daemon
Group: Productivity/Networking/System
%systemd_requires
%description -n rarpd
Rarpd listens on the Ethernet for broadcast packets asking for reverse
address resolution. These packets are sent by hosts at boot time to find
out their IP addresses.
%prep
%setup -q
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11
%patch12 -p1
%build
# Drop LASTTAG variable since it needs git and it's not used for regular
# building
sed -i '/^LASTTAG:=/d' Makefile
# Do not link against nettle
sed -i '/^USE_NETTLE/s/yes/no/' Makefile
# Export CFLAGS so we can also benefit from the ones the Makefile sets for us
# Instead of overriding all of them.
export CFLAGS='%{optflags} -fpie'
# Pulled-in by the LINK.o variable.
export LDFLAGS='-pie -Wl,-z,relro,-z,now'
# Build only selected apps
make %{?_smp_mflags} arping clockdiff ping rdisc tracepath \
rarpd man
%install
mkdir -p %{buildroot}/%{_sbindir}
mkdir -p %{buildroot}/%{_bindir}
install arping %{buildroot}/%{_sbindir}
install clockdiff %{buildroot}/%{_sbindir}
install rarpd %{buildroot}/%{_sbindir}
install rdisc %{buildroot}/%{_sbindir}
# boo#795788
install tracepath %{buildroot}/%{_bindir}
install ping %{buildroot}/%{_bindir}
# boo#1017616
ln -sf %{_bindir}/ping %{buildroot}/%{_bindir}/ping6
ln -sf %{_bindir}/tracepath %{buildroot}/%{_bindir}/tracepath6
#UsrMerge
# We still have reverse dependencies using /sbin/* or /bin/*
# so keep these symlinks for now. They are slowly being fixed
# but lets not just break them yet.
mkdir -p %{buildroot}/{bin,sbin}
ln -sf %{_sbindir}/arping %{buildroot}/sbin
ln -sf %{_sbindir}/clockdiff %{buildroot}/sbin
ln -sf %{_sbindir}/rarpd %{buildroot}/sbin
ln -sf %{_sbindir}/rdisc %{buildroot}/sbin
ln -sf %{_bindir}/tracepath %{buildroot}/bin
ln -sf %{_bindir}/ping %{buildroot}/bin
ln -sf %{_bindir}/ping6 %{buildroot}/bin
ln -sf %{_bindir}/tracepath6 %{buildroot}/bin
#EndUsrMerge
mkdir -p %{buildroot}/%{_mandir}/man8
# Remove conflicting / unused manpages
rm doc/ninfod* doc/pg3* doc/rdisc* doc/tftpd* doc/traceroute*
# Install the rest
install -m 644 doc/*.8 %{buildroot}%{_mandir}/man8/
# Install rarp service and create rc compat symling
install -Dpm 0644 %{SOURCE1} %{buildroot}/%{_unitdir}/rarpd.service
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcrarpd
%post
%set_permissions %{_bindir}/ping
%verifyscript
%verify_permissions -e %{_bindir}/ping
%pre -n rarpd
%service_add_pre rarpd.service
%post -n rarpd
%service_add_post rarpd.service
%preun -n rarpd
%service_del_preun rarpd.service
%postun -n rarpd
%service_del_postun rarpd.service
%files
%doc RELNOTES
%if 0%{?suse_version} < 1500
%doc LICENSE LICENSE.BSD3 LICENSE.GPL2
%else
%license LICENSE LICENSE.BSD3 LICENSE.GPL2
%endif
%verify(not mode caps) %attr(0755,root,root) %{_bindir}/ping
%{_bindir}/ping6
%{_sbindir}/arping
%{_sbindir}/clockdiff
%{_bindir}/tracepath
%{_bindir}/tracepath6
%{_sbindir}/rdisc
#UsrMerge
/bin/ping
/bin/ping6
/bin/tracepath
/bin/tracepath6
/sbin/arping
/sbin/clockdiff
/sbin/rdisc
#EndUsrMerge
%{_mandir}/man8/arping.8%{ext_man}
%{_mandir}/man8/clockdiff.8%{ext_man}
%{_mandir}/man8/ping.8%{ext_man}
%{_mandir}/man8/tracepath.8%{ext_man}
#EndUsrMerge
%files -n rarpd
%{_sbindir}/rarpd
%{_sbindir}/rcrarpd
%{_unitdir}/rarpd.service
#UsrMerge
/sbin/rarpd
#EndUsrMerge
%{_mandir}/man8/rarpd.8%{ext_man}
%changelog