summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /net-fs/nfs-utils/files
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'net-fs/nfs-utils/files')
-rw-r--r--net-fs/nfs-utils/files/exports1
-rw-r--r--net-fs/nfs-utils/files/nfs-utils-1.1.4-mtab-sym.patch39
-rw-r--r--net-fs/nfs-utils/files/nfs-utils-1.2.8-cross-build.patch48
-rw-r--r--net-fs/nfs-utils/files/nfs-utils-1.3.0-gcc-4.9.patch62
-rw-r--r--net-fs/nfs-utils/files/nfs-utils-1.3.2-background-statd.patch30
-rw-r--r--net-fs/nfs-utils/files/nfs-utils.conf3
-rw-r--r--net-fs/nfs-utils/files/nfs.confd38
-rwxr-xr-xnet-fs/nfs-utils/files/nfs.initd163
-rw-r--r--net-fs/nfs-utils/files/nfsclient.confd18
-rw-r--r--net-fs/nfs-utils/files/nfsclient.initd34
-rw-r--r--net-fs/nfs-utils/files/nfsd.service-r115
-rw-r--r--net-fs/nfs-utils/files/nfsmount.confd7
-rwxr-xr-xnet-fs/nfs-utils/files/nfsmount.initd48
-rw-r--r--net-fs/nfs-utils/files/nfsmount.initd-1.3.127
-rw-r--r--net-fs/nfs-utils/files/proc-fs-nfsd.mount8
-rw-r--r--net-fs/nfs-utils/files/rpc-gssd.service12
-rw-r--r--net-fs/nfs-utils/files/rpc-idmapd.service11
-rw-r--r--net-fs/nfs-utils/files/rpc-mountd.service-r110
-rw-r--r--net-fs/nfs-utils/files/rpc-statd.service-r212
-rw-r--r--net-fs/nfs-utils/files/rpc-svcgssd.service13
-rwxr-xr-xnet-fs/nfs-utils/files/rpc.gssd.initd24
-rwxr-xr-xnet-fs/nfs-utils/files/rpc.idmapd.initd26
-rw-r--r--net-fs/nfs-utils/files/rpc.pipefs.initd33
-rwxr-xr-xnet-fs/nfs-utils/files/rpc.statd.initd33
-rwxr-xr-xnet-fs/nfs-utils/files/rpc.svcgssd.initd24
-rw-r--r--net-fs/nfs-utils/files/var-lib-nfs-rpc_pipefs.mount7
26 files changed, 746 insertions, 0 deletions
diff --git a/net-fs/nfs-utils/files/exports b/net-fs/nfs-utils/files/exports
new file mode 100644
index 000000000000..5102ef27c150
--- /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 000000000000..c9e60afc74d2
--- /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.2.8-cross-build.patch b/net-fs/nfs-utils/files/nfs-utils-1.2.8-cross-build.patch
new file mode 100644
index 000000000000..7317115a0e18
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfs-utils-1.2.8-cross-build.patch
@@ -0,0 +1,48 @@
+this is kind of hacky, but automake doesn't make this easy
+for us atm, so hack away :(
+
+(recent autotools will always add $(CFLAGS)/etc... to the compile)
+
+--- a/tools/locktest/Makefile.am
++++ b/tools/locktest/Makefile.am
+@@ -1,12 +1,11 @@
+ ## Process this file with automake to produce Makefile.in
+
+ CC=$(CC_FOR_BUILD)
+-LIBTOOL = @LIBTOOL@ --tag=CC
++CFLAGS=$(CFLAGS_FOR_BUILD)
++CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
++LDFLAGS=$(LDFLAGS_FOR_BUILD)
+
+ noinst_PROGRAMS = testlk
+ testlk_SOURCES = testlk.c
+-testlk_CFLAGS=$(CFLAGS_FOR_BUILD)
+-testlk_CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
+-testlk_LDFLAGS=$(LDFLAGS_FOR_BUILD)
+
+ MAINTAINERCLEANFILES = Makefile.in
+--- a/tools/rpcgen/Makefile.am
++++ b/tools/rpcgen/Makefile.am
+@@ -1,7 +1,9 @@
+ ## Process this file with automake to produce Makefile.in
+
+ CC=$(CC_FOR_BUILD)
+-LIBTOOL = @LIBTOOL@ --tag=CC
++CFLAGS=$(CFLAGS_FOR_BUILD)
++CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
++LDFLAGS=$(LDFLAGS_FOR_BUILD)
+
+ noinst_PROGRAMS = rpcgen
+ rpcgen_SOURCES = rpc_clntout.c rpc_cout.c rpc_hout.c rpc_main.c \
+@@ -9,10 +11,6 @@
+ rpc_util.c rpc_sample.c rpc_output.h rpc_parse.h \
+ rpc_scan.h rpc_util.h
+
+-rpcgen_CFLAGS=$(CFLAGS_FOR_BUILD)
+-rpcgen_CPPLAGS=$(CPPFLAGS_FOR_BUILD)
+-rpcgen_LDFLAGS=$(LDFLAGS_FOR_BUILD)
+-rpcgen_LDADD=$(LIBTIRPC)
+
+ MAINTAINERCLEANFILES = Makefile.in
+
+ EXTRA_DIST = rpcgen.new.1
diff --git a/net-fs/nfs-utils/files/nfs-utils-1.3.0-gcc-4.9.patch b/net-fs/nfs-utils/files/nfs-utils-1.3.0-gcc-4.9.patch
new file mode 100644
index 000000000000..e2d98b517e32
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfs-utils-1.3.0-gcc-4.9.patch
@@ -0,0 +1,62 @@
+From 25e83c2270b2d2966c992885faed0b79be09f474 Mon Sep 17 00:00:00 2001
+From: Jeff Layton <jlayton@poochiereds.net>
+Date: Thu, 1 May 2014 11:15:16 -0400
+Subject: [PATCH [nfs-utils]] mountd: fix segfault in add_name with newer gcc
+ compilers
+
+I hit a segfault in add_name with a mountd built with gcc-4.9.0. Some
+NULL pointer checks got reordered such that a pointer was dereferenced
+before checking to see whether it was NULL. The problem was due to
+nfs-utils relying on undefined behavior, which tricked gcc into assuming
+that the pointer would never be NULL.
+
+At first I assumed that this was a compiler bug, but Jakub Jelinek and
+Jeff Law pointed out:
+
+"If old is NULL, then:
+
+ strncpy(new, old, cp-old);
+
+is undefined behavior (even when cp == old == NULL in that case),
+therefore gcc assumes that old is never NULL, as otherwise it would be
+invalid.
+
+Just guard
+ strncpy(new, old, cp-old);
+ new[cp-old] = 0;
+with if (old) { ... }."
+
+This patch does that. If old is NULL though, then we still need to
+ensure that new is NULL terminated, lest the subsequent strcats walk off
+the end of it.
+
+Cc: Jeff Law <law@redhat.com>
+Cc: Jakub Jelinek <jakub@redhat.com>
+Signed-off-by: Jeff Layton <jlayton@poochiereds.net>
+Signed-off-by: Steve Dickson <steved@redhat.com>
+---
+ support/export/client.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/support/export/client.c b/support/export/client.c
+index dbf47b9..f85e11c 100644
+--- a/support/export/client.c
++++ b/support/export/client.c
+@@ -482,8 +482,12 @@ add_name(char *old, const char *add)
+ else
+ cp = cp + strlen(cp);
+ }
+- strncpy(new, old, cp-old);
+- new[cp-old] = 0;
++ if (old) {
++ strncpy(new, old, cp-old);
++ new[cp-old] = 0;
++ } else {
++ new[0] = 0;
++ }
+ if (cp != old && !*cp)
+ strcat(new, ",");
+ strcat(new, add);
+--
+2.0.0
+
diff --git a/net-fs/nfs-utils/files/nfs-utils-1.3.2-background-statd.patch b/net-fs/nfs-utils/files/nfs-utils-1.3.2-background-statd.patch
new file mode 100644
index 000000000000..393f70b87a99
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfs-utils-1.3.2-background-statd.patch
@@ -0,0 +1,30 @@
+From 17a3e5bffb7110d46de1bf42b64b90713ff5ea50 Mon Sep 17 00:00:00 2001
+From: Chris Mayo <aklhfex@gmail.com>
+Date: Sun, 1 Feb 2015 12:03:46 -0500
+Subject: [PATCH] statd: Fix test for foreground mode
+
+daemon_init parameter has the opposite sense
+to code removed in commit 7addf9d
+
+Signed-off-by: Chris Mayo <aklhfex@gmail.com>
+Signed-off-by: Steve Dickson <steved@redhat.com>
+---
+ utils/statd/statd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/utils/statd/statd.c b/utils/statd/statd.c
+index 60ce6d1..2b7a167 100644
+--- a/utils/statd/statd.c
++++ b/utils/statd/statd.c
+@@ -393,7 +393,7 @@ int main (int argc, char **argv)
+ simulator (--argc, ++argv); /* simulator() does exit() */
+ #endif
+
+- daemon_init(!(run_mode & MODE_NODAEMON));
++ daemon_init((run_mode & MODE_NODAEMON));
+
+ if (run_mode & MODE_LOG_STDERR) {
+ xlog_syslog(0);
+--
+2.2.2
+
diff --git a/net-fs/nfs-utils/files/nfs-utils.conf b/net-fs/nfs-utils/files/nfs-utils.conf
new file mode 100644
index 000000000000..b9b586c2ac07
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfs-utils.conf
@@ -0,0 +1,3 @@
+d /var/lib/nfs/rpc_pipefs
+d /var/lib/nfs/v4recovery
+d /var/lib/nfs/v4root
diff --git a/net-fs/nfs-utils/files/nfs.confd b/net-fs/nfs-utils/files/nfs.confd
new file mode 100644
index 000000000000..9dc14058c1fe
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfs.confd
@@ -0,0 +1,38 @@
+# /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=""
+
+# Options to pass to rpc.nfsd
+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
+
+# Options to set in the nfsd filesystem (/proc/fs/nfsd/).
+# Format is <option>=<value>. Multiple options are allowed.
+#OPTS_NFSD="nfsv4leasetime=30 max_block_size=4096"
diff --git a/net-fs/nfs-utils/files/nfs.initd b/net-fs/nfs-utils/files/nfs.initd
new file mode 100755
index 000000000000..084506d4c475
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfs.initd
@@ -0,0 +1,163 @@
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+extra_started_commands="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=""
+ # 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 /etc/exports.d/*.exports 2>/dev/null
+ )"
+ config /etc/exports /etc/exports.d/*.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 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 ! mountinfo -q /proc/fs/nfsd ; then
+ ebegin "Mounting nfsd filesystem in /proc"
+ mount -t nfsd -o nodev,noexec,nosuid nfsd /proc/fs/nfsd
+ eend $?
+ fi
+
+ local o
+ for o in ${OPTS_NFSD} ; do
+ echo "${o#*=}" > "/proc/fs/nfsd/${o%%=*}"
+ done
+ 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 /etc/exports.d/*.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
+
+ ebegin "Stopping NFS mountd"
+ start-stop-daemon --stop --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 --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/nfsclient.confd b/net-fs/nfs-utils/files/nfsclient.confd
new file mode 100644
index 000000000000..8a995571e1b8
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfsclient.confd
@@ -0,0 +1,18 @@
+# You need to decide which nfs protocol version you want to use.
+# If you are unsure, leave these alone.
+#
+# If you are using only nfsv4, uncomment this line:
+#
+#rc_need="!rpc.statd"
+#
+# If you are using only nfsv3, uncomment this line:
+#
+#rc_need="!rpc.idmapd"
+#
+# You will need to set the dependencies in the nfsclient script to match
+# the network configuration tools you are using. This should be done in
+# this file by following the examples below, and not by changing the
+# service script itself. See /etc/conf.d/netmount for more examples.
+#
+# This is a safe default.
+rc_after="net"
diff --git a/net-fs/nfs-utils/files/nfsclient.initd b/net-fs/nfs-utils/files/nfsclient.initd
new file mode 100644
index 000000000000..ab13913b7b4a
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfsclient.initd
@@ -0,0 +1,34 @@
+#!/sbin/runscript
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs
+
+depend() {
+ local opts myneed=""
+ if [ -e /etc/fstab ] ; then
+ for opts in $(fstabinfo -o -t nfs,nfs4) ; do
+ case $opts in
+ *sec=krb*|*sec=spkm*) myneed="$myneed rpc.gssd" ;;
+ esac
+ done
+ fi
+ config /etc/fstab
+ need portmap rpc.statd rpc.idmapd ${myneed}
+ use ypbind dns
+}
+
+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
+ return 0
+}
diff --git a/net-fs/nfs-utils/files/nfsd.service-r1 b/net-fs/nfs-utils/files/nfsd.service-r1
new file mode 100644
index 000000000000..e15cf98f9bec
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfsd.service-r1
@@ -0,0 +1,15 @@
+[Unit]
+Description=NFS server
+After=rpcbind.service
+Requires=rpcbind.service
+
+[Service]
+Type=oneshot
+ExecStart=/usr/sbin/rpc.nfsd 8
+ExecStartPost=/usr/sbin/exportfs -a
+ExecStop=/usr/sbin/rpc.nfsd 0
+ExecStopPost=/usr/sbin/exportfs -a -u
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-fs/nfs-utils/files/nfsmount.confd b/net-fs/nfs-utils/files/nfsmount.confd
new file mode 100644
index 000000000000..418353668f97
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfsmount.confd
@@ -0,0 +1,7 @@
+# You will need to set the dependencies in the nfsmount script to match
+# the network configuration tools you are using. This should be done in
+# this file by following the examples below, and not by changing the
+# service script itself. See /etc/conf.d/netmount for more examples.
+#
+# This is a safe default.
+rc_after="net"
diff --git a/net-fs/nfs-utils/files/nfsmount.initd b/net-fs/nfs-utils/files/nfsmount.initd
new file mode 100755
index 000000000000..642d3494f17d
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfsmount.initd
@@ -0,0 +1,48 @@
+#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+[ -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 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/nfsmount.initd-1.3.1 b/net-fs/nfs-utils/files/nfsmount.initd-1.3.1
new file mode 100644
index 000000000000..ec74dbe4fdc9
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfsmount.initd-1.3.1
@@ -0,0 +1,27 @@
+#!/sbin/runscript
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# This is mostly as a fix for bug #537996, to avoid breaking existing users
+# with nfsmount in their runlevels.
+# If neither nfsclient nor netmount are in your runlevels, and you manually
+# start netmount before nfsclient, then this will break. A real solution is
+# forthcoming, but requires feature development, see bug #406021 for soft
+# dependencies
+depend() {
+ need nfsclient netmount
+}
+
+msg() {
+ ewarn "nfsmount is deprecated, please migrate as described in the news item: 2015-02-02-nfs-service-changes"
+ ewarn "This migration script will be removed after 01 Aug 2015."
+}
+
+start() {
+ msg
+}
+
+stop() {
+ msg
+}
diff --git a/net-fs/nfs-utils/files/proc-fs-nfsd.mount b/net-fs/nfs-utils/files/proc-fs-nfsd.mount
new file mode 100644
index 000000000000..26b58b9682d9
--- /dev/null
+++ b/net-fs/nfs-utils/files/proc-fs-nfsd.mount
@@ -0,0 +1,8 @@
+[Unit]
+Description=NFS Configuration File System
+DefaultDependencies=no
+
+[Mount]
+What=sunrpc
+Where=/proc/fs/nfsd
+Type=nfsd
diff --git a/net-fs/nfs-utils/files/rpc-gssd.service b/net-fs/nfs-utils/files/rpc-gssd.service
new file mode 100644
index 000000000000..4c96deef4408
--- /dev/null
+++ b/net-fs/nfs-utils/files/rpc-gssd.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=RPC GSS-API Client Daemon
+Documentation=man:rpc.gssd(8)
+After=rpcbind.service var-lib-nfs-rpc_pipefs.mount
+Requires=rpcbind.service var-lib-nfs-rpc_pipefs.mount
+Before=remote-fs-pre.target
+
+[Service]
+ExecStart=/usr/sbin/rpc.gssd -f
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-fs/nfs-utils/files/rpc-idmapd.service b/net-fs/nfs-utils/files/rpc-idmapd.service
new file mode 100644
index 000000000000..4a63b91ca73a
--- /dev/null
+++ b/net-fs/nfs-utils/files/rpc-idmapd.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=NFS v4 ID-Name Mapping Daemon
+Documentation=man:rpc.idmapd(8) man:idmapd.conf(5)
+After=var-lib-nfs-rpc_pipefs.mount nfsd.service
+Requires=var-lib-nfs-rpc_pipefs.mount
+
+[Service]
+ExecStart=/usr/sbin/rpc.idmapd -f
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-fs/nfs-utils/files/rpc-mountd.service-r1 b/net-fs/nfs-utils/files/rpc-mountd.service-r1
new file mode 100644
index 000000000000..d5f5b24af399
--- /dev/null
+++ b/net-fs/nfs-utils/files/rpc-mountd.service-r1
@@ -0,0 +1,10 @@
+[Unit]
+Description=NFS Mount Daemon
+After=rpcbind.service nfsd.service
+Requires=rpcbind.service nfsd.service
+
+[Service]
+ExecStart=/usr/sbin/rpc.mountd -F
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-fs/nfs-utils/files/rpc-statd.service-r2 b/net-fs/nfs-utils/files/rpc-statd.service-r2
new file mode 100644
index 000000000000..3633ebded5d8
--- /dev/null
+++ b/net-fs/nfs-utils/files/rpc-statd.service-r2
@@ -0,0 +1,12 @@
+[Unit]
+Description=NFSv2/3 Network Status Monitor Daemon
+After=rpcbind.service
+Requires=rpcbind.service
+Before=remote-fs-pre.target
+Wants=remote-fs-pre.target
+
+[Service]
+ExecStart=/sbin/rpc.statd -F
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-fs/nfs-utils/files/rpc-svcgssd.service b/net-fs/nfs-utils/files/rpc-svcgssd.service
new file mode 100644
index 000000000000..121c61a49b30
--- /dev/null
+++ b/net-fs/nfs-utils/files/rpc-svcgssd.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=RPC GSS-API Server Daemon
+Documentation=man:rpc.svcgssd(8)
+After=rpcbind.service
+Requires=rpcbind.service
+Before=nfs-server.target
+PartOf=nfs-server.target
+
+[Service]
+ExecStart=/usr/sbin/rpc.svcgssd -f
+
+[Install]
+WantedBy=multi-user.target
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 000000000000..465b05ef462b
--- /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
+# $Id$
+
+[ -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 000000000000..dcd0acd69e07
--- /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
+# $Id$
+
+[ -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 000000000000..1cd79e229a8b
--- /dev/null
+++ b/net-fs/nfs-utils/files/rpc.pipefs.initd
@@ -0,0 +1,33 @@
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+MNT="/var/lib/nfs/rpc_pipefs"
+
+mount_pipefs() {
+ local fstype=rpc_pipefs
+
+ # if things are already mounted, nothing to do
+ mountinfo -q ${MNT} && return 0
+
+ # if rpc_pipefs is not available, try to load sunrpc for it #219566
+ grep -qs ${fstype} /proc/filesystems || modprobe -q sunrpc
+ # if still not available, the `mount` will issue an error for the user
+
+ # now just do it for kicks
+ mkdir -p ${MNT}
+ mount -t ${fstype} ${fstype} ${MNT}
+}
+
+start() {
+ ebegin "Setting up RPC pipefs"
+ mount_pipefs
+ eend $? "make sure you have NFS/SUNRPC enabled in your kernel"
+}
+
+stop() {
+ ebegin "Unmounting RPC pipefs"
+ umount ${MNT}
+ 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 000000000000..fd4a7a1e1648
--- /dev/null
+++ b/net-fs/nfs-utils/files/rpc.statd.initd
@@ -0,0 +1,33 @@
+#!/sbin/runscript
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+[ -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 000000000000..f677cb56d233
--- /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
+# $Id$
+
+[ -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/files/var-lib-nfs-rpc_pipefs.mount b/net-fs/nfs-utils/files/var-lib-nfs-rpc_pipefs.mount
new file mode 100644
index 000000000000..c4166582225d
--- /dev/null
+++ b/net-fs/nfs-utils/files/var-lib-nfs-rpc_pipefs.mount
@@ -0,0 +1,7 @@
+[Unit]
+Description=RPC Pipe File System
+
+[Mount]
+What=rpc_pipefs
+Where=/var/lib/nfs/rpc_pipefs
+Type=rpc_pipefs