summaryrefslogtreecommitdiff
path: root/net-fs
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-11-14 00:49:39 +0000
committerMike Frysinger <vapier@gentoo.org>2010-11-14 00:49:39 +0000
commit7f103d6e289fdcd6f543219f3155ea6e9ff33cde (patch)
tree8b9e5d273c47beb45ed09736e4c8e7e78e26b153 /net-fs
parentFix SRC_URI, bug #345335. (diff)
downloadhistorical-7f103d6e289fdcd6f543219f3155ea6e9ff33cde.tar.gz
historical-7f103d6e289fdcd6f543219f3155ea6e9ff33cde.tar.bz2
historical-7f103d6e289fdcd6f543219f3155ea6e9ff33cde.zip
Add fix from upstream for ti-rpc static port bindings #340797 by John J. Aylward.
Package-Manager: portage-2.2.0_alpha4/cvs/Linux x86_64
Diffstat (limited to 'net-fs')
-rw-r--r--net-fs/nfs-utils/ChangeLog10
-rw-r--r--net-fs/nfs-utils/Manifest10
-rw-r--r--net-fs/nfs-utils/files/nfs-utils-1.2.3-ti-rpc-static-ports.patch352
-rw-r--r--net-fs/nfs-utils/nfs-utils-1.2.3-r1.ebuild108
4 files changed, 475 insertions, 5 deletions
diff --git a/net-fs/nfs-utils/ChangeLog b/net-fs/nfs-utils/ChangeLog
index 12aaaff3084d..75d600ef94c4 100644
--- a/net-fs/nfs-utils/ChangeLog
+++ b/net-fs/nfs-utils/ChangeLog
@@ -1,6 +1,14 @@
# ChangeLog for net-fs/nfs-utils
# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/ChangeLog,v 1.174 2010/10/08 19:48:08 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/ChangeLog,v 1.175 2010/11/14 00:49:39 vapier Exp $
+
+*nfs-utils-1.2.3-r1 (14 Nov 2010)
+
+ 14 Nov 2010; Mike Frysinger <vapier@gentoo.org>
+ +nfs-utils-1.2.3-r1.ebuild,
+ +files/nfs-utils-1.2.3-ti-rpc-static-ports.patch:
+ Add fix from upstream for ti-rpc static port bindings #340797 by John J.
+ Aylward.
*nfs-utils-1.2.3 (08 Oct 2010)
diff --git a/net-fs/nfs-utils/Manifest b/net-fs/nfs-utils/Manifest
index 74d85753a0b9..436a72c4f7e5 100644
--- a/net-fs/nfs-utils/Manifest
+++ b/net-fs/nfs-utils/Manifest
@@ -8,6 +8,7 @@ AUX nfs-utils-1.1.4-no-exec.patch 297 RMD160 59e6f4bf2c782c0c107cd135589c4abcba1
AUX nfs-utils-1.1.4-rpcgen-ioctl.patch 414 RMD160 f07264e24f374d6a65dbc8c2b1dfed3755099ddc SHA1 c7df5e9b309b389a1b0d85e539771af43d3e8d98 SHA256 78ae8ba33a600e6eb1153521eeb0ec5c3c5c503bd20074b1687703b3f83be678
AUX nfs-utils-1.2.2-nfsv4.patch 479 RMD160 2715fbde5c36a4e34af0d79b8760329bd2b185a8 SHA1 74377ed796f2c0e8e2734d1ac8f2c6fc9622fdb7 SHA256 ce601318e17f108c9fffcef9963430a01e2cb7dffb5189e4ca6de53413bb153f
AUX nfs-utils-1.2.2-optional-libcap.patch 2213 RMD160 7182147365404bc6f4caa676018bfc45b90570ad SHA1 99f09ff9b5590346ef367ee9683bc94272eac2ce SHA256 75135cc2c90aacc7adb43c6ced308099ac5b2d9c8cfcc74d395ead4dc583a75a
+AUX nfs-utils-1.2.3-ti-rpc-static-ports.patch 10290 RMD160 079daaf913c61b1ff6dac7bef0d3522c377c37ef SHA1 386f76c3e957ef61706db4708423a96b39557374 SHA256 8f188be765d5aa41eaa9d15df7cf0dc6b7ba29413866e8ada6c54973b0a942e9
AUX nfs.confd 777 RMD160 8c830ee0c1a57e4b2fe35419976b9063080492de SHA1 22e6bf3d6e350b71bed4b827796a36fb964d1455 SHA256 ca1f72dca9934f7bbdd281dde8b1e91c0efad5abf3935dba54cd6ec07e7af315
AUX nfs.initd 4351 RMD160 55244f2f17d203171df647a51dd7469ca5fd50fa SHA1 550ec81c40cb26165a37c998cebf1d518f493981 SHA256 0cd21f296de5936f5bc87fff7958bb66b6e8a7525e6a46f22feeb704160874d7
AUX nfsmount.initd 1130 RMD160 7ac01f228fcd9539e11cf200a0ba2ed82987a91b SHA1 1f4bfd0155489b6ce2e044f34d057c222202b1bb SHA256 4d6965abb56b72bdcd18cbf900b6e1614d12da6b92b1a5b18727c36eaa131d37
@@ -29,13 +30,14 @@ EBUILD nfs-utils-1.1.6-r1.ebuild 3212 RMD160 128bea36284b28408aa6e10dfcc1b330615
EBUILD nfs-utils-1.2.0.ebuild 3194 RMD160 bcf7cc92eeb36828a3f62ef597f6f2bf20e3717d SHA1 66c69826465b73de114dc1fe7e1a9fcdafd78805 SHA256 ea1b2347de041280faa7dd8e008a2486d7b28e6b83f0b410f20afb009e906f64
EBUILD nfs-utils-1.2.1.ebuild 3120 RMD160 c97608ea950bb115875d1c2058112b67e500159c SHA1 06e6b0203540520ce4aed99da5f2dd5575491d40 SHA256 5342652c52e345a17ef3d000a4a78aa0513edf863dad7adaa665975194d9771c
EBUILD nfs-utils-1.2.2-r2.ebuild 3387 RMD160 957cda2a26635d233322f2ca62a4466bbe2ad537 SHA1 bd0fc823c4e79d0c5a0025f31f9a416a3411da78 SHA256 9dd1368b530d093538f6adb4715ec6634fe050e664b6ae0b004f65a8fae9c4f4
+EBUILD nfs-utils-1.2.3-r1.ebuild 3214 RMD160 cae244b3390bdf93e5c94237375809eb750647f0 SHA1 6ed3c71147cb9f5bad186535c188a6588b57955f SHA256 fdf7c7a866373e994349c836076ba4f8e64db344fa96e37c637c05769459c825
EBUILD nfs-utils-1.2.3.ebuild 3150 RMD160 03ce5a05c2bc11e3d0fa87c86faf590329307531 SHA1 2293dc44577dd9d4c91f0e234e22301989810d12 SHA256 b1c484e0cc4b032cd44ff66d9e73866e0dfcea87c22917994f2aa6312db1bcba
-MISC ChangeLog 27665 RMD160 1365237f607d6c5b15d378646a476d26054d37f1 SHA1 5db0403a8dfc5a5e77ffab90a4d004fe0c69d4b2 SHA256 f2231f4221385814bd5c229e0f08c609502fd5be24fa9d6a78bd56923b01336c
+MISC ChangeLog 27919 RMD160 98b24741ba1b555ac219fc4c8320475f5bf29968 SHA1 78d8fd562ac166f859130927b637f0876e1e830e SHA256 6f352c501955fbbb3811abbb39f72d38c2b87e86dda52286b24a4009c259a21c
MISC metadata.xml 402 RMD160 10e39caa098663bde1b609727598aefc319eb5c2 SHA1 9180287973e77c950e172f055e19e5f94f446621 SHA256 cf9b23e458d8e57e6b3ec4639d2c486032b3313952da2c92166bc5f40409e3f6
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
-iF4EAREIAAYFAkyvdRQACgkQTwhj9JtAlp5bcwEAkHdlcLpa5O6ruDPWzCQ/GSgH
-wEd/hlUHh+5Wo72vupUBAMC4Qn0uPluol/tOybCvmLpfoYbMqKTIZqyu4moIWhAq
-=un5L
+iF4EAREIAAYFAkzfMfsACgkQTwhj9JtAlp7/kAEArtYdVgyJQ6i3pICjKYTXGoaz
+xRHiEjmqsx/dOAfbJTUBAKFlNfrgejx+rllunFEGtmKqlnpJPRl2FB5x5HJ5aW/7
+=XICW
-----END PGP SIGNATURE-----
diff --git a/net-fs/nfs-utils/files/nfs-utils-1.2.3-ti-rpc-static-ports.patch b/net-fs/nfs-utils/files/nfs-utils-1.2.3-ti-rpc-static-ports.patch
new file mode 100644
index 000000000000..b66e981b44a3
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfs-utils-1.2.3-ti-rpc-static-ports.patch
@@ -0,0 +1,352 @@
+http://bugs.gentoo.org/340797
+
+From 656028f9925f5817c5a37565d27159973db84ec3 Mon Sep 17 00:00:00 2001
+From: Chuck Lever <chuck.lever@oracle.com>
+Date: Wed, 13 Oct 2010 11:22:07 -0400
+Subject: [PATCH] libnfs.a: Allow multiple RPC listeners to share listener port number
+
+Normally, when "-p" is not specified on the mountd command line, the
+TI-RPC library chooses random port numbers for each listener. If a
+port number _is_ specified on the command line, all the listeners
+will get the same port number, so SO_REUSEADDR needs to be set on
+each socket.
+
+Thus we can't let TI-RPC create the listener sockets for us in this
+case; we must create them ourselves and then set SO_REUSEADDR (and
+other socket options) by hand.
+
+Different versions of the same RPC program have to share the same
+listener and SVCXPRT, so we have to cache xprts we create, and re-use
+them when additional requests for registration come from the
+application.
+
+Though it doesn't look like it, this fix was "copied" from the legacy
+rpc_init() function. It's more complicated for TI-RPC, of course,
+since a TI-RPC application can set up listeners with a nearly
+arbitrary number of address families and socket types, not just the
+two listeners that legacy RPC applications can set up (one for AF_INET
+UDP and one for AF_INET TCP).
+
+See:
+ https://bugzilla.linux-nfs.org/show_bug.cgi?id=190
+
+Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
+Signed-off-by: Steve Dickson <steved@redhat.com>
+---
+ support/nfs/svc_create.c | 252 ++++++++++++++++++++++++++++++++++++++++++++-
+ 1 files changed, 246 insertions(+), 6 deletions(-)
+
+diff --git a/support/nfs/svc_create.c b/support/nfs/svc_create.c
+index 59ba505..b3f75ed 100644
+--- a/support/nfs/svc_create.c
++++ b/support/nfs/svc_create.c
+@@ -27,6 +27,7 @@
+ #include <memory.h>
+ #include <signal.h>
+ #include <unistd.h>
++#include <errno.h>
+ #include <netdb.h>
+
+ #include <netinet/in.h>
+@@ -41,11 +42,68 @@
+ #include "tcpwrapper.h"
+ #endif
+
++#include "sockaddr.h"
+ #include "rpcmisc.h"
+ #include "xlog.h"
+
+ #ifdef HAVE_LIBTIRPC
+
++#define SVC_CREATE_XPRT_CACHE_SIZE (8)
++static SVCXPRT *svc_create_xprt_cache[SVC_CREATE_XPRT_CACHE_SIZE] = { NULL, };
++
++/*
++ * Cache an SVC xprt, in case there are more programs or versions to
++ * register against it.
++ */
++static void
++svc_create_cache_xprt(SVCXPRT *xprt)
++{
++ unsigned int i;
++
++ /* Check if we've already got this one... */
++ for (i = 0; i < SVC_CREATE_XPRT_CACHE_SIZE; i++)
++ if (svc_create_xprt_cache[i] == xprt)
++ return;
++
++ /* No, we don't. Cache it. */
++ for (i = 0; i < SVC_CREATE_XPRT_CACHE_SIZE; i++)
++ if (svc_create_xprt_cache[i] == NULL) {
++ svc_create_xprt_cache[i] = xprt;
++ return;
++ }
++
++ xlog(L_ERROR, "%s: Failed to cache an xprt", __func__);
++}
++
++/*
++ * Find a previously cached SVC xprt structure with the given bind address
++ * and transport semantics.
++ *
++ * Returns pointer to a cached SVC xprt.
++ *
++ * If no matching SVC XPRT can be found, NULL is returned.
++ */
++static SVCXPRT *
++svc_create_find_xprt(const struct sockaddr *bindaddr, const struct netconfig *nconf)
++{
++ unsigned int i;
++
++ for (i = 0; i < SVC_CREATE_XPRT_CACHE_SIZE; i++) {
++ SVCXPRT *xprt = svc_create_xprt_cache[i];
++ struct sockaddr *sap;
++
++ if (xprt == NULL)
++ continue;
++ if (strcmp(nconf->nc_netid, xprt->xp_netid) != 0)
++ continue;
++ sap = (struct sockaddr *)xprt->xp_ltaddr.buf;
++ if (!nfs_compare_sockaddr(bindaddr, sap))
++ continue;
++ return xprt;
++ }
++ return NULL;
++}
++
+ /*
+ * Set up an appropriate bind address, given @port and @nconf.
+ *
+@@ -98,17 +156,113 @@ svc_create_bindaddr(struct netconfig *nconf, const uint16_t port)
+ return ai;
+ }
+
++/*
++ * Create a listener socket on a specific bindaddr, and set
++ * special socket options to allow it to share the same port
++ * as other listeners.
++ *
++ * Returns an open, bound, and possibly listening network
++ * socket on success.
++ *
++ * Otherwise returns -1 if some error occurs.
++ */
++static int
++svc_create_sock(const struct sockaddr *sap, socklen_t salen,
++ struct netconfig *nconf)
++{
++ int fd, type, protocol;
++ int one = 1;
++
++ switch(nconf->nc_semantics) {
++ case NC_TPI_CLTS:
++ type = SOCK_DGRAM;
++ break;
++ case NC_TPI_COTS_ORD:
++ type = SOCK_STREAM;
++ break;
++ default:
++ xlog(D_GENERAL, "%s: Unrecognized bind address semantics: %u",
++ __func__, nconf->nc_semantics);
++ return -1;
++ }
++
++ if (strcmp(nconf->nc_proto, NC_UDP) == 0)
++ protocol = (int)IPPROTO_UDP;
++ else if (strcmp(nconf->nc_proto, NC_TCP) == 0)
++ protocol = (int)IPPROTO_TCP;
++ else {
++ xlog(D_GENERAL, "%s: Unrecognized bind address protocol: %s",
++ __func__, nconf->nc_proto);
++ return -1;
++ }
++
++ fd = socket((int)sap->sa_family, type, protocol);
++ if (fd == -1) {
++ xlog(L_ERROR, "Could not make a socket: (%d) %m",
++ errno);
++ return -1;
++ }
++
++#ifdef IPV6_SUPPORTED
++ if (sap->sa_family == AF_INET6) {
++ if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY,
++ &one, sizeof(one)) == -1) {
++ xlog(L_ERROR, "Failed to set IPV6_V6ONLY: (%d) %m",
++ errno);
++ (void)close(fd);
++ return -1;
++ }
++ }
++#endif /* IPV6_SUPPORTED */
++
++ if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
++ &one, sizeof(one)) == -1) {
++ xlog(L_ERROR, "Failed to set SO_REUSEADDR: (%d) %m",
++ errno);
++ (void)close(fd);
++ return -1;
++ }
++
++ if (bind(fd, sap, salen) == -1) {
++ xlog(L_ERROR, "Could not bind socket: (%d) %m",
++ errno);
++ (void)close(fd);
++ return -1;
++ }
++
++ if (nconf->nc_semantics == NC_TPI_COTS_ORD)
++ if (listen(fd, SOMAXCONN) == -1) {
++ xlog(L_ERROR, "Could not listen on socket: (%d) %m",
++ errno);
++ (void)close(fd);
++ return -1;
++ }
++
++ return fd;
++}
++
++/*
++ * The simple case is allowing the TI-RPC library to create a
++ * transport itself, given just the bind address and transport
++ * semantics.
++ *
++ * Our local xprt cache is ignored in this path, since the
++ * caller is not interested in sharing listeners or ports, and
++ * the library automatically avoids ports already in use.
++ *
++ * Returns the count of started listeners (one or zero).
++ */
+ static unsigned int
+-svc_create_nconf(const char *name, const rpcprog_t program,
++svc_create_nconf_rand_port(const char *name, const rpcprog_t program,
+ const rpcvers_t version,
+ void (*dispatch)(struct svc_req *, SVCXPRT *),
+- const uint16_t port, struct netconfig *nconf)
++ struct netconfig *nconf)
+ {
+ struct t_bind bindaddr;
+ struct addrinfo *ai;
+ SVCXPRT *xprt;
+
+- ai = svc_create_bindaddr(nconf, port);
++ ai = svc_create_bindaddr(nconf, 0);
+ if (ai == NULL)
+ return 0;
+
+@@ -119,7 +273,7 @@ svc_create_nconf(const char *name, const rpcprog_t program,
+ freeaddrinfo(ai);
+ if (xprt == NULL) {
+ xlog(D_GENERAL, "Failed to create listener xprt "
+- "(%s, %u, %s)", name, version, nconf->nc_netid);
++ "(%s, %u, %s)", name, version, nconf->nc_netid);
+ return 0;
+ }
+
+@@ -133,6 +287,93 @@ svc_create_nconf(const char *name, const rpcprog_t program,
+ return 1;
+ }
+
++/*
++ * If a port is specified on the command line, that port value will be
++ * the same for all listeners created here. Create each listener
++ * socket in advance and set SO_REUSEADDR, rather than allowing the
++ * RPC library to create the listeners for us on a randomly chosen
++ * port via svc_tli_create(RPC_ANYFD).
++ *
++ * Some callers want to listen for more than one RPC version using the
++ * same port number. For example, mountd could want to listen for MNT
++ * version 1, 2, and 3 requests. This means mountd must use the same
++ * set of listener sockets for multiple RPC versions, since, on one
++ * system, you can't have two listener sockets with the exact same
++ * bind address (and port) and transport protocol.
++ *
++ * To accomplish this, this function caches xprts as they are created.
++ * This cache is checked to see if a previously created xprt can be
++ * used, before creating a new xprt for this [program, version]. If
++ * there is a cached xprt with the same bindaddr and transport
++ * semantics, we simply register the new version with that xprt,
++ * rather than creating a fresh xprt for it.
++ *
++ * The xprt cache implemented here is local to a process. Two
++ * separate RPC daemons can not share a set of listeners.
++ *
++ * Returns the count of started listeners (one or zero).
++ */
++static unsigned int
++svc_create_nconf_fixed_port(const char *name, const rpcprog_t program,
++ const rpcvers_t version,
++ void (*dispatch)(struct svc_req *, SVCXPRT *),
++ const uint16_t port, struct netconfig *nconf)
++{
++ struct addrinfo *ai;
++ SVCXPRT *xprt;
++
++ ai = svc_create_bindaddr(nconf, port);
++ if (ai == NULL)
++ return 0;
++
++ xprt = svc_create_find_xprt(ai->ai_addr, nconf);
++ if (xprt == NULL) {
++ int fd;
++
++ fd = svc_create_sock(ai->ai_addr, ai->ai_addrlen, nconf);
++ if (fd == -1)
++ goto out_free;
++
++ xprt = svc_tli_create(fd, nconf, NULL, 0, 0);
++ if (xprt == NULL) {
++ xlog(D_GENERAL, "Failed to create listener xprt "
++ "(%s, %u, %s)", name, version, nconf->nc_netid);
++ (void)close(fd);
++ goto out_free;
++ }
++ }
++
++ if (!svc_reg(xprt, program, version, dispatch, nconf)) {
++ /* svc_reg(3) destroys @xprt in this case */
++ xlog(D_GENERAL, "Failed to register (%s, %u, %s)",
++ name, version, nconf->nc_netid);
++ goto out_free;
++ }
++
++ svc_create_cache_xprt(xprt);
++
++ freeaddrinfo(ai);
++ return 1;
++
++out_free:
++ freeaddrinfo(ai);
++ return 0;
++}
++
++static unsigned int
++svc_create_nconf(const char *name, const rpcprog_t program,
++ const rpcvers_t version,
++ void (*dispatch)(struct svc_req *, SVCXPRT *),
++ const uint16_t port, struct netconfig *nconf)
++{
++ if (port != 0)
++ return svc_create_nconf_fixed_port(name, program,
++ version, dispatch, port, nconf);
++
++ return svc_create_nconf_rand_port(name, program,
++ version, dispatch, nconf);
++}
++
+ /**
+ * nfs_svc_create - start up RPC svc listeners
+ * @name: C string containing name of new service
+@@ -145,8 +386,7 @@ svc_create_nconf(const char *name, const rpcprog_t program,
+ * the RPC dispatcher. Returns the number of started network transports.
+ */
+ unsigned int
+-nfs_svc_create(__attribute__((unused)) char *name,
+- const rpcprog_t program, const rpcvers_t version,
++nfs_svc_create(char *name, const rpcprog_t program, const rpcvers_t version,
+ void (*dispatch)(struct svc_req *, SVCXPRT *),
+ const uint16_t port)
+ {
+--
+1.7.3.1
+
diff --git a/net-fs/nfs-utils/nfs-utils-1.2.3-r1.ebuild b/net-fs/nfs-utils/nfs-utils-1.2.3-r1.ebuild
new file mode 100644
index 000000000000..cd3c9927a0e3
--- /dev/null
+++ b/net-fs/nfs-utils/nfs-utils-1.2.3-r1.ebuild
@@ -0,0 +1,108 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/nfs-utils-1.2.3-r1.ebuild,v 1.1 2010/11/14 00:49:39 vapier Exp $
+
+EAPI="2"
+
+inherit eutils flag-o-matic multilib
+
+DESCRIPTION="NFS client and server daemons"
+HOMEPAGE="http://linux-nfs.org/"
+SRC_URI="mirror://sourceforge/nfs/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="caps ipv6 kerberos +nfsv3 +nfsv4 tcpd elibc_glibc"
+RESTRICT="test" #315573
+
+# kth-krb doesn't provide the right include
+# files, and nfs-utils doesn't build against heimdal either,
+# so don't depend on virtual/krb.
+# (04 Feb 2005 agriffis)
+DEPEND_COMMON="tcpd? ( sys-apps/tcp-wrappers )
+ caps? ( sys-libs/libcap )
+ sys-libs/e2fsprogs-libs
+ net-nds/rpcbind
+ net-libs/libtirpc
+ nfsv4? (
+ >=dev-libs/libevent-1.0b
+ >=net-libs/libnfsidmap-0.21-r1
+ kerberos? (
+ net-libs/librpcsecgss
+ net-libs/libgssglue
+ net-libs/libtirpc[kerberos]
+ app-crypt/mit-krb5
+ )
+ )"
+RDEPEND="${DEPEND_COMMON} !net-nds/portmap"
+# util-linux dep is to prevent man-page collision
+DEPEND="${DEPEND_COMMON}
+ >=sys-apps/util-linux-2.12r-r7"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-1.1.4-mtab-sym.patch
+ epatch "${FILESDIR}"/${PN}-1.1.4-no-exec.patch
+ epatch "${FILESDIR}"/${P}-ti-rpc-static-ports.patch #340797
+}
+
+src_configure() {
+ econf \
+ --with-statedir=/var/lib/nfs \
+ --enable-tirpc \
+ $(use_with tcpd tcp-wrappers) \
+ $(use_enable nfsv3) \
+ $(use_enable nfsv4) \
+ $(use_enable ipv6) \
+ $(use_enable caps) \
+ $(use nfsv4 && use_enable kerberos gss || echo "--disable-gss")
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+
+ # Don't overwrite existing xtab/etab, install the original
+ # versions somewhere safe... more info in pkg_postinst
+ keepdir /var/lib/nfs/{,sm,sm.bak}
+ mv "${D}"/var/lib "${D}"/usr/$(get_libdir) || die
+
+ # Install some client-side binaries in /sbin
+ dodir /sbin
+ mv "${D}"/usr/sbin/rpc.statd "${D}"/sbin/ || die
+
+ dodoc ChangeLog README
+ docinto linux-nfs ; dodoc linux-nfs/*
+
+ insinto /etc
+ doins "${FILESDIR}"/exports
+
+ local f list="" opt_need=""
+ if use nfsv4 ; then
+ opt_need="rpc.idmapd"
+ list="${list} rpc.idmapd rpc.pipefs"
+ use kerberos && list="${list} rpc.gssd rpc.svcgssd"
+ fi
+ for f in nfs nfsmount rpc.statd ${list} ; do
+ newinitd "${FILESDIR}"/${f}.initd ${f} || die "doinitd ${f}"
+ done
+ newconfd "${FILESDIR}"/nfs.confd nfs
+ dosed "/^NFS_NEEDED_SERVICES=/s:=.*:=\"${opt_need}\":" /etc/conf.d/nfs #234132
+
+ # uClibc doesn't provide rpcgen like glibc, so lets steal it from nfs-utils
+ if ! use elibc_glibc ; then
+ dobin tools/rpcgen/rpcgen || die "rpcgen"
+ newdoc tools/rpcgen/README README.rpcgen
+ fi
+}
+
+pkg_postinst() {
+ # Install default xtab and friends if there's none existing. In
+ # src_install we put them in /usr/lib/nfs for safe-keeping, but
+ # the daemons actually use the files in /var/lib/nfs. #30486
+ local f
+ for f in "${ROOT}"/usr/$(get_libdir)/nfs/*; do
+ [[ -e ${ROOT}/var/lib/nfs/${f##*/} ]] && continue
+ einfo "Copying default ${f##*/} from /usr/$(get_libdir)/nfs to /var/lib/nfs"
+ cp -pPR "${f}" "${ROOT}"/var/lib/nfs/
+ done
+}