void-packages/srcpkgs/nfs-utils/files/nfs-server/run

29 lines
787 B
Bash

#!/bin/sh
exec 2>&1
# Make sure the statd service is running.
sv check statd >/dev/null || exit 1
# This was probably only used correctly to set PROCESSES
[ -r /etc/conf.d/nfs-server.conf ] && . /etc/conf.d/nfs-server.conf
# Settings in ./conf should be preferred over /etc/conf.d/nfs-server.conf
[ -r ./conf ] && . ./conf
# Check/mount rpc_pipefs (loads sunrpc kernel module)
if ! mountpoint -q /var/lib/nfs/rpc_pipefs; then
mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs -o defaults || exit 1
fi
# Check/mount nfsd (loads nfsd kernel module)
if ! mountpoint -q /proc/fs/nfsd; then
mount -t nfsd nfsd /proc/fs/nfsd || exit 1
fi
exportfs -ra > /dev/null || exit 1
rpc.nfsd ${NFSD_OPTS} -- ${PROCESSES:=4} || exit 1
sm-notify
exec rpc.mountd ${MOUNTD_OPTS} --foreground