Merge pull request #1132 from mischief/import-nfs-utils

net-fs/nfs-utils: import from portage-stable
This commit is contained in:
Nick Owens 2015-03-06 12:03:55 -08:00
commit bfc1941b07
13 changed files with 311 additions and 0 deletions

View File

@ -0,0 +1 @@
DIST nfs-utils-1.2.9.tar.bz2 774112 SHA256 90b76d5692a520b74273e607a4fd69df4cc35f65e242e22e2bc61b58759722f3 SHA512 c71f986a7e8f38492f8411540b32fef904f689b45b831e0e3c193628085d09742c6352dc42d6d374b8ded12e2b54f8fb3c8de66695a36cf038fc4afa5c29879e WHIRLPOOL 22e86859e9bf7a9a298c91f73a8afea63aa1e39753062ff664a17601d311d62f8f0efed8a0c5271751b53bb46cfc91bf721ca852dc1e744e4bb51f321a34c119

View File

@ -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+");

View File

@ -0,0 +1,48 @@
this is kind of hacky, but automake doesn't make this easy
for us atm, so hack away :(
(recent autotools will always add $(CFLAGS)/etc... to the compile)
--- a/tools/locktest/Makefile.am
+++ b/tools/locktest/Makefile.am
@@ -1,12 +1,11 @@
## Process this file with automake to produce Makefile.in
CC=$(CC_FOR_BUILD)
-LIBTOOL = @LIBTOOL@ --tag=CC
+CFLAGS=$(CFLAGS_FOR_BUILD)
+CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
+LDFLAGS=$(LDFLAGS_FOR_BUILD)
noinst_PROGRAMS = testlk
testlk_SOURCES = testlk.c
-testlk_CFLAGS=$(CFLAGS_FOR_BUILD)
-testlk_CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
-testlk_LDFLAGS=$(LDFLAGS_FOR_BUILD)
MAINTAINERCLEANFILES = Makefile.in
--- a/tools/rpcgen/Makefile.am
+++ b/tools/rpcgen/Makefile.am
@@ -1,7 +1,9 @@
## Process this file with automake to produce Makefile.in
CC=$(CC_FOR_BUILD)
-LIBTOOL = @LIBTOOL@ --tag=CC
+CFLAGS=$(CFLAGS_FOR_BUILD)
+CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
+LDFLAGS=$(LDFLAGS_FOR_BUILD)
noinst_PROGRAMS = rpcgen
rpcgen_SOURCES = rpc_clntout.c rpc_cout.c rpc_hout.c rpc_main.c \
@@ -9,10 +11,6 @@
rpc_util.c rpc_sample.c rpc_output.h rpc_parse.h \
rpc_scan.h rpc_util.h
-rpcgen_CFLAGS=$(CFLAGS_FOR_BUILD)
-rpcgen_CPPLAGS=$(CPPFLAGS_FOR_BUILD)
-rpcgen_LDFLAGS=$(LDFLAGS_FOR_BUILD)
-rpcgen_LDADD=$(LIBTIRPC)
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = rpcgen.new.1

View File

@ -0,0 +1,3 @@
d /var/lib/nfs/rpc_pipefs
d /var/lib/nfs/v4recovery
d /var/lib/nfs/v4root

View File

@ -0,0 +1,15 @@
[Unit]
Description=NFS server
After=rpcbind.service
Requires=rpcbind.service
[Service]
Type=oneshot
ExecStart=/usr/sbin/rpc.nfsd 8
ExecStartPost=/usr/sbin/exportfs -a
ExecStop=/usr/sbin/rpc.nfsd 0
ExecStopPost=/usr/sbin/exportfs -a -u
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,8 @@
[Unit]
Description=NFS Configuration File System
DefaultDependencies=no
[Mount]
What=sunrpc
Where=/proc/fs/nfsd
Type=nfsd

View File

@ -0,0 +1,12 @@
[Unit]
Description=RPC GSS-API Client Daemon
Documentation=man:rpc.gssd(8)
After=rpcbind.service var-lib-nfs-rpc_pipefs.mount
Requires=rpcbind.service var-lib-nfs-rpc_pipefs.mount
Before=remote-fs-pre.target
[Service]
ExecStart=/usr/sbin/rpc.gssd -f
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,11 @@
[Unit]
Description=NFS v4 ID-Name Mapping Daemon
Documentation=man:rpc.idmapd(8) man:idmapd.conf(5)
After=var-lib-nfs-rpc_pipefs.mount nfsd.service
Requires=var-lib-nfs-rpc_pipefs.mount
[Service]
ExecStart=/usr/sbin/rpc.idmapd -f
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,10 @@
[Unit]
Description=NFS Mount Daemon
After=rpcbind.service nfsd.service
Requires=rpcbind.service nfsd.service
[Service]
ExecStart=/usr/sbin/rpc.mountd -F
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,12 @@
[Unit]
Description=NFSv2/3 Network Status Monitor Daemon
After=rpcbind.service
Requires=rpcbind.service
Before=remote-fs-pre.target
Wants=remote-fs-pre.target
[Service]
ExecStart=/sbin/rpc.statd -F
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,13 @@
[Unit]
Description=RPC GSS-API Server Daemon
Documentation=man:rpc.svcgssd(8)
After=rpcbind.service
Requires=rpcbind.service
Before=nfs-server.target
PartOf=nfs-server.target
[Service]
ExecStart=/usr/sbin/rpc.svcgssd -f
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,7 @@
[Unit]
Description=RPC Pipe File System
[Mount]
What=rpc_pipefs
Where=/var/lib/nfs/rpc_pipefs
Type=rpc_pipefs

View File

@ -0,0 +1,132 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/nfs-utils-1.2.9-r3.ebuild,v 1.7 2014/08/11 13:38:48 vapier Exp $
EAPI="4"
inherit eutils flag-o-matic multilib autotools systemd
DESCRIPTION="NFS client and server daemons"
HOMEPAGE="http://linux-nfs.org/"
SRC_URI="mirror://sourceforge/nfs/${P}.tar.bz2"
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"
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="tcpd? ( sys-apps/tcp-wrappers )
caps? ( sys-libs/libcap )
sys-libs/e2fsprogs-libs
>=net-nds/rpcbind-0.2.0-r1
net-libs/libtirpc
libmount? ( sys-apps/util-linux )
nfsdcld? ( >=dev-db/sqlite-3.3 )
nfsv4? (
>=dev-libs/libevent-1.0b
>=net-libs/libnfsidmap-0.21-r1
kerberos? (
>=net-libs/libtirpc-0.2.4-r1[kerberos]
app-crypt/mit-krb5
)
nfsidmap? (
>=net-libs/libnfsidmap-0.24
sys-apps/keyutils
)
)
nfsv41? (
sys-fs/lvm2
)
selinux? (
sec-policy/selinux-rpc
sec-policy/selinux-rpcbind
)
uuid? ( sys-apps/util-linux )"
RDEPEND="${DEPEND_COMMON} !net-nds/portmap"
DEPEND="${DEPEND_COMMON}
virtual/pkgconfig"
src_prepare() {
epatch "${FILESDIR}"/${PN}-1.1.4-mtab-sym.patch
epatch "${FILESDIR}"/${PN}-1.2.8-cross-build.patch
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)
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) \
--without-gssglue
}
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 "${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
# 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
systemd_dotmpfilesd "${FILESDIR}"/nfs-utils.conf
systemd_dounit "${FILESDIR}"/nfsd.service
systemd_dounit "${FILESDIR}"/rpc-statd.service
systemd_dounit "${FILESDIR}"/rpc-mountd.service
systemd_dounit "${FILESDIR}"/rpc-idmapd.service
systemd_dounit "${FILESDIR}"/{proc-fs-nfsd,var-lib-nfs-rpc_pipefs}.mount
use nfsv4 && use kerberos && systemd_dounit "${FILESDIR}"/rpc-{gssd,svcgssd}.service
}
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
mkdir -p "${EROOT}"/var/lib/nfs #368505
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
}