From 46d041f720eaefa23b17a8defc0fe5a3f2fb89ce Mon Sep 17 00:00:00 2001 From: Daniel Robbins Date: Fri, 30 Jan 2004 07:50:23 +0000 Subject: new nfs-utils for testing on amd64 and x86 -- 2.6 fixes, restarting defaults to "yes" (nfs team, please review these changes) --- net-fs/nfs-utils/ChangeLog | 18 ++- net-fs/nfs-utils/Manifest | 13 +- net-fs/nfs-utils/files/digest-nfs-utils-1.0.6-r1 | 1 + net-fs/nfs-utils/files/nfs-3 | 166 +++++++++++++++++++++++ net-fs/nfs-utils/nfs-utils-1.0.6-r1.ebuild | 85 ++++++++++++ 5 files changed, 275 insertions(+), 8 deletions(-) create mode 100644 net-fs/nfs-utils/files/digest-nfs-utils-1.0.6-r1 create mode 100644 net-fs/nfs-utils/files/nfs-3 create mode 100644 net-fs/nfs-utils/nfs-utils-1.0.6-r1.ebuild (limited to 'net-fs') diff --git a/net-fs/nfs-utils/ChangeLog b/net-fs/nfs-utils/ChangeLog index d9026a88a1dd..29893fa658fb 100644 --- a/net-fs/nfs-utils/ChangeLog +++ b/net-fs/nfs-utils/ChangeLog @@ -1,9 +1,21 @@ # ChangeLog for net-fs/nfs-utils # Copyright 2002-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/ChangeLog,v 1.31 2004/01/15 22:18:10 agriffis Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/ChangeLog,v 1.32 2004/01/30 07:50:22 drobbins Exp $ - 15 Jan 2004; Aron Griffis nfs-utils-1.0.6.ebuild: - Fix bug 30486 by refraining from overwriting /var/lib/nfs/* +*nfs-utils-1.0.6-r1 (30 Jan 2004) + + 30 Jan 2004; Daniel Robbins nfs-utils-1.0.6-r1.ebuild: + Add a new ebuild (currently unmasked for ~x86 and ~amd64 only) that mounts + the nfsd filesystem to /proc/fs/nfs to provide robust exports handling for + 2.6 kernels. (See /usr/src/linux/Documentation/Changes in a 2.6 kernel source + tree for more information on this.) I needed this fix for mountd to support + nfs version 3 on my server with a 2.6 kernel. Also changed default + "restarting" behavior to "yes," which seems to be what most users will want. + This ebuild is not in stable on any arch, so nfs-team, please let me know + what you think of these changes. + + 15 Jan 2004; Aron Griffis nfs-utils-1.0.6.ebuild: Fix + bug 30486 by refraining from overwriting /var/lib/nfs/* 14 Jan 2004; Martin Holzer files/nfs.confd: removing quota entry from conf.d diff --git a/net-fs/nfs-utils/Manifest b/net-fs/nfs-utils/Manifest index e7e0dc2309ea..f620564a9cef 100644 --- a/net-fs/nfs-utils/Manifest +++ b/net-fs/nfs-utils/Manifest @@ -1,10 +1,13 @@ -MD5 7298c5973562df0f8a349d8538948612 ChangeLog 4692 +MD5 67584117ebc96fce08fea27f6507e6ca nfs-utils-1.0.6-r1.ebuild 2521 +MD5 c986f85c39c93b6efacae1080034a771 nfs-utils-1.0.5-r1.ebuild 1939 MD5 b3bd413a53fa22ed5a89a499f453b9c8 nfs-utils-1.0.6.ebuild 2550 +MD5 d7459d0fe4da19d2be022186afc20c5f ChangeLog 5384 MD5 9cee4adcef8a47ea4ee35090f7f89b0a metadata.xml 225 -MD5 c986f85c39c93b6efacae1080034a771 nfs-utils-1.0.5-r1.ebuild 1939 +MD5 d5d28d5c015b22e7c0d6b1d35ab5baff files/nfs.confd 265 +MD5 f8a4929a63ec37847ed3e67c96cb5a76 files/nfs-2 4753 +MD5 b03529b3a32c6831a84e65789d28d204 files/nfs-3 5154 +MD5 3219e53cb07ef64536526153158b7ab2 files/digest-nfs-utils-1.0.5-r1 67 +MD5 3a3d8bd1a03bbf2c51a4e77a3516febd files/digest-nfs-utils-1.0.6-r1 67 MD5 3a3d8bd1a03bbf2c51a4e77a3516febd files/digest-nfs-utils-1.0.6 67 MD5 a02eed87e5d581e56feb0f6dfd18e6df files/exports 66 -MD5 d5d28d5c015b22e7c0d6b1d35ab5baff files/nfs.confd 265 MD5 e8946ae3996c9629651da1b252fb9836 files/nfsmount 1166 -MD5 3219e53cb07ef64536526153158b7ab2 files/digest-nfs-utils-1.0.5-r1 67 -MD5 f8a4929a63ec37847ed3e67c96cb5a76 files/nfs-2 4753 diff --git a/net-fs/nfs-utils/files/digest-nfs-utils-1.0.6-r1 b/net-fs/nfs-utils/files/digest-nfs-utils-1.0.6-r1 new file mode 100644 index 000000000000..319c3d94379e --- /dev/null +++ b/net-fs/nfs-utils/files/digest-nfs-utils-1.0.6-r1 @@ -0,0 +1 @@ +MD5 f17e9983457e1cf61c37f0be4493fce6 nfs-utils-1.0.6.tar.gz 265964 diff --git a/net-fs/nfs-utils/files/nfs-3 b/net-fs/nfs-utils/files/nfs-3 new file mode 100644 index 000000000000..833a423c7dd3 --- /dev/null +++ b/net-fs/nfs-utils/files/nfs-3 @@ -0,0 +1,166 @@ +#!/sbin/runscript +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/nfs-3,v 1.1 2004/01/30 07:50:23 drobbins Exp $ + +#--------------------------------------------------------------------------- +# This script starts/stops the following +# rpc.statd if necessary (also checked by init.d/nfsmount) +# rpc.rquotad if exists (from quota package) +# rpc.nfsd +# rpc.mountd +#--------------------------------------------------------------------------- + +# NB: Config is in /etc/conf.d/nfs + +opts="start stop restart reload" + +# This variable is used for controlling whether or not to run exportfs -ua; +# see stop() for more information +restarting=yes + +# The binary locations +exportfs=/usr/sbin/exportfs +statd=/sbin/rpc.statd +rquotad=/usr/sbin/rpc.rquotad +nfsd=/usr/sbin/rpc.nfsd +mountd=/usr/sbin/rpc.mountd + +depend() { + need net portmap + after quota +} + +start_statd() { + # Don't start rpc.statd if already started by init.d/nfsmount + killall -0 rpc.statd &>/dev/null && return 0 + ebegin "Starting NFS statd" + start-stop-daemon --start --quiet --exec \ + $statd -- $RPCSTATDOPTS 1>&2 + eend $? "Error starting NFS statd" +} + +stop_statd() { + # Don't stop rpc.statd if it's in use by init.d/nfsmount. + mount -t nfs | grep -q . && return 0 + # Make sure it's actually running + killall -0 rpc.statd &>/dev/null || return 0 + # Okay, all tests passed, stop rpc.statd + ebegin "Stopping NFS statd" + start-stop-daemon --stop --quiet --exec $statd 1>&2 + eend $? "Error stopping NFS statd" +} + +start() { + #This is the new "kernel 2.6 way" to handle the exports file + if grep -q nfsd /proc/filesystems &>/dev/null; then + if ! grep -q "nfsd /proc/fs/nfs" /proc/mounts &>/dev/null; then + ebegin "Mounting nfsd filesystem in /proc" + mount -t nfsd nfsd /proc/fs/nfs + eend $? "Error mounting nfsd filesystem in /proc" + fi + fi + #now that nfsd is mounted inside /proc, we can safely start mountd later + + start_statd + + # 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 -q '^/' /etc/exports &>/dev/null; then + ebegin "Exporting NFS directories" + $exportfs -r 1>&2 & + pid=$! + ( sleep 30; kill -9 $pid &>/dev/null ) & + wait $pid + eend $? "Error exporting NFS directories" + fi + + if [ -x $rquotad ]; then + ebegin "Starting NFS rquotad" + start-stop-daemon --start --quiet --exec \ + $rquotad -- $RPCRQUOTADOPTS 1>&2 + eend $? "Error starting NFS rquotad" + fi + + ebegin "Starting NFS daemon" + start-stop-daemon --start --quiet --exec \ + $nfsd -- $RPCNFSDCOUNT 1>&2 + eend $? "Error starting NFS daemon" + + # Check if we support NFSv3 + ebegin "Starting NFS mountd" + rpcinfo -u localhost nfs 3 &>/dev/null || \ + RPCMOUNTDOPTS="$RPCMOUNTDOPTS --no-nfs-version 3" + start-stop-daemon --start --quiet --exec \ + $mountd -- $RPCMOUNTDOPTS 1>&2 + eend $? "Error starting NFS mountd" +} + +stop() { + # Don't check NFSSERVER variable since it might have changed, + # instead use --oknodo to smooth things over + ebegin "Stopping NFS mountd" + start-stop-daemon --stop --quiet --oknodo \ + --exec $mountd 1>&2 + eend $? "Error stopping NFS mountd" + + # nfsd sets its process name to [nfsd] so don't look for $nfsd + ebegin "Stopping NFS daemon" + start-stop-daemon --stop --quiet --oknodo \ + --name nfsd --user root --signal 2 1>&2 + eend $? "Error stopping NFS daemon" + + if [ -x $rquotad ]; then + ebegin "Stopping NFS rquotad" + start-stop-daemon --stop --quiet --oknodo \ + --exec $rquotad 1>&2 + eend $? "Error stopping NFS rquotad" + fi + + # 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 ]; 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 1>&2 & + pid=$! + ( sleep 30; kill -9 $pid &>/dev/null ) & + wait $pid + eend $? "Error unexporting NFS directories" + fi + + stop_statd +} + +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 & + pid=$! + ( sleep 30; kill -9 $pid &>/dev/null ) & + wait $pid + eend $? "Error exporting NFS directories" +} + +restart() { + # See long comment in stop() regarding "restarting" and exportfs -ua + restarting=yes + svc_stop + svc_start +} diff --git a/net-fs/nfs-utils/nfs-utils-1.0.6-r1.ebuild b/net-fs/nfs-utils/nfs-utils-1.0.6-r1.ebuild new file mode 100644 index 000000000000..fd56705bb6e7 --- /dev/null +++ b/net-fs/nfs-utils/nfs-utils-1.0.6-r1.ebuild @@ -0,0 +1,85 @@ +# Copyright 1999-2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/nfs-utils-1.0.6-r1.ebuild,v 1.1 2004/01/30 07:50:22 drobbins Exp $ + +IUSE="tcpd" + +DESCRIPTION="NFS client and server daemons" +SRC_URI="mirror://sourceforge/nfs/${P}.tar.gz" +HOMEPAGE="http://nfs.sourceforge.net/" +RESTRICT="nomirror" + +SLOT="0" +LICENSE="GPL-2" +KEYWORDS="~x86 ~amd64" + +DEPEND="tcpd? ( sys-apps/tcp-wrappers )" +RDEPEND="${DEPEND} >=net-nds/portmap-5b-r6 >=sys-apps/util-linux-2.11f" + +src_compile() { + ./configure \ + --mandir=/usr/share/man \ + --with-statedir=/var/lib/nfs \ + --disable-rquotad --enable-nfsv3 || die "Configure failed" + + if ! use tcpd; then + sed -i "s:\(-lwrap\|-DHAVE_TCP_WRAPPER\)::" config.mk + fi + + # parallel make still fails + make || die "Failed to compile" +} + +src_install() { + make install install_prefix=${D} MANDIR=${D}/usr/share/man \ + || die "Failed to install" + + # Don't overwrite existing xtab/etab, install the original + # versions somewhere safe... more info in pkg_postinst + mkdir -p ${D}/usr/lib/nfs + mv ${D}/var/lib/nfs/* ${D}/usr/lib/nfs + keepdir /var/lib/nfs + + # Install some client-side binaries in /sbin + mkdir ${D}/sbin + mv ${D}/usr/sbin/rpc.{lockd,statd} ${D}/sbin + + dodoc ChangeLog COPYING README + docinto linux-nfs ; dodoc linux-nfs/* + + insinto /etc ; doins ${FILESDIR}/exports + + exeinto /etc/init.d + newexe ${FILESDIR}/nfs-3 nfs + newexe ${FILESDIR}/nfsmount nfsmount + + insinto /etc/conf.d + newins ${FILESDIR}/nfs.confd nfs +} + +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. This fixes + # bug 30486 + local f + for f in ${ROOT}/usr/lib/nfs/*; do + [[ -f ${ROOT}/var/lib/nfs/${f##*/} ]] && continue + einfo "Copying default ${f##*/} from /usr/lib/nfs to /var/lib/nfs" + cp -a ${f} ${ROOT}/var/lib/nfs/ + done + + echo + einfo "NFS V2 and V3 servers now default to \"sync\" IO if ${P}" + einfo "(or later) is installed." + einfo "More info at ${HOMEPAGE} (see questions 5, 12, 13, and 14)." + echo + ewarn "PLEASE note: Since the latest NFS utils has changed the server" + ewarn "default to \"sync\" IO, then if no behavior is specified in the" + ewarn "export list, thus assuming the default behavior, a warning will" + ewarn "be generated at export time." + echo + + # Running depscan since we introduced /etc/init.d/{portmap,nfs} + /etc/init.d/depscan.sh +} -- cgit v1.2.3-65-gdbad