diff options
Diffstat (limited to 'abs/core/runit-scripts/runitscripts/services/nfsd')
-rwxr-xr-x | abs/core/runit-scripts/runitscripts/services/nfsd/run | 63 |
1 files changed, 52 insertions, 11 deletions
diff --git a/abs/core/runit-scripts/runitscripts/services/nfsd/run b/abs/core/runit-scripts/runitscripts/services/nfsd/run index 207d7cd..f043143 100755 --- a/abs/core/runit-scripts/runitscripts/services/nfsd/run +++ b/abs/core/runit-scripts/runitscripts/services/nfsd/run @@ -7,23 +7,64 @@ stat_runit "Starting NFSD" # Make sure the statd daemon is up # (the statd service must ensure portmap is running first) -svwaitup /var/service/nfslock >/dev/null 2>/dev/null +svwaitup /var/service/nfs-common >/dev/null 2>/dev/null + +source /etc/conf.d/nfs-server.conf + +NFSD="/usr/sbin/rpc.nfsd" + + + +# Default number of nfsd servers +[ -z "$NFSD_COUNT" ] && NFSD_COUNT=8 + +# Default mountpoint and options for nfsd filesystem +[ -z "$PROCNFSD_MOUNTPOINT" ] && PROCNFSD_MOUNTPOINT="/proc/fs/nfsd" +[ -z "$PROCNFSD_MOUNTOPTS" ] && PROCNFSD_MOUNTOPTS="rw,nodev,noexec,nosuid" + +do_modprobe() { + if [ -x /sbin/modprobe -a -f /proc/modules ]; then + modprobe -q "$1" || true + fi +} + + + +do_mount() { + if ! grep -E "$1\$" /proc/filesystems &> /dev/null ; then + return 1 + fi + + if grep -vw "$1" /proc/mounts &> /dev/null ; then + if ! mountpoint -q "$2" ; then + mount -t "$1" "$1" "$2" -o "$3" + return + fi + fi + return 0 +} + +do_umount() { + if mountpoint -q "$1" ; then + umount "$1" + fi + return 0 +} + -source /etc/conf.d/nfs -# Re-export all directories in /etc/exports -/usr/sbin/exportfs -ra > /dev/null 2>/dev/null # start some nfsd threads printhl " Using ${NFSD_OPTS} " -/usr/sbin/rpc.nfsd ${NFSD_OPTS} >/dev/null 2>/dev/null +do_modprobe nfsd +do_mount nfsd "$PROCNFSD_MOUNTPOINT" "$PROCNFSD_MOUNTOPTS" + +# Re-export all directories in /etc/exports +/usr/sbin/exportfs -ra > /dev/null 2>/dev/null -# since we are running kernel 2.6 we should also -# mount the nfsd virtual filesystem -printhl " mount nfsd" -/bin/mount -t nfsd none /proc/fs/nfsd >/dev/null 2>/dev/null + $NFSD $NFSD_OPTS $NFSD_COUNT -# Start the rpc.mountd daemon -exec /usr/sbin/rpc.mountd --foreground >/dev/null 2>/dev/null +# +exec /usr/sbin/rpc.mountd --foreground >/dev/null 2>/dev/null |