From: "Gilles Dartiguelongue" <eva@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] dev/eva:master commit in: net-fs/nfs-utils/files/, net-fs/nfs-utils/
Date: Tue, 8 Mar 2011 13:03:35 +0000 (UTC) [thread overview]
Message-ID: <c2f4f62e9b0f305a5d717c6f889591bcaf59b786.eva@gentoo> (raw)
commit: c2f4f62e9b0f305a5d717c6f889591bcaf59b786
Author: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 8 13:02:26 2011 +0000
Commit: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
CommitDate: Tue Mar 8 13:02:26 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/eva.git;a=commit;h=c2f4f62e
net-fs/nfs-utils: add nfs.idmap patch
Add required patch to make NFS_USE_NEW_IDMAPPER=y option work with
>=2.6.37 kernels.
---
net-fs/nfs-utils/Manifest | 16 +
net-fs/nfs-utils/files/exports | 1 +
.../nfs-utils/files/nfs-utils-1.1.4-mtab-sym.patch | 39 +++
.../nfs-utils/files/nfs-utils-1.1.4-no-exec.patch | 15 +
.../files/nfs-utils-1.1.4-rpcgen-ioctl.patch | 13 +
.../files/nfs-utils-1.2.3-nfs-idmap.patch | 271 +++++++++++++++
.../nfs-utils-1.2.3-ti-rpc-static-ports.patch | 352 ++++++++++++++++++++
net-fs/nfs-utils/files/nfs.confd | 34 ++
net-fs/nfs-utils/files/nfs.initd | 162 +++++++++
net-fs/nfs-utils/files/nfsmount.initd | 48 +++
net-fs/nfs-utils/files/rpc.gssd.initd | 24 ++
net-fs/nfs-utils/files/rpc.idmapd.initd | 26 ++
net-fs/nfs-utils/files/rpc.pipefs.initd | 24 ++
net-fs/nfs-utils/files/rpc.statd.initd | 33 ++
net-fs/nfs-utils/files/rpc.svcgssd.initd | 24 ++
net-fs/nfs-utils/nfs-utils-1.2.3-r2.ebuild | 111 ++++++
16 files changed, 1193 insertions(+), 0 deletions(-)
diff --git a/net-fs/nfs-utils/Manifest b/net-fs/nfs-utils/Manifest
new file mode 100644
index 0000000..6accc7c
--- /dev/null
+++ b/net-fs/nfs-utils/Manifest
@@ -0,0 +1,16 @@
+AUX exports 66 RMD160 0a61ad40dc321be39fb54d5b9fe717caa714e878 SHA1 52ed6b74643e084cfc17ff4638c2e06c86602034 SHA256 5d6356df546682e2f1a87131d1bb67de9b1f9a34d3a5742343dc64e890cf71d5
+AUX nfs-utils-1.1.4-mtab-sym.patch 1020 RMD160 72c6ebb9d02ec544b5b2d7ad3ad0c8035d248eb1 SHA1 50db1976ac25607faf8f003573f9d8529e5b4de6 SHA256 0232799d085151649a1eb1f31644105de7e5cfba888794354005499a0db277c3
+AUX nfs-utils-1.1.4-no-exec.patch 297 RMD160 59e6f4bf2c782c0c107cd135589c4abcba1a5978 SHA1 aa7239b22cf73abb1790bb9a88407cea8fd56779 SHA256 f66af9d046a3524ae8920f8e4b5d0fa206de31d4e7747bfc716a10ac86537b0f
+AUX nfs-utils-1.1.4-rpcgen-ioctl.patch 414 RMD160 f07264e24f374d6a65dbc8c2b1dfed3755099ddc SHA1 c7df5e9b309b389a1b0d85e539771af43d3e8d98 SHA256 78ae8ba33a600e6eb1153521eeb0ec5c3c5c503bd20074b1687703b3f83be678
+AUX nfs-utils-1.2.3-nfs-idmap.patch 7324 RMD160 c8966ac631bea87a22f193d830a5d4c11c31381b SHA1 1b873fe6f2e3e9ae5ca5ae016db057920da67c53 SHA256 04a1173e62223d950c98e0e6234503407f380fbfeaac40ddde620f3f6ee17e7c
+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 4354 RMD160 0901f7c5aaded698c11816bbaa37b3b152db4c0c SHA1 62ffdc3b6998506b4746ce1a5b26b4aec7108701 SHA256 ea09e0f993d2973e9f308fd720c988c42de7844c6a046410e8e54beb8693e050
+AUX nfsmount.initd 1130 RMD160 7ac01f228fcd9539e11cf200a0ba2ed82987a91b SHA1 1f4bfd0155489b6ce2e044f34d057c222202b1bb SHA256 4d6965abb56b72bdcd18cbf900b6e1614d12da6b92b1a5b18727c36eaa131d37
+AUX rpc.gssd.initd 567 RMD160 26d42451b9fc0e90297b5e0381d2632a57dc4c51 SHA1 041e59d915a0ab183a3e0b50abbf58394d2e89b9 SHA256 00d9c29280a83e8458c33139d04a9b38c6fdba9d7cb9b420ca83bf6b10e6435d
+AUX rpc.idmapd.initd 595 RMD160 45f3e7c83555113052a302b66ba160171f90400a SHA1 4c387d27dd11dcfe896dd937c69cd391c1936123 SHA256 3ce65326859c43983dad25ad2d4731488c488037796e39b6b5eda336e8bf81ef
+AUX rpc.pipefs.initd 788 RMD160 9ed8a4511e7ce05c67bc3a4c3c9d81ef0cfb6e45 SHA1 c184ab0c0df8b480e6f2e23dbe8360b99d1411a9 SHA256 d651ad9099ea443282476fcedf52c00f0a274eb6a9e4b58a5838780369206973
+AUX rpc.statd.initd 818 RMD160 d87fc8aed1638955444b587fc5404db671d5a8fb SHA1 bd73058b722d2f51a67bbbdec8ed029094fb9683 SHA256 0c7bd35a14da6c0c2577f09ae82a41ddb693a88157eeaf80684616f79be6c304
+AUX rpc.svcgssd.initd 584 RMD160 9488050225453f6b083be78ed3de1b042d02cfb8 SHA1 3dc09a20ca1cefd902b8709b094a4e0c0e9a407c SHA256 f1c460d8b0e91e54a551397d755135d05a3728d81de596535bf8bda074455677
+DIST nfs-utils-1.2.3.tar.bz2 672759 RMD160 dad6fe83fa60c4854849e36d2128208c4e3234ab SHA1 da70a29191b07056d71b6e427a87d5cfd8628523 SHA256 5575ece941097cbfa67fbe0d220dfa11b73f5e6d991e7939c9339bd72259ff19
+EBUILD nfs-utils-1.2.3-r2.ebuild 3348 RMD160 3fbd317b149f623599e4ba0c266de92262960d3e SHA1 6a2f53ef3af64ccb13bcbdc21c7b2dfb01cc2aee SHA256 24bd87b13099b810ac8fdf45658dbd28c992b5d7fe517c09a875bc4d0b193a77
diff --git a/net-fs/nfs-utils/files/exports b/net-fs/nfs-utils/files/exports
new file mode 100644
index 0000000..5102ef2
--- /dev/null
+++ b/net-fs/nfs-utils/files/exports
@@ -0,0 +1 @@
+# /etc/exports: NFS file systems being exported. See exports(5).
diff --git a/net-fs/nfs-utils/files/nfs-utils-1.1.4-mtab-sym.patch b/net-fs/nfs-utils/files/nfs-utils-1.1.4-mtab-sym.patch
new file mode 100644
index 0000000..c9e60af
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfs-utils-1.1.4-mtab-sym.patch
@@ -0,0 +1,39 @@
+ripped from Debian
+
+--- nfs-utils-1.1.4/utils/mount/fstab.c
++++ nfs-utils-1.1.4/utils/mount/fstab.c
+@@ -57,7 +57,7 @@ mtab_does_not_exist(void) {
+ return var_mtab_does_not_exist;
+ }
+
+-static int
++int
+ mtab_is_a_symlink(void) {
+ get_mtab_info();
+ return var_mtab_is_a_symlink;
+--- nfs-utils-1.1.4/utils/mount/fstab.h
++++ nfs-utils-1.1.4/utils/mount/fstab.h
+@@ -7,6 +7,7 @@
+ #define _PATH_FSTAB "/etc/fstab"
+ #endif
+
++int mtab_is_a_symlink(void);
+ int mtab_is_writable(void);
+ int mtab_does_not_exist(void);
+ void reset_mtab_info(void);
+--- nfs-utils-1.1.4/utils/mount/mount.c
++++ nfs-utils-1.1.4/utils/mount/mount.c
+@@ -230,6 +230,13 @@ create_mtab (void) {
+ int flags;
+ mntFILE *mfp;
+
++ /* Avoid writing if the mtab is a symlink to /proc/mounts, since
++ that would create a file /proc/mounts in case the proc filesystem
++ is not mounted, and the fchmod below would also fail. */
++ if (mtab_is_a_symlink()) {
++ return EX_SUCCESS;
++ }
++
+ lock_mtab();
+
+ mfp = nfs_setmntent (MOUNTED, "a+");
diff --git a/net-fs/nfs-utils/files/nfs-utils-1.1.4-no-exec.patch b/net-fs/nfs-utils/files/nfs-utils-1.1.4-no-exec.patch
new file mode 100644
index 0000000..ea50a21
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfs-utils-1.1.4-no-exec.patch
@@ -0,0 +1,15 @@
+ripped from Debian
+
+--- nfs-utils-1.1.2/utils/mount/mount.c
++++ nfs-utils-1.1.2/utils/mount/mount.c
+@@ -381,10 +381,6 @@
+ mount_error(NULL, mount_point, ENOTDIR);
+ return 1;
+ }
+- if (access(mount_point, X_OK) < 0) {
+- mount_error(NULL, mount_point, errno);
+- return 1;
+- }
+
+ return 0;
+ }
diff --git a/net-fs/nfs-utils/files/nfs-utils-1.1.4-rpcgen-ioctl.patch b/net-fs/nfs-utils/files/nfs-utils-1.1.4-rpcgen-ioctl.patch
new file mode 100644
index 0000000..1765418
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfs-utils-1.1.4-rpcgen-ioctl.patch
@@ -0,0 +1,13 @@
+http://bugs.gentoo.org/174393
+
+--- tools/rpcgen/rpc_main.c
++++ tools/rpcgen/rpc_main.c
+@@ -548,7 +548,7 @@
+ f_print(fout, "#include <sys/ttycom.h>/* TIOCNOTTY */\n");
+ #else
+ if( !tirpcflag )
+- f_print(fout, "#include <sys/ttycom.h>/* TIOCNOTTY */\n");
++ f_print(fout, "#include <sys/ioctl.h>/* TIOCNOTTY */\n");
+ #endif
+ if( Cflag && (inetdflag || pmflag ) ) {
+ f_print(fout, "#ifdef __cplusplus\n");
diff --git a/net-fs/nfs-utils/files/nfs-utils-1.2.3-nfs-idmap.patch b/net-fs/nfs-utils/files/nfs-utils-1.2.3-nfs-idmap.patch
new file mode 100644
index 0000000..cd6e121
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfs-utils-1.2.3-nfs-idmap.patch
@@ -0,0 +1,271 @@
+From: Bryan Schumaker <bjschuma@netapp.com>
+Date: Tue, 26 Oct 2010 17:17:40 +0000 (-0400)
+Subject: nfs-utils: add nfs.idmap
+X-Git-Url: http://git.linux-nfs.org/?p=trondmy%2Fnfs-utils.git;a=commitdiff_plain;h=fafeed5d010070717e5af94b8729558df0b281af;hp=c62d756402509ca5d07c1fd4d2e5a9d78dc4171b
+
+nfs-utils: add nfs.idmap
+
+This patch adds the nfs.idmap program to nfs-utils. This program is called by
+the nfs idmapper through request-keys to map between uid / user name and
+gid / group name.
+
+Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
+Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
+---
+
+diff --git a/aclocal/keyutils.m4 b/aclocal/keyutils.m4
+new file mode 100644
+index 0000000..8aea646
+--- /dev/null
++++ b/aclocal/keyutils.m4
+@@ -0,0 +1,11 @@
++dnl Checks for keyutils library and headers
++dnl
++AC_DEFUN([AC_KEYUTILS], [
++
++ dnl Check for libkeyutils; do not add to LIBS if found
++ AC_CHECK_LIB([keyutils], [keyctl_instantiate], [LIBKEYUTILS=-lkeyutils], ,)
++ AC_SUBST(LIBKEYUTILS)
++
++ AC_CHECK_HEADERS([keyutils.h], ,
++ [AC_MSG_ERROR([keyutils.h header not found.])])
++])dnl
+diff --git a/configure.ac b/configure.ac
+index 3058be6..0907f72 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -247,6 +247,9 @@ if test "$enable_nfsv4" = yes; then
+ dnl check for nfsidmap libraries and headers
+ AC_LIBNFSIDMAP
+
++ dnl check for the keyutils libraries and headers
++ AC_KEYUTILS
++
+ dnl librpcsecgss already has a dependency on libgssapi,
+ dnl but we need to make sure we get the right version
+ if test "$enable_gss" = yes; then
+@@ -435,6 +438,7 @@ AC_CONFIG_FILES([
+ utils/mountd/Makefile
+ utils/nfsd/Makefile
+ utils/nfsstat/Makefile
++ utils/nfs.idmap/Makefile
+ utils/showmount/Makefile
+ utils/statd/Makefile
+ tests/Makefile
+diff --git a/utils/Makefile.am b/utils/Makefile.am
+index 8665183..332ecff 100644
+--- a/utils/Makefile.am
++++ b/utils/Makefile.am
+@@ -4,6 +4,7 @@ OPTDIRS =
+
+ if CONFIG_NFSV4
+ OPTDIRS += idmapd
++OPTDIRS += nfs.idmap
+ endif
+
+ if CONFIG_GSS
+diff --git a/utils/nfs.idmap/Makefile.am b/utils/nfs.idmap/Makefile.am
+new file mode 100644
+index 0000000..29e17af
+--- /dev/null
++++ b/utils/nfs.idmap/Makefile.am
+@@ -0,0 +1,9 @@
++## Process this file with automake to produce Makefile.in
++
++man8_MANS = nfs.idmap.man
++
++sbin_PROGRAMS = nfs.idmap
++nfs_idmap_SOURCES = nfs.idmap.c
++nfs_idmap_LDADD = -lnfsidmap -lkeyutils
++
++MAINTAINERCLEANFILES = Makefile.in
+diff --git a/utils/nfs.idmap/nfs.idmap.c b/utils/nfs.idmap/nfs.idmap.c
+new file mode 100644
+index 0000000..abbcb65
+--- /dev/null
++++ b/utils/nfs.idmap/nfs.idmap.c
+@@ -0,0 +1,118 @@
++
++#include <stdarg.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++
++#include <pwd.h>
++#include <grp.h>
++#include <keyutils.h>
++#include <nfsidmap.h>
++
++#include <syslog.h>
++
++/* gcc nfs.idmap.c -o nfs.idmap -l nfsidmap -l keyutils */
++
++#define MAX_ID_LEN 11
++#define IDMAP_NAMESZ 128
++#define USER 1
++#define GROUP 0
++
++
++/*
++ * Find either a user or group id based on the name@domain string
++ */
++int id_lookup(char *name_at_domain, key_serial_t key, int type)
++{
++ char id[MAX_ID_LEN];
++ uid_t uid = 0;
++ gid_t gid = 0;
++ int rc;
++
++ if (type == USER) {
++ rc = nfs4_owner_to_uid(name_at_domain, &uid);
++ sprintf(id, "%u", uid);
++ } else {
++ rc = nfs4_group_owner_to_gid(name_at_domain, &gid);
++ sprintf(id, "%u", gid);
++ }
++
++ if (rc == 0)
++ rc = keyctl_instantiate(key, id, strlen(id) + 1, 0);
++
++ return rc;
++}
++
++/*
++ * Find the name@domain string from either a user or group id
++ */
++int name_lookup(char *id, key_serial_t key, int type)
++{
++ char name[IDMAP_NAMESZ];
++ char domain[NFS4_MAX_DOMAIN_LEN];
++ uid_t uid;
++ gid_t gid;
++ int rc;
++
++ rc = nfs4_get_default_domain(NULL, domain, NFS4_MAX_DOMAIN_LEN);
++ if (rc != 0) {
++ rc = -1;
++ goto out;
++ }
++
++ if (type == USER) {
++ uid = atoi(id);
++ rc = nfs4_uid_to_name(uid, domain, name, IDMAP_NAMESZ);
++ } else {
++ gid = atoi(id);
++ rc = nfs4_gid_to_name(gid, domain, name, IDMAP_NAMESZ);
++ }
++
++ if (rc == 0)
++ rc = keyctl_instantiate(key, &name, strlen(name), 0);
++
++out:
++ return rc;
++}
++
++int main(int argc, char **argv)
++{
++ char *arg;
++ char *value;
++ char *type;
++ int rc = 1;
++ int timeout = 600;
++ key_serial_t key;
++
++ if (argc < 3)
++ return 1;
++
++ arg = malloc(sizeof(char) * strlen(argv[2]) + 1);
++ strcpy(arg, argv[2]);
++ type = strtok(arg, ":");
++ value = strtok(NULL, ":");
++
++ if (argc == 4) {
++ timeout = atoi(argv[3]);
++ if (timeout < 0)
++ timeout = 0;
++ }
++
++ key = strtol(argv[1], NULL, 10);
++
++ if (strcmp(type, "uid") == 0)
++ rc = id_lookup(value, key, USER);
++ else if (strcmp(type, "gid") == 0)
++ rc = id_lookup(value, key, GROUP);
++ else if (strcmp(type, "user") == 0)
++ rc = name_lookup(value, key, USER);
++ else if (strcmp(type, "group") == 0)
++ rc = name_lookup(value, key, GROUP);
++
++ /* Set timeout to 5 (600 seconds) minutes */
++ if (rc == 0)
++ keyctl_set_timeout(key, timeout);
++
++ free(arg);
++ return rc;
++}
+diff --git a/utils/nfs.idmap/nfs.idmap.man b/utils/nfs.idmap/nfs.idmap.man
+new file mode 100644
+index 0000000..3b51b8e
+--- /dev/null
++++ b/utils/nfs.idmap/nfs.idmap.man
+@@ -0,0 +1,60 @@
++.\"
++.\"@(#)nfs.idmap(8) - The NFS idmapper upcall program
++.\"
++.\" Copyright (C) 2010 Bryan Schumaker <bjschuma@netapp.com>
++.TH nfs.idmap 5 "1 October 2010"
++.SH NAME
++nfs.idmap \- The NFS idmapper upcall program
++.SH DESCRIPTION
++The file
++.I /usr/sbin/idmap
++is used by the NFS idmapper to translate user and group ids into names, and to
++translate user and group names into ids. Idmapper uses request-key to perform
++the upcall and cache the result.
++.I /usr/sbin/idmap
++should only be called by request-key, and will perform the translation and
++initialize a key with the resulting information.
++.PP
++NFS_USE_NEW_IDMAPPER must be selected when configuring the kernel to use this
++feature.
++.SH CONFIGURING
++The file
++.I /etc/request-key.conf
++will need to be modified so
++.I /sbin/request-key
++can properly direct the upcall. The following line should be added before a call
++to keyctl negate:
++.PP
++create id_resolver * * /usr/sbin/nfs.idmap %k %d 600
++.PP
++This will direct all nfs_idmap requests to the program
++.I /usr/sbin/nfs.idmap
++The last parameter, 600, defines how many seconds into the future the key will
++expire. This is an optional parameter for
++.I /usr/sbin/nfs.idmap
++and will default to 600 seconds when not specified.
++.PP
++The idmapper system uses four key descriptions:
++.PP
++ uid: Find the UID for the given user
++.br
++ gid: Find the GID for the given group
++.br
++ user: Find the user name for the given UID
++.br
++ group: Find the group name for the given GID
++.PP
++You can choose to handle any of these individually, rather than using the
++generic upcall program. If you would like to use your own program for a uid
++lookup then you would edit your request-key.conf so it looks similar to this:
++.PP
++create id_resolver uid:* * /some/other/program %k %d 600
++.br
++create id_resolver * * /usr/sbin/nfs.idmap %k %d 600
++.PP
++Notice that the new line was added above the line for the generic program.
++request-key will find the first matching line and run the corresponding program.
++In this case, /some/other/program will handle all uid lookups, and
++/usr/sbin/nfs.idmap will handle gid, user, and group lookups.
++.SH AUTHOR
++Bryan Schumaker, <bjschuma@netapp.com>
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 0000000..b66e981
--- /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/files/nfs.confd b/net-fs/nfs-utils/files/nfs.confd
new file mode 100644
index 0000000..ad9e34f
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfs.confd
@@ -0,0 +1,34 @@
+# /etc/conf.d/nfs
+
+# If you wish to set the port numbers for lockd,
+# please see /etc/sysctl.conf
+
+# Optional services to include in default `/etc/init.d/nfs start`
+# For NFSv4 users, you'll want to add "rpc.idmapd" here.
+NFS_NEEDED_SERVICES=""
+
+# Number of servers to be started up by default
+OPTS_RPC_NFSD="8"
+
+# Options to pass to rpc.mountd
+# ex. OPTS_RPC_MOUNTD="-p 32767"
+OPTS_RPC_MOUNTD=""
+
+# Options to pass to rpc.statd
+# ex. OPTS_RPC_STATD="-p 32765 -o 32766"
+OPTS_RPC_STATD=""
+
+# Options to pass to rpc.idmapd
+OPTS_RPC_IDMAPD=""
+
+# Options to pass to rpc.gssd
+OPTS_RPC_GSSD=""
+
+# Options to pass to rpc.svcgssd
+OPTS_RPC_SVCGSSD=""
+
+# Options to pass to rpc.rquotad (requires sys-fs/quota)
+OPTS_RPC_RQUOTAD=""
+
+# Timeout (in seconds) for exportfs
+EXPORTFS_TIMEOUT=30
diff --git a/net-fs/nfs-utils/files/nfs.initd b/net-fs/nfs-utils/files/nfs.initd
new file mode 100755
index 0000000..a3db075
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfs.initd
@@ -0,0 +1,162 @@
+#!/sbin/runscript
+# 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/files/nfs.initd,v 1.23 2010/11/21 19:56:56 vapier Exp $
+
+opts="reload"
+
+# This variable is used for controlling whether or not to run exportfs -ua;
+# see stop() for more information
+restarting=no
+
+# The binary locations
+exportfs=/usr/sbin/exportfs
+ mountd=/usr/sbin/rpc.mountd
+ nfsd=/usr/sbin/rpc.nfsd
+smnotify=/usr/sbin/sm-notify
+
+depend() {
+ local myneed=""
+ if [ -e /etc/exports ] ; then
+ # XXX: no way to detect NFSv4 is desired and so need rpc.idmapd
+ myneed="${myneed} $(
+ awk '!/^[[:space:]]*#/ {
+ # clear the path to avoid spurious matches
+ $1 = "";
+ if ($0 ~ /[(][^)]*sec=(krb|spkm)[^)]*[)]/) {
+ print "rpc.svcgssd"
+ exit 0
+ }
+ }' /etc/exports
+ )"
+ fi
+ config /etc/exports
+ need portmap rpc.statd ${myneed} ${NFS_NEEDED_SERVICES}
+ use ypbind net dns rpc.rquotad rpc.idmapd rpc.svcgssd
+ after quota
+}
+
+mkdir_nfsdirs() {
+ local d
+ for d in rpc_pipefs v4recovery v4root ; do
+ d="/var/lib/nfs/${d}"
+ [ ! -d "${d}" ] && mkdir -p "${d}"
+ done
+}
+
+waitfor_exportfs() {
+ local pid=$1
+ ( sleep ${EXPORTFS_TIMEOUT:-30}; kill -9 $pid 2>/dev/null ) &
+ wait $1
+}
+
+mount_nfsd() {
+ if [ -e /proc/modules ] ; then
+ # Make sure nfs support is loaded in the kernel #64709
+ if ! grep -qs nfsd /proc/filesystems ; then
+ modprobe -q nfsd
+ fi
+ # Restart idmapd if needed #220747
+ if grep -qs nfsd /proc/modules ; then
+ killall -q -HUP rpc.idmapd
+ fi
+ fi
+
+ # This is the new "kernel 2.6 way" to handle the exports file
+ if grep -qs nfsd /proc/filesystems ; then
+ if ! grep -qs "nfsd /proc/fs/nfsd" /proc/mounts ; then
+ ebegin "Mounting nfsd filesystem in /proc"
+ mount -t nfsd -o nodev,noexec,nosuid nfsd /proc/fs/nfsd
+ eend $?
+ fi
+ fi
+}
+
+start_it() {
+ ebegin "Starting NFS $1"
+ shift
+ "$@"
+ eend $?
+ ret=$((ret + $?))
+}
+start() {
+ mount_nfsd
+ mkdir_nfsdirs
+
+ # Exportfs likes to hang if networking isn't working.
+ # If that's the case, then try to kill it so the
+ # bootup process can continue.
+ if grep -qs '^[[:space:]]*/' /etc/exports ; then
+ ebegin "Exporting NFS directories"
+ ${exportfs} -r &
+ waitfor_exportfs $!
+ eend $?
+ fi
+
+ local ret=0
+ start_it mountd ${mountd} ${OPTS_RPC_MOUNTD}
+ start_it daemon ${nfsd} ${OPTS_RPC_NFSD}
+ [ -x "${smnotify}" ] && start_it smnotify ${smnotify} ${OPTS_SMNOTIFY}
+ return ${ret}
+}
+
+stop() {
+ local ret=0
+
+ # Don't check NFSSERVER variable since it might have changed,
+ # instead use --oknodo to smooth things over
+ ebegin "Stopping NFS mountd"
+ start-stop-daemon --stop --oknodo --exec ${mountd}
+ eend $?
+ ret=$((ret + $?))
+
+ # nfsd sets its process name to [nfsd] so don't look for $nfsd
+ ebegin "Stopping NFS daemon"
+ start-stop-daemon --stop --oknodo --name nfsd --user root --signal 2
+ eend $?
+ ret=$((ret + $?))
+ # in case things don't work out ... #228127
+ rpc.nfsd 0
+
+ # When restarting the NFS server, running "exportfs -ua" probably
+ # isn't what the user wants. Running it causes all entries listed
+ # in xtab to be removed from the kernel export tables, and the
+ # xtab file is cleared. This effectively shuts down all NFS
+ # activity, leaving all clients holding stale NFS filehandles,
+ # *even* when the NFS server has restarted.
+ #
+ # That's what you would want if you were shutting down the NFS
+ # server for good, or for a long period of time, but not when the
+ # NFS server will be running again in short order. In this case,
+ # then "exportfs -r" will reread the xtab, and all the current
+ # clients will be able to resume NFS activity, *without* needing
+ # to umount/(re)mount the filesystem.
+ if [ "${restarting}" = no -o "${RC_CMD}" = "restart" ] ; then
+ ebegin "Unexporting NFS directories"
+ # Exportfs likes to hang if networking isn't working.
+ # If that's the case, then try to kill it so the
+ # shutdown process can continue.
+ ${exportfs} -ua &
+ waitfor_exportfs $!
+ eend $?
+ fi
+
+ return ${ret}
+}
+
+reload() {
+ # Exportfs likes to hang if networking isn't working.
+ # If that's the case, then try to kill it so the
+ # bootup process can continue.
+ ebegin "Reloading /etc/exports"
+ ${exportfs} -r 1>&2 &
+ waitfor_exportfs $!
+ eend $?
+}
+
+restart() {
+ # See long comment in stop() regarding "restarting" and exportfs -ua
+ restarting=yes
+ svc_stop
+ svc_start
+}
diff --git a/net-fs/nfs-utils/files/nfsmount.initd b/net-fs/nfs-utils/files/nfsmount.initd
new file mode 100755
index 0000000..62bf028
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfsmount.initd
@@ -0,0 +1,48 @@
+#!/sbin/runscript
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/nfsmount.initd,v 1.14 2010/06/28 21:03:11 vapier Exp $
+
+[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs
+
+depend() {
+ local myneed=""
+ if [ -e /etc/fstab ] ; then
+ myneed="${myneed} $(
+ awk '!/^[[:space:]]*#/ && ($3 == "nfs" || $3 == "nfs4") {
+ if ($3 == "nfs4")
+ idmapd = "rpc.idmapd"
+ if ($4 ~ /sec=(krb|spkm)/)
+ gssd = "rpc.gssd"
+ }
+ END { print idmapd " " gssd }
+ ' /etc/fstab
+ )"
+ fi
+ config /etc/fstab
+ need net portmap rpc.statd ${myneed}
+ use ypbind dns rpc.idmapd rpc.gssd
+}
+
+start() {
+ if [ -x /usr/sbin/sm-notify ] ; then
+ ebegin "Starting NFS sm-notify"
+ /usr/sbin/sm-notify ${OPTS_SMNOTIFY}
+ eend $?
+ fi
+
+ # Make sure nfs support is loaded in the kernel #64709
+ if [ -e /proc/modules ] && ! grep -qs 'nfs$' /proc/filesystems ; then
+ modprobe -q nfs
+ fi
+
+ ebegin "Mounting NFS filesystems"
+ mount -a -t nfs,nfs4
+ eend $?
+}
+
+stop() {
+ ebegin "Unmounting NFS filesystems"
+ umount -a -t nfs,nfs4
+ eend $?
+}
diff --git a/net-fs/nfs-utils/files/rpc.gssd.initd b/net-fs/nfs-utils/files/rpc.gssd.initd
new file mode 100755
index 0000000..f1b8f87
--- /dev/null
+++ b/net-fs/nfs-utils/files/rpc.gssd.initd
@@ -0,0 +1,24 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.gssd.initd,v 1.11 2008/10/26 09:02:47 vapier Exp $
+
+[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs
+
+depend() {
+ use ypbind net
+ need portmap rpc.pipefs
+ after quota
+}
+
+start() {
+ ebegin "Starting gssd"
+ start-stop-daemon --start --exec /usr/sbin/rpc.gssd -- ${OPTS_RPC_GSSD}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping gssd"
+ start-stop-daemon --stop --exec /usr/sbin/rpc.gssd
+ eend $?
+}
diff --git a/net-fs/nfs-utils/files/rpc.idmapd.initd b/net-fs/nfs-utils/files/rpc.idmapd.initd
new file mode 100755
index 0000000..52838b5
--- /dev/null
+++ b/net-fs/nfs-utils/files/rpc.idmapd.initd
@@ -0,0 +1,26 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.idmapd.initd,v 1.8 2009/03/14 18:43:18 vapier Exp $
+
+[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs
+
+rpc_bin=/usr/sbin/rpc.idmapd
+
+depend() {
+ use ypbind net
+ need portmap rpc.pipefs
+ after quota
+}
+
+start() {
+ ebegin "Starting idmapd"
+ ${rpc_bin} ${OPTS_RPC_IDMAPD}
+ eend $? "make sure DNOTIFY support is enabled ..."
+}
+
+stop() {
+ ebegin "Stopping idmapd"
+ start-stop-daemon --stop --exec ${rpc_bin}
+ eend $?
+}
diff --git a/net-fs/nfs-utils/files/rpc.pipefs.initd b/net-fs/nfs-utils/files/rpc.pipefs.initd
new file mode 100644
index 0000000..701ac77
--- /dev/null
+++ b/net-fs/nfs-utils/files/rpc.pipefs.initd
@@ -0,0 +1,24 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.pipefs.initd,v 1.1 2008/10/26 09:02:47 vapier Exp $
+
+mount_pipefs() {
+ # if rpc_pipefs is not available, try to load sunrpc for it #219566
+ grep -qs rpc_pipefs /proc/filesystems || modprobe -q sunrpc
+ # if still not available, let's bail
+ grep -qs rpc_pipefs /proc/filesystems || return 1
+
+ # now just do it for kicks
+ mkdir -p /var/lib/nfs/rpc_pipefs
+ mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
+}
+
+start() {
+ # if things are already mounted, let's just return
+ grep -qs "rpc_pipefs /var/lib/nfs/rpc_pipefs" /proc/mounts && return 0
+
+ ebegin "Mounting RPC pipefs"
+ mount_pipefs
+ eend $?
+}
diff --git a/net-fs/nfs-utils/files/rpc.statd.initd b/net-fs/nfs-utils/files/rpc.statd.initd
new file mode 100755
index 0000000..14f8b34
--- /dev/null
+++ b/net-fs/nfs-utils/files/rpc.statd.initd
@@ -0,0 +1,33 @@
+#!/sbin/runscript
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.statd.initd,v 1.7 2009/01/31 22:16:11 vapier Exp $
+
+[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs
+
+rpc_bin=/sbin/rpc.statd
+rpc_pid=/var/run/rpc.statd.pid
+
+depend() {
+ use ypbind net
+ need portmap
+ after quota
+}
+
+start() {
+ # Don't start rpc.statd if already started by someone else ...
+ # Don't try and kill it if it's already dead ...
+ if killall -q -0 ${rpc_bin} ; then
+ return 0
+ fi
+
+ ebegin "Starting NFS statd"
+ start-stop-daemon --start --exec ${rpc_bin} -- --no-notify ${OPTS_RPC_STATD}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping NFS statd"
+ start-stop-daemon --stop --exec ${rpc_bin} --pidfile /var/run/rpc.statd.pid
+ eend $?
+}
diff --git a/net-fs/nfs-utils/files/rpc.svcgssd.initd b/net-fs/nfs-utils/files/rpc.svcgssd.initd
new file mode 100755
index 0000000..74383e2
--- /dev/null
+++ b/net-fs/nfs-utils/files/rpc.svcgssd.initd
@@ -0,0 +1,24 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.svcgssd.initd,v 1.5 2008/10/26 09:02:47 vapier Exp $
+
+[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs
+
+depend() {
+ use ypbind net
+ need portmap rpc.pipefs
+ after quota
+}
+
+start() {
+ ebegin "Starting svcgssd"
+ start-stop-daemon --start --exec /usr/sbin/rpc.svcgssd -- ${OPTS_RPC_SVCGSSD}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping svcgssd"
+ start-stop-daemon --stop --exec /usr/sbin/rpc.svcgssd
+ eend $?
+}
diff --git a/net-fs/nfs-utils/nfs-utils-1.2.3-r2.ebuild b/net-fs/nfs-utils/nfs-utils-1.2.3-r2.ebuild
new file mode 100644
index 0000000..87bc166
--- /dev/null
+++ b/net-fs/nfs-utils/nfs-utils-1.2.3-r2.ebuild
@@ -0,0 +1,111 @@
+# 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 autotools 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.24
+ 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
+ # Add nfs.idmap, needed for kernel >=2.6.37 with new idmapper support
+ epatch "${FILESDIR}"/${P}-nfs-idmap.patch
+ eautoreconf
+}
+
+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
+}
next reply other threads:[~2011-03-08 13:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-08 13:03 Gilles Dartiguelongue [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-11-26 10:26 [gentoo-commits] dev/eva:master commit in: net-fs/nfs-utils/files/, net-fs/nfs-utils/ Gilles Dartiguelongue
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c2f4f62e9b0f305a5d717c6f889591bcaf59b786.eva@gentoo \
--to=eva@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox