diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2015-01-19 13:59:55 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2015-01-19 13:59:55 +0300 |
commit | 60d33496e097afc161e9ce949bb92ad6f3942619 (patch) | |
tree | 9fc650b780ac03a8f2c72b35de44756564e22211 /net-fs | |
parent | e3759e2c6961fafce2deac9701f5a2d1c61e3a43 (diff) |
nfs-utils scm build
Diffstat (limited to 'net-fs')
25 files changed, 856 insertions, 0 deletions
diff --git a/net-fs/nfs-utils/files/exports b/net-fs/nfs-utils/files/exports new file mode 100644 index 0000000..5102ef2 --- /dev/null +++ b/net-fs/nfs-utils/files/exports @@ -0,0 +1 @@ +# /etc/exports: NFS file systems being exported. See exports(5). diff --git a/net-fs/nfs-utils/files/nfs-utils-1.1.4-mtab-sym.patch b/net-fs/nfs-utils/files/nfs-utils-1.1.4-mtab-sym.patch new file mode 100644 index 0000000..c9e60af --- /dev/null +++ b/net-fs/nfs-utils/files/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/net-fs/nfs-utils/files/nfs-utils-1.2.8-cross-build.patch b/net-fs/nfs-utils/files/nfs-utils-1.2.8-cross-build.patch new file mode 100644 index 0000000..7317115 --- /dev/null +++ b/net-fs/nfs-utils/files/nfs-utils-1.2.8-cross-build.patch @@ -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 diff --git a/net-fs/nfs-utils/files/nfs-utils-1.3.0-gcc-4.9.patch b/net-fs/nfs-utils/files/nfs-utils-1.3.0-gcc-4.9.patch new file mode 100644 index 0000000..e2d98b5 --- /dev/null +++ b/net-fs/nfs-utils/files/nfs-utils-1.3.0-gcc-4.9.patch @@ -0,0 +1,62 @@ +From 25e83c2270b2d2966c992885faed0b79be09f474 Mon Sep 17 00:00:00 2001 +From: Jeff Layton <jlayton@poochiereds.net> +Date: Thu, 1 May 2014 11:15:16 -0400 +Subject: [PATCH [nfs-utils]] mountd: fix segfault in add_name with newer gcc + compilers + +I hit a segfault in add_name with a mountd built with gcc-4.9.0. Some +NULL pointer checks got reordered such that a pointer was dereferenced +before checking to see whether it was NULL. The problem was due to +nfs-utils relying on undefined behavior, which tricked gcc into assuming +that the pointer would never be NULL. + +At first I assumed that this was a compiler bug, but Jakub Jelinek and +Jeff Law pointed out: + +"If old is NULL, then: + + strncpy(new, old, cp-old); + +is undefined behavior (even when cp == old == NULL in that case), +therefore gcc assumes that old is never NULL, as otherwise it would be +invalid. + +Just guard + strncpy(new, old, cp-old); + new[cp-old] = 0; +with if (old) { ... }." + +This patch does that. If old is NULL though, then we still need to +ensure that new is NULL terminated, lest the subsequent strcats walk off +the end of it. + +Cc: Jeff Law <law@redhat.com> +Cc: Jakub Jelinek <jakub@redhat.com> +Signed-off-by: Jeff Layton <jlayton@poochiereds.net> +Signed-off-by: Steve Dickson <steved@redhat.com> +--- + support/export/client.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/support/export/client.c b/support/export/client.c +index dbf47b9..f85e11c 100644 +--- a/support/export/client.c ++++ b/support/export/client.c +@@ -482,8 +482,12 @@ add_name(char *old, const char *add) + else + cp = cp + strlen(cp); + } +- strncpy(new, old, cp-old); +- new[cp-old] = 0; ++ if (old) { ++ strncpy(new, old, cp-old); ++ new[cp-old] = 0; ++ } else { ++ new[0] = 0; ++ } + if (cp != old && !*cp) + strcat(new, ","); + strcat(new, add); +-- +2.0.0 + diff --git a/net-fs/nfs-utils/files/nfs-utils.conf b/net-fs/nfs-utils/files/nfs-utils.conf new file mode 100644 index 0000000..b9b586c --- /dev/null +++ b/net-fs/nfs-utils/files/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/net-fs/nfs-utils/files/nfs.confd b/net-fs/nfs-utils/files/nfs.confd new file mode 100644 index 0000000..d493400 --- /dev/null +++ b/net-fs/nfs-utils/files/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="" + +# Number of servers to be started up by default +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/net-fs/nfs-utils/files/nfs.initd b/net-fs/nfs-utils/files/nfs.initd new file mode 100755 index 0000000..e4239b7 --- /dev/null +++ b/net-fs/nfs-utils/files/nfs.initd @@ -0,0 +1,163 @@ +#!/sbin/runscript +# 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/files/nfs.initd,v 1.28 2014/06/20 06:21:22 vapier Exp $ + +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/net-fs/nfs-utils/files/nfsclient.confd b/net-fs/nfs-utils/files/nfsclient.confd new file mode 100644 index 0000000..d885b63 --- /dev/null +++ b/net-fs/nfs-utils/files/nfsclient.confd @@ -0,0 +1,7 @@ +# 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/net-fs/nfs-utils/files/nfsclient.initd b/net-fs/nfs-utils/files/nfsclient.initd new file mode 100644 index 0000000..a13a5ce --- /dev/null +++ b/net-fs/nfs-utils/files/nfsclient.initd @@ -0,0 +1,39 @@ +#!/sbin/runscript +# 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/files/nfsclient.initd,v 1.3 2014/12/24 18:09:21 radhermit Exp $ + +[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs + +depend() { + local opts myneed="" + if [ -e /etc/fstab ] ; then + fstabinfo -t nfs4 -q && myneed="$myneed rpc.idmapd" + fstabinfo -t nfs -q && myneed="$myneed rpc.statd" + + for opts in $(fstabinfo -o -t nfs,nfs4) ; do + case $opts in + *sec=krb*|*sec=spkm*) myneed="$myneed rpc.gssd" ;; + esac + done + fi + before netmount + config /etc/fstab + need portmap ${myneed} + provide nfsmount + 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/net-fs/nfs-utils/files/nfsd.service-r1 b/net-fs/nfs-utils/files/nfsd.service-r1 new file mode 100644 index 0000000..e15cf98 --- /dev/null +++ b/net-fs/nfs-utils/files/nfsd.service-r1 @@ -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 diff --git a/net-fs/nfs-utils/files/nfsmount.confd b/net-fs/nfs-utils/files/nfsmount.confd new file mode 100644 index 0000000..4183536 --- /dev/null +++ b/net-fs/nfs-utils/files/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/net-fs/nfs-utils/files/nfsmount.initd b/net-fs/nfs-utils/files/nfsmount.initd new file mode 100755 index 0000000..6bb1009 --- /dev/null +++ b/net-fs/nfs-utils/files/nfsmount.initd @@ -0,0 +1,48 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/nfsmount.initd,v 1.15 2013/03/24 20:29:48 vapier Exp $ + +[ -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/net-fs/nfs-utils/files/proc-fs-nfsd.mount b/net-fs/nfs-utils/files/proc-fs-nfsd.mount new file mode 100644 index 0000000..26b58b9 --- /dev/null +++ b/net-fs/nfs-utils/files/proc-fs-nfsd.mount @@ -0,0 +1,8 @@ +[Unit] +Description=NFS Configuration File System +DefaultDependencies=no + +[Mount] +What=sunrpc +Where=/proc/fs/nfsd +Type=nfsd diff --git a/net-fs/nfs-utils/files/rpc-gssd.service b/net-fs/nfs-utils/files/rpc-gssd.service new file mode 100644 index 0000000..4c96dee --- /dev/null +++ b/net-fs/nfs-utils/files/rpc-gssd.service @@ -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 diff --git a/net-fs/nfs-utils/files/rpc-idmapd.service b/net-fs/nfs-utils/files/rpc-idmapd.service new file mode 100644 index 0000000..4a63b91 --- /dev/null +++ b/net-fs/nfs-utils/files/rpc-idmapd.service @@ -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 diff --git a/net-fs/nfs-utils/files/rpc-mountd.service-r1 b/net-fs/nfs-utils/files/rpc-mountd.service-r1 new file mode 100644 index 0000000..d5f5b24 --- /dev/null +++ b/net-fs/nfs-utils/files/rpc-mountd.service-r1 @@ -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 diff --git a/net-fs/nfs-utils/files/rpc-statd.service-r2 b/net-fs/nfs-utils/files/rpc-statd.service-r2 new file mode 100644 index 0000000..3633ebd --- /dev/null +++ b/net-fs/nfs-utils/files/rpc-statd.service-r2 @@ -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 diff --git a/net-fs/nfs-utils/files/rpc-svcgssd.service b/net-fs/nfs-utils/files/rpc-svcgssd.service new file mode 100644 index 0000000..121c61a --- /dev/null +++ b/net-fs/nfs-utils/files/rpc-svcgssd.service @@ -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 diff --git a/net-fs/nfs-utils/files/rpc.gssd.initd b/net-fs/nfs-utils/files/rpc.gssd.initd new file mode 100755 index 0000000..f1b8f87 --- /dev/null +++ b/net-fs/nfs-utils/files/rpc.gssd.initd @@ -0,0 +1,24 @@ +#!/sbin/runscript +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.gssd.initd,v 1.11 2008/10/26 09:02:47 vapier Exp $ + +[ -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/net-fs/nfs-utils/files/rpc.idmapd.initd b/net-fs/nfs-utils/files/rpc.idmapd.initd new file mode 100755 index 0000000..52838b5 --- /dev/null +++ b/net-fs/nfs-utils/files/rpc.idmapd.initd @@ -0,0 +1,26 @@ +#!/sbin/runscript +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.idmapd.initd,v 1.8 2009/03/14 18:43:18 vapier Exp $ + +[ -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/net-fs/nfs-utils/files/rpc.pipefs.initd b/net-fs/nfs-utils/files/rpc.pipefs.initd new file mode 100644 index 0000000..ebae3b9 --- /dev/null +++ b/net-fs/nfs-utils/files/rpc.pipefs.initd @@ -0,0 +1,33 @@ +#!/sbin/runscript +# 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/files/rpc.pipefs.initd,v 1.3 2014/06/20 04:33:57 vapier Exp $ + +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/net-fs/nfs-utils/files/rpc.statd.initd b/net-fs/nfs-utils/files/rpc.statd.initd new file mode 100755 index 0000000..14f8b34 --- /dev/null +++ b/net-fs/nfs-utils/files/rpc.statd.initd @@ -0,0 +1,33 @@ +#!/sbin/runscript +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.statd.initd,v 1.7 2009/01/31 22:16:11 vapier Exp $ + +[ -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/net-fs/nfs-utils/files/rpc.svcgssd.initd b/net-fs/nfs-utils/files/rpc.svcgssd.initd new file mode 100755 index 0000000..74383e2 --- /dev/null +++ b/net-fs/nfs-utils/files/rpc.svcgssd.initd @@ -0,0 +1,24 @@ +#!/sbin/runscript +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.svcgssd.initd,v 1.5 2008/10/26 09:02:47 vapier Exp $ + +[ -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/net-fs/nfs-utils/files/var-lib-nfs-rpc_pipefs.mount b/net-fs/nfs-utils/files/var-lib-nfs-rpc_pipefs.mount new file mode 100644 index 0000000..c416658 --- /dev/null +++ b/net-fs/nfs-utils/files/var-lib-nfs-rpc_pipefs.mount @@ -0,0 +1,7 @@ +[Unit] +Description=RPC Pipe File System + +[Mount] +What=rpc_pipefs +Where=/var/lib/nfs/rpc_pipefs +Type=rpc_pipefs diff --git a/net-fs/nfs-utils/nfs-utils-scm.ebuild b/net-fs/nfs-utils/nfs-utils-scm.ebuild new file mode 100644 index 0000000..4249d7e --- /dev/null +++ b/net-fs/nfs-utils/nfs-utils-scm.ebuild @@ -0,0 +1,173 @@ +# Copyright 1999-2015 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.3.1-r1.ebuild,v 1.3 2015/01/17 03:08:28 zlogene Exp $ + +EAPI="5" + +inherit eutils flag-o-matic multilib autotools systemd git-r3 + +DESCRIPTION="NFS client and server daemons" +HOMEPAGE="http://linux-nfs.org/" +SRC_URI="" +EGIT_REPO_URI="git://git.linux-nfs.org/projects/steved/nfs-utils.git" + + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="" +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-1.5.9 + ) + ) + nfsv41? ( + sys-fs/lvm2 + ) + uuid? ( sys-apps/util-linux )" +RDEPEND="${DEPEND_COMMON} + !net-nds/portmap + !<sys-apps/openrc-0.13.4 + selinux? ( + sec-policy/selinux-rpc + sec-policy/selinux-rpcbind + ) +" +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 + + 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 + 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 + + systemd_dounit systemd/*.{mount,service,target} + if ! use nfsv4 || ! use kerberos ; then + rm "${D}$(systemd_get_unitdir)"/rpc-{gssd,svcgssd}.service || die + fi + rm "${D}$(systemd_get_unitdir)"/nfs-config.service || die + sed -i -r \ + -e "/^EnvironmentFile=/s:=.*:=${EPREFIX}/etc/conf.d/nfs:" \ + -e '/^(After|Wants)=nfs-config.service$/d' \ + -e 's:/usr/sbin/rpc.statd:/sbin/rpc.statd:' \ + "${D}$(systemd_get_unitdir)"/* || 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 + 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 + + if systemd_is_booted; then + if [[ ${REPLACING_VERSIONS} < 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 + 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 +} |