net-fs/nfs-utils: Sync with Gentoo

It's from Gentoo commit 3e3629046e131c3cb490b2e5afbe8f57659b4015.
This commit is contained in:
Krzesimir Nowak 2025-04-03 13:38:39 +02:00
parent b3d123f22e
commit e1b1b378b1
18 changed files with 873 additions and 229 deletions

View File

@ -1 +1,2 @@
DIST nfs-utils-2.5.4.tar.bz2 943373 BLAKE2B 72ed871613701f5b035941a7aed957771fe3b6a19fefee203130442c292bbbefde35721f2287fef19046d2d837faeda43b06a93a5acdb8ac6240eef90e6dd12c SHA512 b1395c5b06a06246666c48174594b1e08b71cf40b8f94b533497bd92625401a669e2c40e48dbd665891ad2247bc94d7d604d0c5d0f0b66bfe957b03d42e5d305
DIST nfs-utils-2.6.4.tar.bz2 979652 BLAKE2B 45f6e9c98e8148e82684526c2ab0f8976b2a46fd869d91f03cf9afffbaad64b77dc1729a50b74d30c5d65bfe213a1da2f54e3d3e19539b61994f7b65671a26ab SHA512 e5fde25c54f594d00e69c9aeff8abc22663b994ecd37d8516751be98b51b12c61ffec47ee128794e170ec773f0649cb594df1ca104ec4dba561823db423f8533
DIST nfs-utils-2.7.1.tar.bz2 1001424 BLAKE2B 176c5559c23c2761c1f2beed068fda8bdd39ac9fa09b4b223552c1455152c410d8925adf8d0023300d4355338e9dc8f6b2774ba71488e795945e5f1fee2b305c SHA512 9e55d4a0d672dbb0e20f8ea0213355a0bec054124c2a9437b3e4b81214c24ef5adb43914bd8606d4af14801ec8e6a4f849c9a97d76ae0879566792bbc960845a

View File

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

View File

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

