File iputils.spec of Package iputils.24604

# 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

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
Source1:        rarpd.service
# PATCH-FIX-UPSTREAM iputils-remove-bogus-check-required-for-2.4.9-kernels.patch - 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 - bnc#1082788
Patch12:        iputils-add-license-info.diff
Patch13:        ping6-Fix-device-binding.patch
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 lucky and no further changes are necessary.
Provides:       /bin/ping
Provides:       /sbin/arping

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

%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.

%autosetup -p1


# 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

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

# 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

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

%set_permissions %{_bindir}/ping

%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

%if 0%{?suse_version} < 1500
%verify(not mode caps) %attr(0755,root,root) %{_bindir}/ping

%files -n rarpd

openSUSE Build Service is sponsored by