summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--user/nfs-utils/APKBUILD80
-rw-r--r--user/nfs-utils/exports1
-rw-r--r--user/nfs-utils/nfs-utils-1.1.4-mtab-sym.patch39
-rw-r--r--user/nfs-utils/nfs-utils.conf3
-rw-r--r--user/nfs-utils/nfs.confd38
-rw-r--r--user/nfs-utils/nfs.initd162
-rw-r--r--user/nfs-utils/nfsclient.confd18
-rw-r--r--user/nfs-utils/nfsclient.initd33
-rw-r--r--user/nfs-utils/nfsmount.confd7
-rw-r--r--user/nfs-utils/nfsmount.initd47
-rw-r--r--user/nfs-utils/posixish.patch71
-rw-r--r--user/nfs-utils/rpc.gssd.initd23
-rw-r--r--user/nfs-utils/rpc.idmapd.initd25
-rw-r--r--user/nfs-utils/rpc.pipefs.initd32
-rw-r--r--user/nfs-utils/rpc.statd.initd32
-rw-r--r--user/nfs-utils/rpc.svcgssd.initd23
-rw-r--r--user/nfs-utils/undef-def.patch42
17 files changed, 676 insertions, 0 deletions
diff --git a/user/nfs-utils/APKBUILD b/user/nfs-utils/APKBUILD
new file mode 100644
index 000000000..5c2c06c70
--- /dev/null
+++ b/user/nfs-utils/APKBUILD
@@ -0,0 +1,80 @@
+# Contributor: A. Wilcox <awilfox@adelielinux.org>
+# Maintainer: A. Wilcox <awilfox@adelielinux.org>
+pkgname=nfs-utils
+pkgver=2.3.3
+pkgrel=0
+pkgdesc="NFS file sharing client and server"
+url="http://nfs.sourceforge.net/"
+arch="all"
+options="!check suid" # No functional test suite.
+license="GPL-2.0-only"
+depends="rpcbind"
+makedepends="keyutils-dev krb5-dev libevent-dev libtirpc-dev lvm2-dev
+ rpcsvc-proto sqlite-dev util-linux-dev"
+subpackages="$pkgname-doc $pkgname-openrc"
+source="https://downloads.sourceforge.net/nfs/nfs-utils-$pkgver.tar.xz
+ nfs-utils-1.1.4-mtab-sym.patch
+ posixish.patch
+ undef-def.patch
+
+ exports
+ nfs.confd nfs.initd nfsclient.confd nfsclient.initd nfsmount.confd
+ nfsmount.initd rpc.gssd.initd rpc.idmapd.initd rpc.pipefs.initd
+ rpc.statd.initd rpc.svcgssd.initd
+ "
+
+build() {
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --localstatedir=/var \
+ --enable-ipv6 \
+ --enable-nfsv4 \
+ --enable-nfsv41 \
+ --enable-gss \
+ --enable-svcgss \
+ --with-statedir=/var/lib/nfs
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ local _initd _confd
+ cd "$builddir"
+ make DESTDIR="$pkgdir" install
+
+ install -D -m644 "$srcdir"/exports "$pkgdir"/etc/exports
+
+ for _initd in nfs nfsclient nfsmount rpc.gssd rpc.idmapd rpc.pipefs \
+ rpc.statd rpc.svcgssd; do
+ install -D -m755 "$srcdir"/$_initd.initd "$pkgdir"/etc/init.d/$_initd
+ done
+ for _confd in nfs nfsclient nfsmount; do
+ install -D -m644 "$srcdir"/$_confd.confd "$pkgdir"/etc/conf.d/$_confd
+ done
+}
+
+sha512sums="5025ccd7699ac1a0fdbd8b18ed8b33ea89230158320d809ec51e73f831100db75dceaddde481d911eeca9059caa521d155c2d14d014d75f091f432aad92a9716 nfs-utils-2.3.3.tar.xz
+1cd916028a8515772f05ef63832d73a09e9720055aedc9e2e4ce3a08ce1820948700a4f00ca9c4ee684880f18e67aca888dd857fc7931d923021ba50964be998 nfs-utils-1.1.4-mtab-sym.patch
+f0b87ff4229d96a46e3f0c17f87dcd3ce5c51651ee036d935c1481b421cd7e5b6a048a082b4f8115a969fe6e85cc871df7658bf5d80c480095b69f29fd6b085d posixish.patch
+2e54efa2cac0522f549e8bed45147676d10b299b5060eda305da8767feb55d37627259196d89c295e8d5f4fbbb7c9e791a53dddd579187600f1717968049aa6a undef-def.patch
+fd8052dc8e17eccb0bb1443f341c97ec7c9dac5824294cadf486d91475bc728d4bb69300034b528a690707520590f6675ee371f92e9838afc8ed88092ee0f220 exports
+bc11b073735ee86c96b9c249ee187f4d16329c279a4e26760875059d2b5fa1d510ef3e4df5ee9dfb2a3133d755e1eb5c323d2fadc432a0cf630191ec353ac535 nfs.confd
+f7feb79cfcab0478affb640d1e5ad059757c88d51cc790fd54cde2fd7ed2e3cfd8f7f4c2de993d99da03e8ce3bdfb2750a4cb997b850fe33d0ef76d9b91c9018 nfs.initd
+f12e67728ac4e76357685e2fe38bd7f6fcd90064165758ffeca145e6962ac44d4ff9d8d57e18cc6925a6ada8e95ad8321e9fc355931a804dd455aae1e4850e92 nfsclient.confd
+85078e2cd38b37a1e6fbaf0e40cf7690f403e71d9c8188d542d12fe56bfc02a49763c7bcc7742691754acc37928468c215db2795bebc29a5dfb052ba08f407bb nfsclient.initd
+6e23897885cc33c49d9c7353b456585a1e0c7300822edba81bc48ba4ccc18297adce137260cc0aa9487aa5ef0aab3eecf931532cfa5bd40fd03bc9e0ddacfb28 nfsmount.confd
+89259b9f0878658d48792b5b2f42b43c966ed098dba1fecf9e07fb0de4aab37ad67655ea8dbcc2361ddab2b5013b2de35a03048a513aaeedf790e4b416a35a54 nfsmount.initd
+d9d7eeebbe153d3c4784112ed6d50734b5619b3315bb1454f8163de2b78ed8f958029a0e1088de58e9b1b8069184aeab2c8f19af4b957b6be25e4f138960aeac rpc.gssd.initd
+f3e88038cb040ffcbca76166f4322d37e39da00d144bc0a17aed4467ab10c6e626fcde6c407d0911d135bfab55622ad2e38ed93788b11459c5882ce60577fb45 rpc.idmapd.initd
+3d3fa6e7ae01e27d27d88aba1e307c5293dd1cbc9d555737e03c4f1e17988518f4f1e7f7a38a7337f8e8961e8378cc4611769b04db7368460589a3b218ac6d6b rpc.pipefs.initd
+7f6baea852fff91b88e15e432ba19f9da0a3e3510b6f550b553912cf3887ce176280367b62bcce2a044730a075e4c1f6d7df1a669556d42725dea6e6e8e967ac rpc.statd.initd
+819cce4ae0a0f26bc74ce546e149b98420584240a594c9bb4a0a49413750320bde050866f3753c499425ea8d8df094211fb1f7e020ce281791e1933e1bc6a47f rpc.svcgssd.initd"
diff --git a/user/nfs-utils/exports b/user/nfs-utils/exports
new file mode 100644
index 000000000..5102ef27c
--- /dev/null
+++ b/user/nfs-utils/exports
@@ -0,0 +1 @@
+# /etc/exports: NFS file systems being exported. See exports(5).
diff --git a/user/nfs-utils/nfs-utils-1.1.4-mtab-sym.patch b/user/nfs-utils/nfs-utils-1.1.4-mtab-sym.patch
new file mode 100644
index 000000000..c9e60afc7
--- /dev/null
+++ b/user/nfs-utils/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/user/nfs-utils/nfs-utils.conf b/user/nfs-utils/nfs-utils.conf
new file mode 100644
index 000000000..b9b586c2a
--- /dev/null
+++ b/user/nfs-utils/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/user/nfs-utils/nfs.confd b/user/nfs-utils/nfs.confd
new file mode 100644
index 000000000..9dc14058c
--- /dev/null
+++ b/user/nfs-utils/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/user/nfs-utils/nfs.initd b/user/nfs-utils/nfs.initd
new file mode 100644
index 000000000..4b572fc2e
--- /dev/null
+++ b/user/nfs-utils/nfs.initd
@@ -0,0 +1,162 @@
+#!/sbin/openrc-run
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+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/user/nfs-utils/nfsclient.confd b/user/nfs-utils/nfsclient.confd
new file mode 100644
index 000000000..8a995571e
--- /dev/null
+++ b/user/nfs-utils/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/user/nfs-utils/nfsclient.initd b/user/nfs-utils/nfsclient.initd
new file mode 100644
index 000000000..6724e913d
--- /dev/null
+++ b/user/nfs-utils/nfsclient.initd
@@ -0,0 +1,33 @@
+#!/sbin/openrc-run
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+[ -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/user/nfs-utils/nfsmount.confd b/user/nfs-utils/nfsmount.confd
new file mode 100644
index 000000000..418353668
--- /dev/null
+++ b/user/nfs-utils/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/user/nfs-utils/nfsmount.initd b/user/nfs-utils/nfsmount.initd
new file mode 100644
index 000000000..12c7d786a
--- /dev/null
+++ b/user/nfs-utils/nfsmount.initd
@@ -0,0 +1,47 @@
+#!/sbin/openrc-run
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+[ -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/user/nfs-utils/posixish.patch b/user/nfs-utils/posixish.patch
new file mode 100644
index 000000000..0f1a7cdee
--- /dev/null
+++ b/user/nfs-utils/posixish.patch
@@ -0,0 +1,71 @@
+--- nfs-utils-2.3.1/configure.ac.orig 2018-05-21 11:05:01.939912918 -0700
++++ nfs-utils-2.3.1/configure.ac 2018-05-21 11:05:10.531968707 -0700
+@@ -401,7 +401,7 @@
+ fi
+
+ dnl libdnsidmap specific checks
+-AC_CHECK_LIB([resolv], [__res_querydomain], , AC_MSG_ERROR(res_querydomain needed))
++AC_CHECK_LIB([resolv], [res_querydomain], , AC_MSG_ERROR(res_querydomain needed))
+
+ AC_ARG_ENABLE([ldap],
+ [AS_HELP_STRING([--disable-ldap],[Disable support for LDAP @<:default=detect@:>@])])
+--- nfs-utils-2.3.1/support/misc/file.c.orig 2018-05-21 18:15:37.572007979 +0000
++++ nfs-utils-2.3.1/support/misc/file.c 2018-05-21 18:15:43.668047008 +0000
+@@ -27,6 +27,7 @@
+ #include <dirent.h>
+ #include <stdlib.h>
+ #include <stdbool.h>
++#include <limits.h> /* PATH_MAX */
+
+ #include "xlog.h"
+ #include "misc.h"
+--- nfs-utils-2.3.3/configure.old 2018-09-06 18:10:07.000000000 +0000
++++ nfs-utils-2.3.3/configure 2019-01-10 16:01:32.110000000 +0000
+@@ -20302,9 +20302,9 @@
+ fi
+ fi
+
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __res_querydomain in -lresolv" >&5
+-$as_echo_n "checking for __res_querydomain in -lresolv... " >&6; }
+-if ${ac_cv_lib_resolv___res_querydomain+:} false; then :
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_querydomain in -lresolv" >&5
++$as_echo_n "checking for res_querydomain in -lresolv... " >&6; }
++if ${ac_cv_lib_resolv_res_querydomain+:} false; then :
+ $as_echo_n "(cached) " >&6
+ else
+ ac_check_lib_save_LIBS=$LIBS
+@@ -20318,27 +20318,27 @@
+ #ifdef __cplusplus
+ extern "C"
+ #endif
+-char __res_querydomain ();
++char res_querydomain ();
+ int
+ main ()
+ {
+-return __res_querydomain ();
++return res_querydomain ();
+ ;
+ return 0;
+ }
+ _ACEOF
+ if ac_fn_c_try_link "$LINENO"; then :
+- ac_cv_lib_resolv___res_querydomain=yes
++ ac_cv_lib_resolv_res_querydomain=yes
+ else
+- ac_cv_lib_resolv___res_querydomain=no
++ ac_cv_lib_resolv_res_querydomain=no
+ fi
+ rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+ fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv___res_querydomain" >&5
+-$as_echo "$ac_cv_lib_resolv___res_querydomain" >&6; }
+-if test "x$ac_cv_lib_resolv___res_querydomain" = xyes; then :
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_res_querydomain" >&5
++$as_echo "$ac_cv_lib_resolv_res_querydomain" >&6; }
++if test "x$ac_cv_lib_resolv_res_querydomain" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+ #define HAVE_LIBRESOLV 1
+ _ACEOF
diff --git a/user/nfs-utils/rpc.gssd.initd b/user/nfs-utils/rpc.gssd.initd
new file mode 100644
index 000000000..445d44c44
--- /dev/null
+++ b/user/nfs-utils/rpc.gssd.initd
@@ -0,0 +1,23 @@
+#!/sbin/openrc-run
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+[ -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/user/nfs-utils/rpc.idmapd.initd b/user/nfs-utils/rpc.idmapd.initd
new file mode 100644
index 000000000..61cfd4de2
--- /dev/null
+++ b/user/nfs-utils/rpc.idmapd.initd
@@ -0,0 +1,25 @@
+#!/sbin/openrc-run
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+[ -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/user/nfs-utils/rpc.pipefs.initd b/user/nfs-utils/rpc.pipefs.initd
new file mode 100644
index 000000000..f971a49b3
--- /dev/null
+++ b/user/nfs-utils/rpc.pipefs.initd
@@ -0,0 +1,32 @@
+#!/sbin/openrc-run
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+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/user/nfs-utils/rpc.statd.initd b/user/nfs-utils/rpc.statd.initd
new file mode 100644
index 000000000..ea78b9aef
--- /dev/null
+++ b/user/nfs-utils/rpc.statd.initd
@@ -0,0 +1,32 @@
+#!/sbin/openrc-run
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+[ -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/user/nfs-utils/rpc.svcgssd.initd b/user/nfs-utils/rpc.svcgssd.initd
new file mode 100644
index 000000000..c714e3607
--- /dev/null
+++ b/user/nfs-utils/rpc.svcgssd.initd
@@ -0,0 +1,23 @@
+#!/sbin/openrc-run
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+[ -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/user/nfs-utils/undef-def.patch b/user/nfs-utils/undef-def.patch
new file mode 100644
index 000000000..12bff6ddf
--- /dev/null
+++ b/user/nfs-utils/undef-def.patch
@@ -0,0 +1,42 @@
+--- nfs-utils-2.3.3/support/nfs/svc_socket.c.old 2018-09-06 18:09:08.000000000 +0000
++++ nfs-utils-2.3.3/support/nfs/svc_socket.c 2019-01-10 16:17:02.270000000 +0000
+@@ -46,7 +46,7 @@
+ struct rpcent *rpcp;
+ struct servent servbuf, *servp = NULL;
+ int ret = 0;
+-#if HAVE_GETRPCBYNUMBER_R
++#ifdef HAVE_GETRPCBYNUMBER_R
+ char rpcdata[1024];
+ struct rpcent rpcbuf;
+
+--- nfs-utils-2.3.3/utils/mountd/cache.c.old 2018-09-06 18:09:08.000000000 +0000
++++ nfs-utils-2.3.3/utils/mountd/cache.c 2019-01-10 16:26:22.750000000 +0000
+@@ -426,7 +426,7 @@
+ if (count_slashes(p) != count_slashes(parent))
+ return 0;
+
+-#if HAVE_NAME_TO_HANDLE_AT
++#ifdef HAVE_NAME_TO_HANDLE_AT
+ struct {
+ struct file_handle fh;
+ unsigned char handle[128];
+--- nfs-utils-2.3.3/utils/mount/network.c.old 2018-09-06 18:09:08.000000000 +0000
++++ nfs-utils-2.3.3/utils/mount/network.c 2019-01-10 16:28:46.840000000 +0000
+@@ -39,7 +39,7 @@
+ #include <sys/socket.h>
+ #include <sys/wait.h>
+ #include <sys/stat.h>
+-#if defined(__GLIBC__) && (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 24)
++#if defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 24))
+ /* Cannot safely include linux/in6.h in old glibc, so hardcode the needed values */
+ # define IPV6_PREFER_SRC_PUBLIC 2
+ # define IPV6_ADDR_PREFERENCES 72
+@@ -1062,7 +1062,7 @@
+ if (caddr) {
+ /* Get the address of our end of this connection */
+ socklen_t len = sizeof(*caddr);
+- if (getsockname(sock, caddr, &len) != 0)
++ if (getsockname(sock, (struct sockaddr *)caddr, &len) != 0)
+ caddr->sin_family = 0;
+ }
+