net-fs/nfs-utils: update to 2.5.4-r3

Update net-fs/nfs-utils to 2.5.4-r3, as needed by gcc 10.
Without that update, build fails like:

```
/usr/libexec/gcc/x86_64-cros-linux-gnu/ld:
../../support/export/libexport.a(xtab.o):.../support/export/xtab.c:32:
multiple definition of `v4root_needed';
mountd-v4root.o:.../utils/mountd/v4root.c:31: first defined here
```
This commit is contained in:
Dongsu Park 2022-02-03 12:16:17 +01:00
parent 7d24586b46
commit fad4ba41b8
21 changed files with 731 additions and 279 deletions

View File

@ -1 +1 @@
DIST nfs-utils-2.3.1.tar.bz2 854899 BLAKE2B f9541b9dc103d978f21d57d8ba0c14a3b30f6ba874b112239d014076c1c72b6654e8e02b4bfea686e658dac84d1e896b872bc2054591275ef1713ae4e7b7d005 SHA512 de3e70f8656bc5b5aa98262685a9e80929c6314234d9bbb74d4c7efcb7a8b2640d48d2100850b403157ebefc8f0eb48598b48238fae795f64c7a0e9a8bff93e3
DIST nfs-utils-2.5.4.tar.bz2 943373 BLAKE2B 72ed871613701f5b035941a7aed957771fe3b6a19fefee203130442c292bbbefde35721f2287fef19046d2d837faeda43b06a93a5acdb8ac6240eef90e6dd12c SHA512 b1395c5b06a06246666c48174594b1e08b71cf40b8f94b533497bd92625401a669e2c40e48dbd665891ad2247bc94d7d604d0c5d0f0b66bfe957b03d42e5d305

View File

@ -0,0 +1 @@
# /etc/exports: NFS file systems being exported. See exports(5).

View File

@ -1,39 +0,0 @@
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+");

View File

@ -1,48 +0,0 @@
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

View File

@ -1,40 +0,0 @@
From 1451d7585bf1c622658ccc04abac7e79ffe40263 Mon Sep 17 00:00:00 2001
From: Justin Mitchell <jumitche@redhat.com>
Date: Mon, 8 Jan 2018 09:14:11 -0500
Subject: [PATCH] svcgssd: Update svcgssd so that it builds
Since a15bd948 the --enable-svcgss option no longer builds
as svcgssd references functions which were changed at that time.
Fix those, and other function changes since then.
Signed-off-by: Justin Mitchell <jumitche@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
---
utils/gssd/svcgssd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/utils/gssd/svcgssd.c b/utils/gssd/svcgssd.c
index 3514ae1..23f0c0b 100644
--- a/utils/gssd/svcgssd.c
+++ b/utils/gssd/svcgssd.c
@@ -63,6 +63,8 @@
#include "err_util.h"
#include "conffile.h"
+struct state_paths etab;
+
void
sig_die(int signal)
{
@@ -101,7 +103,7 @@ main(int argc, char *argv[])
char *principal = NULL;
char *s;
- conf_init(NFS_CONFFILE);
+ conf_init_file(NFS_CONFFILE);
s = conf_get_str("svcgssd", "principal");
if (!s)
--
1.8.3.1

View File

@ -0,0 +1,68 @@
From 6ab8c7c186bd4a547a0ca435ecabe10ee50039c5 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Thu, 22 Oct 2020 19:44:34 +0200
Subject: [PATCH] Don't build with -Werror flags
https://bugs.gentoo.org/656984
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
---
configure.ac | 34 +---------------------------------
1 file changed, 1 insertion(+), 33 deletions(-)
diff --git a/configure.ac b/configure.ac
index 50847d8a..6bc18e93 100644
--- a/configure.ac
+++ b/configure.ac
@@ -631,47 +631,15 @@ AC_SUBST(CPPFLAGS_FOR_BUILD)
AC_SUBST(LDFLAGS_FOR_BUILD)
my_am_cflags="\
- -pipe \
-Wall \
-Wextra \
$rpcgen_cflags \
- -Werror=missing-prototypes \
- -Werror=missing-declarations \
- -Werror=format=2 \
- -Werror=undef \
- -Werror=missing-include-dirs \
- -Werror=strict-aliasing=2 \
- -Werror=init-self \
- -Werror=implicit-function-declaration \
- -Werror=return-type \
- -Werror=switch \
- -Werror=overflow \
- -Werror=parentheses \
- -Werror=aggregate-return \
- -Werror=unused-result \
-fno-strict-aliasing \
"
-AC_DEFUN([CHECK_CCSUPPORT], [
- my_save_cflags="$CFLAGS"
- CFLAGS="-Werror $1"
- AC_MSG_CHECKING([whether CC supports $1])
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
- [AC_MSG_RESULT([yes])]
- [$2+=$1],
- [AC_MSG_RESULT([no])]
- )
- CFLAGS="$my_save_cflags"
-])
-
-CHECK_CCSUPPORT([-Werror=format-overflow=2], [flg1])
-CHECK_CCSUPPORT([-Werror=int-conversion], [flg2])
-CHECK_CCSUPPORT([-Werror=incompatible-pointer-types], [flg3])
-CHECK_CCSUPPORT([-Werror=misleading-indentation], [flg4])
-CHECK_CCSUPPORT([-Wno-cast-function-type], [flg5])
AX_GCC_FUNC_ATTRIBUTE([format])
-AC_SUBST([AM_CFLAGS], ["$my_am_cflags $flg1 $flg2 $flg3 $flg4 $flg5"])
+AC_SUBST([AM_CFLAGS], ["$my_am_cflags"])
# Make sure that $ACLOCAL_FLAGS are used during a rebuild
AC_SUBST([ACLOCAL_AMFLAGS], ["-I $ac_macro_dir \$(ACLOCAL_FLAGS)"])
--
2.29.0

View File

@ -0,0 +1,32 @@
https://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commitdiff;h=feb3dfc7127cf1337530ccb06ed90e818b026a07#patch1
https://bugzilla.redhat.com/show_bug.cgi?id=1979816
https://bugs.gentoo.org/808183
Slightly rebased by sam@ to account for version.h moving around.
From feb3dfc7127cf1337530ccb06ed90e818b026a07 Mon Sep 17 00:00:00 2001
From: Steve Dickson <steved@redhat.com>
Date: Wed, 22 Sep 2021 11:31:56 -0400
Subject: [PATCH] mountd: only do NFSv4 logging on supported kernels.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1979816
Signed-off-by: Steve Dickson <steved@redhat.com>
--- a/support/export/v4clients.c
+++ b/support/export/v4clients.c
@@ -10,6 +10,7 @@
#include <sys/inotify.h>
#include <errno.h>
#include "export.h"
+#include "../../utils/mount/version.h"
/* search.h declares 'struct entry' and nfs_prot.h
* does too. Easiest fix is to trick search.h into
@@ -23,6 +24,8 @@ static int clients_fd = -1;
void v4clients_init(void)
{
+ if (linux_version_code() < MAKE_VERSION(5, 3, 0))
+ return;
if (clients_fd >= 0)
return;
clients_fd = inotify_init1(IN_NONBLOCK);

View File

@ -1,9 +0,0 @@
d /var/lib/nfs/rpc_pipefs
d /var/lib/nfs/v4recovery
d /var/lib/nfs/v4root
C /var/lib/nfs/etab - - - - /usr/lib64/nfs/etab
C /var/lib/nfs/rmtab - - - - /usr/lib64/nfs/rmtab
C /var/lib/nfs/sm - - - - /usr/lib64/nfs/sm
C /var/lib/nfs/sm.bak - - - - /usr/lib64/nfs/sm.bak
C /var/lib/nfs/state - - - - /usr/lib64/nfs/state
C /var/lib/nfs/xtab - - - - /usr/lib64/nfs/xtab

View File

@ -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"

View File

@ -0,0 +1,156 @@
#!/sbin/openrc-run
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
extra_started_commands="reload"
# 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 --signal=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 [ "${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() {
svc_stop
svc_start
}

View File

@ -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"

View File

@ -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
}

View File

@ -0,0 +1,26 @@
#!/sbin/openrc-run
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# 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
}

View File

@ -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 $?
}

View File

@ -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 $?
}

View File

@ -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 $?
}

View File

@ -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 $?
}

View File

@ -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 $?
}

View File

@ -1,11 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>base-system@gentoo.org</email>
<name>Gentoo Base System</name>
</maintainer>
<longdescription>NFS client and server daemons</longdescription>
<use>
<flag name="junction">Enable NFS junction support in nfsref</flag>
<flag name="ldap">Add ldap support</flag>

View File

@ -1,140 +0,0 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
TMPFILES_OPTIONAL=1
inherit autotools flag-o-matic multilib systemd tmpfiles
DESCRIPTION="NFS client and server daemons"
HOMEPAGE="http://linux-nfs.org/"
if [[ "${PV}" = *_rc* ]] ; then
inherit versionator
MY_PV="$(replace_all_version_separators -)"
SRC_URI="http://git.linux-nfs.org/?p=steved/nfs-utils.git;a=snapshot;h=refs/tags/${PN}-${MY_PV};sf=tgz -> ${P}.tar.gz"
S="${WORKDIR}/${PN}-${PN}-${MY_PV}"
else
SRC_URI="mirror://sourceforge/nfs/${P}.tar.bz2"
KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 s390 sh sparc x86"
fi
LICENSE="GPL-2"
SLOT="0"
IUSE="caps ipv6 kerberos ldap +libmount nfsdcld +nfsidmap +nfsv4 nfsv41 selinux tcpd +uuid"
REQUIRED_USE="kerberos? ( nfsv4 )"
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="
net-libs/libtirpc:=
>=net-nds/rpcbind-0.2.4
sys-libs/e2fsprogs-libs
caps? ( sys-libs/libcap )
ldap? ( net-nds/openldap )
libmount? ( sys-apps/util-linux )
nfsdcld? ( >=dev-db/sqlite-3.3 )
nfsv4? (
dev-libs/libevent:=
>=sys-apps/keyutils-1.5.9
kerberos? (
>=net-libs/libtirpc-0.2.4-r1[kerberos]
app-crypt/mit-krb5
)
)
nfsv41? (
sys-fs/lvm2
)
tcpd? ( sys-apps/tcp-wrappers )
uuid? ( sys-apps/util-linux )"
RDEPEND="${DEPEND_COMMON}
!net-libs/libnfsidmap
!net-nds/portmap
!<sys-apps/openrc-0.13.9
selinux? (
sec-policy/selinux-rpc
sec-policy/selinux-rpcbind
)
"
DEPEND="${DEPEND_COMMON}
net-libs/rpcsvc-proto
virtual/pkgconfig"
PATCHES=(
"${FILESDIR}"/${PN}-1.1.4-mtab-sym.patch
"${FILESDIR}"/${PN}-1.2.8-cross-build.patch
"${FILESDIR}"/${P}-svcgssd_undefined_reference.patch #641912
)
src_prepare() {
default
sed \
-e "/^sbindir/s:= := \"${EPREFIX}\":g" \
-i utils/*/Makefile.am || die
eautoreconf
}
src_configure() {
export libsqlite3_cv_is_recent=yes # Our DEPEND forces this.
export ac_cv_header_keyutils_h=$(usex nfsidmap)
local myeconfargs=(
--with-statedir="${EPREFIX%/}"/var/lib/nfs
--enable-tirpc
--with-tirpcinclude="${EPREFIX%/}"/usr/include/tirpc/
--with-pluginpath="${EPREFIX%/}"/usr/$(get_libdir)/libnfsidmap
--with-rpcgen
--with-systemd="$(systemd_get_systemunitdir)"
--without-gssglue
$(use_enable caps)
$(use_enable ipv6)
$(use_enable kerberos gss)
$(use_enable kerberos svcgss)
$(use_enable ldap)
$(use_enable libmount libmount-mount)
$(use_enable nfsdcld nfsdcltrack)
$(use_enable nfsv4)
$(use_enable nfsv41)
$(use_enable uuid)
$(use_with tcpd tcp-wrappers)
)
econf "${myeconfargs[@]}"
}
src_compile(){
# remove compiled files bundled in the tarball
emake clean
default
}
src_install() {
default
rm linux-nfs/Makefile* || die
dodoc -r linux-nfs README
# 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 "${ED%/}"/var/lib/nfs "${ED%/}"/usr/$(get_libdir)/ || die
if use nfsv4 && use nfsidmap ; then
# Install a config file for idmappers in newer kernels. #415625
insinto /etc/request-key.d
echo 'create id_resolver * * /usr/sbin/nfsidmap -t 600 %k %d' > id_resolver.conf
doins id_resolver.conf
fi
dotmpfiles "${FILESDIR}"/nfs-utils.conf
# Provide an empty xtab for compatibility with the old tmpfiles config.
touch "${ED%/}"/usr/$(get_libdir)/nfs/xtab
# Maintain compatibility with the old gentoo systemd unit names, since nfs-utils has units upstream now.
dosym nfs-server.service "$(systemd_get_systemunitdir)"/nfsd.service
dosym nfs-idmapd.service "$(systemd_get_systemunitdir)"/rpc-idmapd.service
dosym nfs-mountd.service "$(systemd_get_systemunitdir)"/rpc-mountd.service
}

View File

@ -0,0 +1,222 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit autotools linux-info systemd
DESCRIPTION="NFS client and server daemons"
HOMEPAGE="http://linux-nfs.org/"
if [[ "${PV}" = *_rc* ]] ; then
MY_PV="$(ver_rs 1- -)"
SRC_URI="http://git.linux-nfs.org/?p=steved/nfs-utils.git;a=snapshot;h=refs/tags/${PN}-${MY_PV};sf=tgz -> ${P}.tar.gz"
S="${WORKDIR}/${PN}-${PN}-${MY_PV}"
else
SRC_URI="mirror://sourceforge/nfs/${P}.tar.bz2"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~riscv ~s390 sparc x86"
fi
LICENSE="GPL-2"
SLOT="0"
IUSE="caps ipv6 junction kerberos ldap +libmount nfsdcld +nfsidmap +nfsv4 nfsv41 sasl selinux tcpd +uuid"
REQUIRED_USE="kerberos? ( nfsv4 )"
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)
COMMON_DEPEND="
dev-db/sqlite:3
dev-libs/libxml2
net-libs/libtirpc:=
>=net-nds/rpcbind-0.2.4
sys-fs/e2fsprogs
caps? ( sys-libs/libcap )
ldap? (
net-nds/openldap
sasl? (
app-crypt/mit-krb5
dev-libs/cyrus-sasl:2
)
)
libmount? ( sys-apps/util-linux )
nfsv4? (
dev-libs/libevent:=
>=sys-apps/keyutils-1.5.9:=
kerberos? (
>=net-libs/libtirpc-0.2.4-r1[kerberos]
app-crypt/mit-krb5
)
)
nfsv41? (
sys-fs/lvm2
)
tcpd? ( sys-apps/tcp-wrappers )
uuid? ( sys-apps/util-linux )"
DEPEND="${COMMON_DEPEND}
elibc_musl? ( sys-libs/queue-standalone )
"
RDEPEND="${COMMON_DEPEND}
!net-libs/libnfsidmap
!net-nds/portmap
!<sys-apps/openrc-0.13.9
selinux? (
sec-policy/selinux-rpc
sec-policy/selinux-rpcbind
)
"
BDEPEND="
net-libs/rpcsvc-proto
virtual/pkgconfig
"
PATCHES=(
"${FILESDIR}"/${PN}-2.5.2-no-werror.patch
# Upstream, see bug #808183
"${FILESDIR}"/${P}-kernel-5.3-nfsv4.patch
)
pkg_setup() {
linux-info_pkg_setup
if use nfsv4 && ! use nfsdcld && linux_config_exists && ! linux_chkconfig_present CRYPTO_MD5 ; then
ewarn "Your NFS server will be unable to track clients across server restarts!"
ewarn "Please enable the \"${HILITE}nfsdcld${NORMAL}\" USE flag to install the nfsdcltrack usermode"
ewarn "helper upcall program, or enable ${HILITE}CONFIG_CRYPTO_MD5${NORMAL} in your kernel to"
ewarn "support the legacy, in-kernel client tracker."
fi
}
src_prepare() {
default
sed \
-e "/^sbindir/s:= := \"${EPREFIX}\":g" \
-i utils/*/Makefile.am || die
eautoreconf
}
src_configure() {
export libsqlite3_cv_is_recent=yes # Our DEPEND forces this.
export ac_cv_header_keyutils_h=$(usex nfsidmap)
# SASL is consumed in a purely automagic way
export ac_cv_header_sasl_h=no
export ac_cv_header_sasl_sasl_h=$(usex sasl)
local myeconfargs=(
--disable-static
--with-statedir="${EPREFIX}"/var/lib/nfs
--enable-tirpc
--with-tirpcinclude="${ESYSROOT}"/usr/include/tirpc/
--with-pluginpath="${EPREFIX}"/usr/$(get_libdir)/libnfsidmap
--with-rpcgen
--with-systemd="$(systemd_get_systemunitdir)"
--without-gssglue
$(use_enable caps)
$(use_enable ipv6)
$(use_enable junction)
$(use_enable kerberos gss)
$(use_enable kerberos svcgss)
$(use_enable ldap)
$(use_enable libmount libmount-mount)
$(use_enable nfsdcld nfsdcltrack)
$(use_enable nfsv4)
$(use_enable nfsv41)
$(use_enable uuid)
$(use_with tcpd tcp-wrappers)
)
econf "${myeconfargs[@]}"
}
src_compile() {
# remove compiled files bundled in the tarball
emake clean
default
}
src_install() {
default
rm linux-nfs/Makefile* || die
dodoc -r linux-nfs README
# 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 "${ED}"/var/lib/nfs "${ED}"/usr/$(get_libdir)/ || die
# Install some client-side binaries in /sbin
dodir /sbin
mv "${ED}"/usr/sbin/rpc.statd "${ED}"/sbin/ || die
if use nfsv4 && use nfsidmap ; then
insinto /etc
doins support/nfsidmap/idmapd.conf
# Install a config file for idmappers in newer kernels. #415625
insinto /etc/request-key.d
echo 'create id_resolver * * /usr/sbin/nfsidmap -t 600 %k %d' > id_resolver.conf
doins id_resolver.conf
fi
insinto /etc
doins "${FILESDIR}"/exports
keepdir /etc/exports.d
local f list=() opt_need=""
if use nfsv4 ; then
opt_need="rpc.idmapd"
list+=( rpc.idmapd rpc.pipefs )
use kerberos && list+=( rpc.gssd rpc.svcgssd )
fi
for f in nfs nfsclient rpc.statd "${list[@]}" ; do
newinitd "${FILESDIR}"/${f}.initd ${f}
done
newinitd "${FILESDIR}"/nfsmount.initd-1.3.1 nfsmount # Nuke after 2015/08/01
for f in nfs nfsclient ; do
newconfd "${FILESDIR}"/${f}.confd ${f}
done
sed -i \
-e "/^NFS_NEEDED_SERVICES=/s:=.*:=\"${opt_need}\":" \
"${ED}"/etc/conf.d/nfs || die #234132
local systemd_systemunitdir="$(systemd_get_systemunitdir)"
sed -i \
-e 's:/usr/sbin/rpc.statd:/sbin/rpc.statd:' \
"${ED}${systemd_systemunitdir}"/* || die
keepdir /var/lib/nfs #368505
keepdir /var/lib/nfs/v4recovery #603628
# no static archives
find "${ED}" -name '*.la' -delete || die
}
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 "${EROOT}"/usr/$(get_libdir)/nfs/*; do
[[ -e ${EROOT}/var/lib/nfs/${f##*/} ]] && continue
einfo "Copying default ${f##*/} from ${EPREFIX}/usr/$(get_libdir)/nfs to ${EPREFIX}/var/lib/nfs"
cp -pPR "${f}" "${EROOT}"/var/lib/nfs/
done
if systemd_is_booted; then
for v in ${REPLACING_VERSIONS}; do
if ver_test "${v}" -lt 1.3.0; then
ewarn "We have switched to upstream systemd unit files. Since"
ewarn "they got renamed, you should probably enable the new ones."
ewarn "You can run 'equery files nfs-utils | grep systemd'"
ewarn "to know what services you need to enable now."
fi
done
else
ewarn "If you use OpenRC, the nfsmount service has been replaced with nfsclient."
ewarn "If you were using nfsmount, please add nfsclient and netmount to the"
ewarn "same runlevel as nfsmount."
fi
}