summaryrefslogtreecommitdiff
path: root/net-fs
diff options
context:
space:
mode:
authorMartin Schlemmer <azarah@gentoo.org>2001-12-23 23:25:19 +0000
committerMartin Schlemmer <azarah@gentoo.org>2001-12-23 23:25:19 +0000
commit787d633b98b304c23ca51cfe761e6581986c3bbc (patch)
treed8c7bd945fd887420b3fdcad4bdb04138d17a520 /net-fs
parentremove a dodir /etc/rc.d/, as it is no longer in use (diff)
downloadhistorical-787d633b98b304c23ca51cfe761e6581986c3bbc.tar.gz
historical-787d633b98b304c23ca51cfe761e6581986c3bbc.tar.bz2
historical-787d633b98b304c23ca51cfe761e6581986c3bbc.zip
moved rc-script config settings to /etc/conf.d
Diffstat (limited to 'net-fs')
-rw-r--r--net-fs/nfs-utils/files/nfs.confd15
-rw-r--r--net-fs/nfs-utils/files/nfs.rc6125
-rw-r--r--net-fs/nfs-utils/files/nfsmount.rc642
-rw-r--r--net-fs/nfs-utils/nfs-utils-0.3.1-r7.ebuild8
4 files changed, 186 insertions, 4 deletions
diff --git a/net-fs/nfs-utils/files/nfs.confd b/net-fs/nfs-utils/files/nfs.confd
new file mode 100644
index 000000000000..b759218b1277
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfs.confd
@@ -0,0 +1,15 @@
+# Config file for /etc/init.d/nfs
+
+# This is a safety net to keep from running an NFS server unless the
+# administrator really wants it. It's mostly historical because early
+# versions of Gentoo didn't split nfs/nfsmount into two scripts.
+# These days it might be safe to remove this eventually, since
+# administrators specifically have to run "rc-update add nfs default"
+# in order for the NFS server to run.
+NFSSERVER=no
+
+# Number of servers to be started up by default
+RPCNFSDCOUNT=8
+
+# Options to pass to rpc.mountd
+RPCMOUNTDOPTS=""
diff --git a/net-fs/nfs-utils/files/nfs.rc6 b/net-fs/nfs-utils/files/nfs.rc6
new file mode 100644
index 000000000000..60fad1963f1a
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfs.rc6
@@ -0,0 +1,125 @@
+#!/sbin/runscript
+# Copyright 1999-2002 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.rc6,v 1.1 2001/12/23 23:25:19 azarah Exp $
+
+#---------------------------------------------------------------------------
+# This script starts/stops the following
+# rpc.statd if necessary (also checked by init.d/nfsmount)
+# rpd.rquotad
+# rpd.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=no
+
+depend() {
+ need net portmap
+}
+
+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 /sbin/rpc.statd 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 /sbin/rpc.statd 1>&2
+ eend $? "Error stopping NFS statd"
+}
+
+start() {
+ if [ "$NFSSERVER" = "yes" ]
+ then
+ start_statd
+
+ if grep -q '^/' /etc/exports &>/dev/null; then
+ ebegin "Exporting NFS directories"
+ /sbin/exportfs -r 1>&2
+ eend $? "Error exporting NFS directories"
+ fi
+
+ ebegin "Starting NFS rquotad"
+ start-stop-daemon --start --quiet --exec /sbin/rpc.rquotad 1>&2
+ eend $? "Error starting NFS rquotad"
+
+ ebegin "Starting NFS daemon"
+ start-stop-daemon --start --quiet --exec \
+ /sbin/rpc.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 \
+ /sbin/rpc.mountd -- $RPCMOUNTDOPTS 1>&2
+ eend $? "Error starting NFS mountd"
+ fi
+}
+
+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 /sbin/rpc.mountd 1>&2
+ eend $? "Error stopping NFS mountd"
+
+ ebegin "Stopping NFS daemon"
+ start-stop-daemon --stop --quiet --oknodo \
+ --name nfsd --user root --signal 2 1>&2
+ eend $? "Error stopping NFS daemon"
+
+ ebegin "Stopping NFS rquotad"
+ start-stop-daemon --stop --quiet --oknodo \
+ --exec /sbin/rpc.rquotad 1>&2
+ eend $? "Error stopping NFS rquotad"
+
+ # 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"
+ /sbin/exportfs -ua 1>&2
+ eend $? "Error unexporting NFS directories"
+ fi
+
+ stop_statd
+}
+
+reload() {
+ /sbin/exportfs -r
+}
+
+restart() {
+ # See long comment in stop() regarding RESTARTING and exportfs -ua
+ RESTARTING=yes
+ stop
+ start
+}
diff --git a/net-fs/nfs-utils/files/nfsmount.rc6 b/net-fs/nfs-utils/files/nfsmount.rc6
new file mode 100644
index 000000000000..f1acd82d86c1
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfsmount.rc6
@@ -0,0 +1,42 @@
+#!/sbin/runscript
+# Copyright 1999-2002 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/nfsmount.rc6,v 1.1 2001/12/23 23:25:19 azarah Exp $
+
+depend() {
+ need net portmap
+}
+
+start_statd() {
+ # Don't start rpc.statd if already started by init.d/nfs
+ killall -0 rpc.statd &>/dev/null && return 0
+ ebegin "Starting NFS statd"
+ start-stop-daemon --start --quiet --exec /sbin/rpc.statd 1>&2
+ eend $? "Error starting NFS statd"
+}
+
+stop_statd() {
+ # Don't stop rpc.statd if it's in use by init.d/nfs
+ killall -0 nfsd &>/dev/null && 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 /sbin/rpc.statd 1>&2
+ eend $? "Error stopping NFS statd"
+}
+
+start() {
+ start_statd
+ ebegin "Mounting NFS filesystems"
+ mount -a -t nfs
+ eend $? "Error mounting NFS filesystems"
+}
+
+stop() {
+ ebegin "Unmounting NFS filesystems"
+ umount -a -t nfs
+ eend $? "Error unmounting NFS filesystems"
+ stop_statd
+}
+
diff --git a/net-fs/nfs-utils/nfs-utils-0.3.1-r7.ebuild b/net-fs/nfs-utils/nfs-utils-0.3.1-r7.ebuild
index 76a5e38608ba..28b5052c270f 100644
--- a/net-fs/nfs-utils/nfs-utils-0.3.1-r7.ebuild
+++ b/net-fs/nfs-utils/nfs-utils-0.3.1-r7.ebuild
@@ -2,7 +2,7 @@
# Distributed under the terms of the GNU General Public License, v2 or later
# Originally written by Achim Gottinger <achim@gentoo.org>
# Heavily updated for nfs-utils-0.3.1 by Aron Griffis <agriffis@gentoo.org>
-# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/nfs-utils-0.3.1-r7.ebuild,v 1.2 2001/10/22 00:13:25 agriffis Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/nfs-utils-0.3.1-r7.ebuild,v 1.3 2001/12/23 23:25:19 azarah Exp $
S=$WORKDIR/$P
DESCRIPTION="kernel NFS daemons"
@@ -45,10 +45,10 @@ src_install() {
dodoc linux-nfs/*
dodir /etc/init.d
exeinto /etc/init.d
- newexe ${FILESDIR}/nfs-${PVR} nfs
- newexe ${FILESDIR}/nfsmount-${PVR} nfsmount
+ newexe ${FILESDIR}/nfs.rc6 nfs
+ newexe ${FILESDIR}/nfsmount.rc6 nfsmount
insinto /etc/conf.d
- newins ${FILESDIR}/nfs.confd-${PVR} nfs
+ newins ${FILESDIR}/nfs.confd nfs
# Don't create runlevels symlinks here. NFS is not something that
# should be enabled by default. Administrators can use rc-update
# to do it themselves.