@ -0,0 +1,26 @@
C99 `inline` is not guaranteed to emit an external definition
https://www.greenend.org.uk/rjk/tech/inline.html
Bug: https://bugs.gentoo.org/922958
--- a/utils/exportd/exportd.c
+++ b/utils/exportd/exportd.c
@@ -53,7 +53,7 @@
*/
inline static void set_signals(void);
-inline void
+inline static void
cleanup_lockfiles (void)
{
unlink(etab.lockfn);
--- a/utils/mountd/mountd.c
+++ b/utils/mountd/mountd.c
@@ -111,7 +111,7 @@
nfs_svc_unregister(MOUNTPROG, MOUNTVERS_NFSV3);
}
-static void
+inline static void
cleanup_lockfiles (void)
{
unlink(etab.lockfn);

View File

@ -0,0 +1,41 @@
https://bugs.gentoo.org/922373
https://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commit;h=bb25f3f594ddf85e5826e931eaaa35874f6a4204
From bb25f3f594ddf85e5826e931eaaa35874f6a4204 Mon Sep 17 00:00:00 2001
From: Petr Vorel <pvorel@suse.cz>
Date: Wed, 3 Jan 2024 19:07:43 -0500
Subject: [PATCH] reexport/{fsidd,reexport}.c: Re-add missing includes
Older uClibc-ng requires <unistd.h> for close(2), unlink(2) and write(2),
<sys/un.h> for struct sockaddr_un.
Fixes: 1a4edb2a ("reexport/fsidd.c: Remove unused headers")
Fixes: bdc79f02 ("support/reexport.c: Remove unused headers")
Reviewed-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
Tested-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Steve Dickson <steved@redhat.com>
--- a/support/reexport/fsidd.c
+++ b/support/reexport/fsidd.c
@@ -7,6 +7,8 @@
#include <dlfcn.h>
#endif
#include <event2/event.h>
+#include <sys/un.h>
+#include <unistd.h>
#include "conffile.h"
#include "reexport_backend.h"
--- a/support/reexport/reexport.c
+++ b/support/reexport/reexport.c
@@ -7,6 +7,7 @@
#endif
#include <sys/types.h>
#include <sys/vfs.h>
+#include <unistd.h>
#include <errno.h>
#include "nfsd_path.h"
--
1.8.3.1

View File

@ -0,0 +1,32 @@
Gentoo installs sysctl in /usr/sbin
https://bugs.gentoo.org/907688
--- a/systemd/60-nfs.rules
+++ b/systemd/60-nfs.rules
@@ -2,20 +2,20 @@
# sunrpc module supports "sunrpc.*" sysctls
ACTION=="add", SUBSYSTEM=="module", KERNEL=="sunrpc", \
- RUN+="/sbin/sysctl -q --pattern ^sunrpc --system"
+ RUN+="/usr/sbin/sysctl -q --pattern ^sunrpc --system"
# rpcrdma module supports sunrpc.svc_rdma.*
ACTION=="add", SUBSYSTEM=="module", KERNEL=="rpcrdma", \
- RUN+="/sbin/sysctl -q --pattern ^sunrpc.svc_rdma --system"
+ RUN+="/usr/sbin/sysctl -q --pattern ^sunrpc.svc_rdma --system"
# lockd module supports "fs.nfs.nlm*" and "fs.nfs.nsm*" sysctls
ACTION=="add", SUBSYSTEM=="module", KERNEL=="lockd", \
- RUN+="/sbin/sysctl -q --pattern ^fs.nfs.n[sl]m --system"
+ RUN+="/usr/sbin/sysctl -q --pattern ^fs.nfs.n[sl]m --system"
# nfsv4 module supports "fs.nfs.*" sysctls (nfs_callback_tcpport and idmap_cache_timeout)
ACTION=="add", SUBSYSTEM=="module", KERNEL=="nfsv4", \
- RUN+="/sbin/sysctl -q --pattern ^fs.nfs.(nfs_callback_tcpport|idmap_cache_timeout) --system"
+ RUN+="/usr/sbin/sysctl -q --pattern ^fs.nfs.(nfs_callback_tcpport|idmap_cache_timeout) --system"
# nfs module supports "fs.nfs.*" sysctls
ACTION=="add", SUBSYSTEM=="module", KERNEL=="nfs", \
- RUN+="/sbin/sysctl -q --pattern ^fs.nfs --system"
+ RUN+="/usr/sbin/sysctl -q --pattern ^fs.nfs --system"

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,155 @@
#!/sbin/openrc-run
# Copyright 1999-2024 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
need 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 + $?))
ebegin "Stopping NFS daemon"
# Do not attempt to signal kernel nfsd threads directly, #924309
${nfsd} 0
eend $?
ret=$((ret + $?))
# 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,34 @@
#!/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
need 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,24 @@
#!/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
need 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,26 @@
#!/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
need 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,24 @@
#!/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
need 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,21 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!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>
<use>
<flag name="junction">Enable NFS junction support in nfsref</flag>
<flag name="ldap">Add ldap support</flag>
<flag name="libmount">Link mount.nfs with libmount</flag>
<flag name="nfsdcld">Enable nfsdcld NFSv4 clientid tracking daemon</flag>
<flag name="nfsidmap">Enable support for newer nfsidmap helper</flag>
<flag name="nfsv4">Enable support for NFSv4</flag>
<flag name="nfsv41">Enable support for NFSv4.1</flag>
<flag name="uuid">Support UUID lookups in rpc.mountd</flag>
</use>
<upstream>
<remote-id type="sourceforge">nfs</remote-id>
</upstream>
<maintainer type="project">
<email>base-system@gentoo.org</email>
<name>Gentoo Base System</name>
</maintainer>
<use>
<flag name="junction">Enable NFS junction support in nfsref</flag>
<flag name="ldap">Add ldap support</flag>
<flag name="libmount">Link mount.nfs with libmount</flag>
<flag name="nfsv3">Enable support for NFSv2 and NFSv3</flag>
<flag name="nfsv4">Enable support for NFSv4 (includes NFSv4.1 and NFSv4.2)</flag>
<flag name="uuid">Support UUID lookups in rpc.mountd</flag>
</use>
<upstream>
<remote-id type="cpe">cpe:/a:linux-nfs:nfs-utils</remote-id>
<remote-id type="sourceforge">nfs</remote-id>
</upstream>
</pkgmetadata>

