From 75bf552a579f71ee671e10fab2c322d8084fab16 Mon Sep 17 00:00:00 2001 From: Peter Levine Date: Wed, 23 Oct 2019 15:13:46 -0400 Subject: net-analyzer/netselect: Add filecaps support Closes: https://bugs.gentoo.org/564902 Closes: https://github.com/gentoo/gentoo/pull/13388 Package-Manager: Portage-2.3.78, Repoman-2.3.17 Signed-off-by: Peter Levine Signed-off-by: Sam James --- net-analyzer/netselect/netselect-0.4-r2.ebuild | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'net-analyzer/netselect') diff --git a/net-analyzer/netselect/netselect-0.4-r2.ebuild b/net-analyzer/netselect/netselect-0.4-r2.ebuild index 8ac47519b250..e887b8335a1a 100644 --- a/net-analyzer/netselect/netselect-0.4-r2.ebuild +++ b/net-analyzer/netselect/netselect-0.4-r2.ebuild @@ -2,7 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 EAPI=7 -inherit toolchain-funcs +inherit fcaps toolchain-funcs DESCRIPTION="Ultrafast implementation of ping" HOMEPAGE="http://apenwarr.ca/netselect/" @@ -23,12 +23,20 @@ PATCHES=( DOCS=( HISTORY README ) +FILECAPS=( -g wheel cap_net_raw /usr/bin/netselect ) + S=${WORKDIR}/${PN}-${P} src_prepare() { use ipv6 && eapply "${WORKDIR}"/${PN}-0.4-ipv6.patch default + + # Don't warn about "root privileges required" when running as + # an unprivileged user with filecaps + if ! use prefix && use filecaps; then + sed -i -e '/if (geteuid () != 0)/,+2d' "${S}"/netselect.c || die + fi } src_compile() { @@ -38,12 +46,11 @@ src_compile() { src_install() { dobin netselect - if ! use prefix ; then - fowners root:wheel /usr/bin/netselect - fperms 4711 /usr/bin/netselect - fi - einstalldocs doman netselect.1 } + +pkg_postinst() { + ! use prefix && fcaps_pkg_postinst +} -- cgit v1.2.3-65-gdbad