net-analyzer/fping: Add USE=filecaps, fping6 > fping symlink
authorJeroen Roovers <jer@gentoo.org>
Mon, 3 Feb 2020 18:10:53 +0000 (19:10 +0100)
committerJeroen Roovers <jer@gentoo.org>
Mon, 3 Feb 2020 18:15:34 +0000 (19:15 +0100)
Bug #698662:
- Use filecaps.eclass to set cap_net_raw

Bug #708020:
- Create a symlink from /usr/sbin/fping6 -> fping
- Add upstream patch to fix `fping6 -6 ...`

Package-Manager: Portage-2.3.87, Repoman-2.3.20
Closes: https://bugs.gentoo.org/698662
Closes: https://bugs.gentoo.org/708020
Signed-off-by: Jeroen Roovers <jer@gentoo.org>
net-analyzer/fping/files/fping-4.2-fping6-6.patch [new file with mode: 0644]
net-analyzer/fping/fping-4.2-r1.ebuild [new file with mode: 0644]

diff --git a/net-analyzer/fping/files/fping-4.2-fping6-6.patch b/net-analyzer/fping/files/fping-4.2-fping6-6.patch
new file mode 100644 (file)
index 0000000..63138d3
--- /dev/null
@@ -0,0 +1,21 @@
+From 6fd4f8bd91abc43f80078bdd0084cb6d2b1de7f1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Johan=20Str=C3=B6m?= <johan@stromnet.se>
+Date: Tue, 25 Jun 2019 14:03:14 +0200
+Subject: [PATCH] Do not fail if using fping6 with -6 flag
+
+Mostly for backwards compatability
+---
+ src/fping.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/src/fping.c
++++ b/src/fping.c
+@@ -435,7 +435,7 @@
+             break;
+         case '6':
+ #ifdef IPV6
+-            if (hints_ai_family != AF_UNSPEC) {
++            if (hints_ai_family != AF_UNSPEC && hints_ai_family != AF_INET6) {
+                 fprintf(stderr, "%s: can't specify both -4 and -6\n", prog);
+                 exit(1);
+             }
diff --git a/net-analyzer/fping/fping-4.2-r1.ebuild b/net-analyzer/fping/fping-4.2-r1.ebuild
new file mode 100644 (file)
index 0000000..0e1b61d
--- /dev/null
@@ -0,0 +1,36 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+inherit fcaps
+
+DESCRIPTION="A utility to ping multiple hosts at once"
+HOMEPAGE="https://fping.org/"
+SRC_URI="https://fping.org/dist/${P}.tar.gz"
+
+LICENSE="fping"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~x86-macos"
+IUSE="ipv6 suid"
+
+FILECAPS=( cap_net_raw+ep usr/sbin/fping )
+PATCHES=(
+       "${FILESDIR}"/${PN}-4.2-fno-common.patch
+       "${FILESDIR}"/${PN}-4.2-fping6-6.patch
+)
+
+src_configure() {
+       econf $(use_enable ipv6)
+}
+
+src_install() {
+       default
+
+       if use suid; then
+               fperms u+s /usr/sbin/fping
+       fi
+
+       if use ipv6; then
+               dosym fping /usr/sbin/fping6
+       fi
+}