summaryrefslogtreecommitdiffstats
path: root/abs/core/runit-scripts/runitscripts/services/nfs-common/run
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/runit-scripts/runitscripts/services/nfs-common/run')
-rwxr-xr-xabs/core/runit-scripts/runitscripts/services/nfs-common/run81
1 files changed, 81 insertions, 0 deletions
diff --git a/abs/core/runit-scripts/runitscripts/services/nfs-common/run b/abs/core/runit-scripts/runitscripts/services/nfs-common/run
new file mode 100755
index 0000000..bf6c2a1
--- /dev/null
+++ b/abs/core/runit-scripts/runitscripts/services/nfs-common/run
@@ -0,0 +1,81 @@
+#!/bin/bash
+exec 2>&1
+export TERM=linux
+daemon_name=nfs-common
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/$daemon_name.conf
+
+
+# rpc.statd daemon & binary location
+STATD_DAEMON_NAME=rpc.statd
+STATD="/usr/sbin/rpc.statd"
+
+# rpc.idmapd daemon & binary location
+IDMAPD_DAEMON_NAME=rpc.idmapd
+IDMAPD="/usr/sbin/rpc.idmapd"
+
+# rpc.gssd daemon & binary location
+GSSD_DAEMON_NAME=rpc.gssd
+GSSD="/usr/sbin/rpc.gssd"
+
+
+# Default mountpoint and options for rpc_pipefs filesystem
+[ -z "$PIPEFS_MOUNTPOINT" ] && PIPEFS_MOUNTPOINT="/var/lib/nfs/rpc_pipefs"
+[ -z "$PIPEFS_MOUNTOPTS" ] && PIPEFS_MOUNTOPTS="defaults"
+
+
+
+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
+}
+
+get_pid() {
+ pidof -o %PPID "$1"
+}
+
+
+
+
+
+
+stat_runit "Starting $daemon_name"
+svwaitup rpcbind >/dev/null 2>/dev/null
+/usr/sbin/sm-notify $SMNOTIFY_OPTS
+do_modprobe sunrpc
+do_modprobe nfs
+do_modprobe nfsd
+do_mount rpc_pipefs "$PIPEFS_MOUNTPOINT" "$PIPEFS_MOUNTOPTS"
+
+
+stat_runit "Starting $IDMAPD_DAEMON_NAME"
+$IDMAPD
+
+stat_runit "Starting $GSSD_DAEMON_NAME"
+do_modprobe rpcsec_gss_krb5
+$GSSD
+
+$STATD -F