net-fs/nfs-utils: Import the latest stable ebuild from Gentoo

This commit is contained in:
David Michael 2018-08-01 00:29:36 +00:00
parent 3a8c8ee881
commit 62409820df
19 changed files with 551 additions and 116 deletions

View File

@ -1 +1 @@
DIST nfs-utils-1.3.2.tar.bz2 789540 SHA256 5b9c72eef260b86a84619771e11bb013b99431e6b7ff0bbdc03fee90dba591f7 SHA512 65633db58bbc5b6bff6acab412dc085affc61e0a6e0aef72d630e67d05a8d08012dced81178a4c7af65c967c25b48161f8d887d261fdf5ce505b719dbdab757c WHIRLPOOL eee615f032987aee71adf04a3ad5f5b8f79dc4487f1be1a7fb87c42918a12ef9397ba990b02d4adb02265706df9f1e3ef409c141491759c65b8037693b9b06c9
DIST nfs-utils-2.3.1.tar.bz2 854899 BLAKE2B f9541b9dc103d978f21d57d8ba0c14a3b30f6ba874b112239d014076c1c72b6654e8e02b4bfea686e658dac84d1e896b872bc2054591275ef1713ae4e7b7d005 SHA512 de3e70f8656bc5b5aa98262685a9e80929c6314234d9bbb74d4c7efcb7a8b2640d48d2100850b403157ebefc8f0eb48598b48238fae795f64c7a0e9a8bff93e3

View File

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

View File

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

View File

@ -1,18 +0,0 @@
Fixed in 2.2.1 commit 907426b00bdcd69d9a56ac1870990e8ae8c6fe9f
use rpcbind.target instead of .socket (as the upstream commit uses)
because the future versions of nfs-server.service activate the socket
while ours activate the service.
diff --git a/systemd/nfs-mountd.service b/systemd/nfs-mountd.service
index d908afe..587112b 100644
--- a/systemd/nfs-mountd.service
+++ b/systemd/nfs-mountd.service
@@ -3,6 +3,7 @@ Description=NFS Mount Daemon
Requires=proc-fs-nfsd.mount
After=proc-fs-nfsd.mount
After=network.target
+After=rpcbind.target
BindsTo=nfs-server.service
Wants=nfs-config.service

View File

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

@ -1,7 +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/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,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
}

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

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,9 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<herd>net-fs</herd>
<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>
<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>

View File

@ -1,19 +1,26 @@
# Copyright 1999-2015 Gentoo Foundation
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI="5"
EAPI=6
inherit eutils flag-o-matic multilib autotools systemd
inherit autotools flag-o-matic multilib systemd
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"
KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
IUSE="caps ipv6 kerberos +libmount nfsdcld +nfsidmap +nfsv4 nfsv41 selinux tcpd +uuid"
IUSE="caps ipv6 kerberos ldap +libmount nfsdcld +nfsidmap +nfsv4 nfsv41 selinux tcpd +uuid"
REQUIRED_USE="kerberos? ( nfsv4 )"
RESTRICT="test" #315573
@ -21,30 +28,29 @@ RESTRICT="test" #315573
# files, and nfs-utils doesn't build against heimdal either,
# so don't depend on virtual/krb.
# (04 Feb 2005 agriffis)
DEPEND_COMMON="tcpd? ( sys-apps/tcp-wrappers )
caps? ( sys-libs/libcap )
DEPEND_COMMON="
net-libs/libtirpc:=
>=net-nds/rpcbind-0.2.4
sys-libs/e2fsprogs-libs
>=net-nds/rpcbind-0.2.0-r1
net-libs/libtirpc
caps? ( sys-libs/libcap )
ldap? ( net-nds/openldap )
libmount? ( sys-apps/util-linux )
nfsdcld? ( >=dev-db/sqlite-3.3 )
nfsv4? (
dev-libs/libevent
>=net-libs/libnfsidmap-0.21-r1
dev-libs/libevent:=
>=sys-apps/keyutils-1.5.9
kerberos? (
>=net-libs/libtirpc-0.2.4-r1[kerberos]
app-crypt/mit-krb5
)
nfsidmap? (
>=net-libs/libnfsidmap-0.24
>=sys-apps/keyutils-1.5.9
)
)
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? (
@ -53,39 +59,49 @@ RDEPEND="${DEPEND_COMMON}
)
"
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() {
epatch "${FILESDIR}"/${PN}-1.1.4-mtab-sym.patch
epatch "${FILESDIR}"/${PN}-1.2.8-cross-build.patch
epatch "${FILESDIR}"/${PN}-1.3.2-background-statd.patch
epatch "${FILESDIR}"/${PN}-1.3.2-rpcbind-after.patch
default
sed \
-e "/^sbindir/s:= := \"${EPREFIX}\":g" \
-i utils/*/Makefile.am || die
epatch_user
eautoreconf
}
src_configure() {
export libsqlite3_cv_is_recent=yes # Our DEPEND forces this.
export ac_cv_header_keyutils_h=$(usex nfsidmap)
econf \
--with-statedir="${EPREFIX}"/var/lib/nfs \
--enable-tirpc \
--with-tirpcinclude="${EPREFIX}"/usr/include/tirpc/ \
$(use_enable libmount libmount-mount) \
$(use_with tcpd tcp-wrappers) \
$(use_enable nfsdcld nfsdcltrack) \
$(use_enable nfsv4) \
$(use_enable nfsv41) \
$(use_enable ipv6) \
$(use_enable caps) \
$(use_enable uuid) \
$(use_enable kerberos gss) \
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(){
@ -102,11 +118,11 @@ src_install() {
# 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 "${ED}"/usr/$(get_libdir) || die
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
mv "${ED%/}"/usr/sbin/rpc.statd "${ED%/}"/sbin/ || die
if use nfsv4 && use nfsidmap ; then
# Install a config file for idmappers in newer kernels. #415625
@ -115,25 +131,35 @@ src_install() {
doins id_resolver.conf
fi
systemd_dotmpfilesd "${FILESDIR}"/nfs-utils.conf
systemd_dounit systemd/*.{mount,service,target}
if ! use nfsv4 || ! use kerberos ; then
rm "${D}$(systemd_get_unitdir)"/rpc-{gssd,svcgssd}.service || die
fi
if ! use nfsv41 ; then
rm "${D}$(systemd_get_unitdir)"/nfs-blkmap.* || die
fi
rm "${D}$(systemd_get_unitdir)"/nfs-config.service || die
sed -i -r \
-e "/^EnvironmentFile=/d" \
-e '/^(After|Wants)=nfs-config.service$/d' \
-e 's:/usr/sbin/rpc.statd:/sbin/rpc.statd:' \
"${D}$(systemd_get_unitdir)"/* || die
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
# maintain compatibility with the old gentoo systemd unit names, since nfs-utils has units upstream now.
dosym nfs-server.service "$(systemd_get_unitdir)"/nfsd.service
dosym nfs-idmapd.service "$(systemd_get_unitdir)"/rpc-idmapd.service
dosym nfs-mountd.service "$(systemd_get_unitdir)"/rpc-mountd.service
}
pkg_postinst() {
@ -141,11 +167,10 @@ pkg_postinst() {
# 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
mkdir -p "${EROOT}"/var/lib/nfs #368505
for f in "${EROOT}"/usr/$(get_libdir)/nfs/*; do
[[ -e ${EROOT}/var/lib/nfs/${f##*/} ]] && continue
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/
cp -pPR "${f}" "${EROOT%/}"/var/lib/nfs/
done
if systemd_is_booted; then