summaryrefslogtreecommitdiffstats
path: root/abs/core/runit-scripts/runitscripts/services/nfs-common/run
blob: 10532ac55d9c4b350d267ae90fe7f889ca8353db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/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/bin/rpc.statd"

# rpc.idmapd daemon & binary location
IDMAPD_DAEMON_NAME=rpc.idmapd
IDMAPD="/usr/bin/rpc.idmapd"

# rpc.gssd daemon & binary location
GSSD_DAEMON_NAME=rpc.gssd
GSSD="/usr/bin/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 /usr/bin/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 NFS-common: $daemon_name"
svwaitup rpcbind  >/dev/null 2>/dev/null

printhl "    NFS-common: sm-notify"
/usr/bin/sm-notify $SMNOTIFY_OPTS >/dev/null 2>/dev/null
do_modprobe sunrpc
do_modprobe nfs
do_modprobe nfsd
do_mount rpc_pipefs "$PIPEFS_MOUNTPOINT" "$PIPEFS_MOUNTOPTS"


printhl "    NFS-common: $IDMAPD_DAEMON_NAME"
$IDMAPD

printhl "    NFS-common: $GSSD_DAEMON_NAME"
do_modprobe rpcsec_gss_krb5
$GSSD

$STATD -F > /dev/null 2>/dev/null