View File

@ -1,170 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
TMPFILES_OPTIONAL=1
inherit autotools linux-info systemd tmpfiles
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
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
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,214 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit autotools linux-info systemd
DESCRIPTION="NFS client and server daemons"
HOMEPAGE="http://linux-nfs.org/ https://git.linux-nfs.org/?p=steved/nfs-utils.git"
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="https://downloads.sourceforge.net/nfs/${P}.tar.bz2"
KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
fi
LICENSE="GPL-2"
SLOT="0"
IUSE="caps junction kerberos ldap +libmount +nfsv3 +nfsv4 sasl selinux tcpd +uuid"
REQUIRED_USE="|| ( nfsv3 nfsv4 ) kerberos? ( nfsv4 )"
# bug #315573
RESTRICT="test"
# 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-libs/libxml2
net-libs/libtirpc:=
sys-fs/e2fsprogs
dev-db/sqlite:3
dev-libs/libevent:=
caps? ( sys-libs/libcap )
ldap? (
net-nds/openldap:=
sasl? (
app-crypt/mit-krb5
dev-libs/cyrus-sasl:2
)
)
libmount? ( sys-apps/util-linux )
nfsv3? ( >=net-nds/rpcbind-0.2.4 )
nfsv4? (
>=sys-apps/keyutils-1.5.9:=
sys-fs/lvm2
kerberos? (
>=net-libs/libtirpc-0.2.4-r1[kerberos]
app-crypt/mit-krb5
)
)
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
selinux? (
sec-policy/selinux-rpc
nfsv3? ( sec-policy/selinux-rpcbind )
)
"
BDEPEND="
net-libs/rpcsvc-proto
virtual/pkgconfig
"
PATCHES=(
"${FILESDIR}"/${PN}-2.5.2-no-werror.patch
"${FILESDIR}"/${PN}-udev-sysctl.patch
"${FILESDIR}"/${P}-includes.patch
"${FILESDIR}"/${P}-C99-inline.patch
)
pkg_setup() {
linux-info_pkg_setup
if use nfsv4 && 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 ${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() {
# Our DEPEND forces this.
export libsqlite3_cv_is_recent=yes
export ac_cv_header_keyutils_h=$(usex nfsv4)
# 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)
--enable-ipv6
$(use_enable junction)
$(use_enable kerberos gss)
$(use_enable kerberos svcgss)
$(use_enable ldap)
$(use_enable libmount libmount-mount)
$(use_enable nfsv4)
$(use_enable nfsv4 nfsdcld)
$(use_enable nfsv4 nfsdcltrack)
$(use_enable nfsv4 nfsv41)
$(use_enable nfsv4 nfsv4server)
$(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 ; then
insinto /etc
doins support/nfsidmap/idmapd.conf
# Install a config file for idmappers in newer kernels. bug #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=()
if use nfsv4 ; then
list+=( rpc.idmapd rpc.pipefs )
use kerberos && list+=( rpc.gssd rpc.svcgssd )
fi
local sedexp=( -e '#placehoder' )
use nfsv3 || sedexp+=( -e '/need portmap/d' )
mkdir -p "${T}/init.d" || die
for f in nfs nfsclient rpc.statd "${list[@]}" ; do
sed "${sedexp[@]}" "${FILESDIR}/${f}.initd" > "${T}/init.d/${f}" || die
doinitd "${T}/init.d/${f}"
done
local systemd_systemunitdir="$(systemd_get_systemunitdir)"
sed -i \
-e 's:/usr/sbin/rpc.statd:/sbin/rpc.statd:' \
"${ED}${systemd_systemunitdir}"/* || die
# Remove legacy service if not requested (as it will be broken without rpcbind)
if ! use nfsv3; then
rm "${ED}${systemd_systemunitdir}/nfs-server.service" || die
fi
# bug #368505
keepdir /var/lib/nfs
# bug #603628
keepdir /var/lib/nfs/v4recovery
# 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
}

View File

@ -0,0 +1,214 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit autotools linux-info systemd
DESCRIPTION="NFS client and server daemons"
HOMEPAGE="http://linux-nfs.org/ https://git.linux-nfs.org/?p=steved/nfs-utils.git"
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="https://downloads.sourceforge.net/nfs/${P}.tar.bz2"
KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
fi
LICENSE="GPL-2"
SLOT="0"
IUSE="caps junction kerberos ldap +libmount +nfsv3 +nfsv4 sasl selinux tcpd +uuid"
REQUIRED_USE="|| ( nfsv3 nfsv4 ) kerberos? ( nfsv4 )"
# bug #315573
RESTRICT="test"
# 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-libs/libxml2
net-libs/libtirpc:=
sys-fs/e2fsprogs
dev-db/sqlite:3
dev-libs/libevent:=
caps? ( sys-libs/libcap )
ldap? (
net-nds/openldap:=
sasl? (
app-crypt/mit-krb5
dev-libs/cyrus-sasl:2
)
)
libmount? ( sys-apps/util-linux )
nfsv3? ( >=net-nds/rpcbind-0.2.4 )
nfsv4? (
>=sys-apps/keyutils-1.5.9:=
sys-fs/lvm2
kerberos? (
>=net-libs/libtirpc-0.2.4-r1[kerberos]
app-crypt/mit-krb5
)
)
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
selinux? (
sec-policy/selinux-rpc
nfsv3? ( sec-policy/selinux-rpcbind )
)
"
BDEPEND="
net-libs/rpcsvc-proto
virtual/pkgconfig
"
PATCHES=(
"${FILESDIR}"/${PN}-2.5.2-no-werror.patch
"${FILESDIR}"/${PN}-udev-sysctl.patch
"${FILESDIR}"/${PN}-2.6.4-C99-inline.patch
)
pkg_setup() {
linux-info_pkg_setup
if use nfsv4 && 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 CONFIG_CRYPTO_MD5 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() {
# Our DEPEND forces this.
export libsqlite3_cv_is_recent=yes
export ac_cv_header_keyutils_h=$(usex nfsv4)
# 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)
--enable-ipv6
$(use_enable junction)
$(use_enable kerberos gss)
$(use_enable kerberos svcgss)
$(use_enable ldap)
$(use_enable libmount libmount-mount)
$(use_enable nfsv4)
$(use_enable nfsv4 nfsdcld)
$(use_enable nfsv4 nfsdcltrack)
$(use_enable nfsv4 nfsv41)
$(use_enable nfsv4 nfsv4server)
$(use_enable uuid)
$(use_with kerberos krb5 "${ESYSROOT}"/usr)
$(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 ; then
insinto /etc
doins support/nfsidmap/idmapd.conf
# Install a config file for idmappers in newer kernels. bug #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=()
if use nfsv4 ; then
list+=( rpc.idmapd rpc.pipefs )
use kerberos && list+=( rpc.gssd rpc.svcgssd )
fi
local sedexp=( -e '#placehoder' )
use nfsv3 || sedexp+=( -e '/need portmap/d' )
mkdir -p "${T}/init.d" || die
for f in nfs nfsclient rpc.statd "${list[@]}" ; do
sed "${sedexp[@]}" "${FILESDIR}/${f}.initd" > "${T}/init.d/${f}" || die
doinitd "${T}/init.d/${f}"
done
local systemd_systemunitdir="$(systemd_get_systemunitdir)"
sed -i \
-e 's:/usr/sbin/rpc.statd:/sbin/rpc.statd:' \
"${ED}${systemd_systemunitdir}"/* || die
# Remove legacy service if not requested (as it will be broken without rpcbind)
if ! use nfsv3; then
rm "${ED}${systemd_systemunitdir}/nfs-server.service" || die
fi
# bug #368505
keepdir /var/lib/nfs
# bug #603628
keepdir /var/lib/nfs/v4recovery
# 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
}