summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/nfs-utils/nfs-utils
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/nfs-utils/nfs-utils')
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon90
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver46
2 files changed, 93 insertions, 43 deletions
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon
new file mode 100644
index 0000000000..c949b96d1e
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon
@@ -0,0 +1,90 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: nfs-common
4# Required-Start: $portmap hwclock
5# Required-Stop: $portmap hwclock
6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6
8# Short-Description: NFS support for both client and server
9# Description: NFS is a popular protocol for file sharing across
10# TCP/IP networks. This service provides various
11# support functions for NFS mounts.
12### END INIT INFO
13#
14# Startup script for nfs-utils
15#
16#
17# Location of executables:
18
19# Source function library.
20. /etc/init.d/functions
21
22test -x "$NFS_STATD" || NFS_STATD=/usr/sbin/rpc.statd
23test -z "$STATD_PID" && STATD_PID=/var/run/rpc.statd.pid
24#
25# The default state directory is /var/lib/nfs
26test -n "$NFS_STATEDIR" || NFS_STATEDIR=/var/lib/nfs
27#
28#----------------------------------------------------------------------
29# Startup and shutdown functions.
30# Actual startup/shutdown is at the end of this file.
31#directories
32create_directories(){
33 echo -n 'creating NFS state directory: '
34 mkdir -p "$NFS_STATEDIR"
35 ( cd "$NFS_STATEDIR"
36 umask 077
37 mkdir -p rpc_pipefs
38 mkdir -p sm sm.bak statd
39 chown rpcuser sm sm.bak statd
40 test -w statd/state || {
41 rm -f statd/state
42 :>statd/state
43 }
44 umask 022
45 for file in xtab etab smtab rmtab
46 do
47 test -w "$file" || {
48 rm -f "$file"
49 :>"$file"
50 }
51 done
52 )
53 chown rpcuser "$NFS_STATEDIR"
54 echo done
55}
56
57#statd
58start_statd(){
59 echo -n "starting statd: "
60 start-stop-daemon --start --exec "$NFS_STATD" --pidfile "$STATD_PID"
61 echo done
62}
63stop_statd(){
64 echo -n 'stopping statd: '
65 start-stop-daemon --stop --quiet --signal 1 --pidfile "$STATD_PID"
66 echo done
67}
68#----------------------------------------------------------------------
69#
70# supported options:
71# start
72# stop
73# restart: stops and starts mountd
74#FIXME: need to create the /var/lib/nfs/... directories
75case "$1" in
76 start)
77 create_directories
78 start_statd;;
79 stop)
80 stop_statd;;
81 status)
82 status $NFS_STATD
83 exit $?;;
84 restart)
85 $0 stop
86 $0 start;;
87 *)
88 echo "Usage: $0 {start|stop|status|restart}"
89 exit 1;;
90esac
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver
index c263f14f32..6e0df7e2ea 100644
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver
@@ -1,8 +1,8 @@
1#!/bin/sh 1#!/bin/sh
2### BEGIN INIT INFO 2### BEGIN INIT INFO
3# Provides: nfs-kernel-server 3# Provides: nfs-kernel-server
4# Required-Start: $remote_fs $portmap hwclock 4# Required-Start: $remote_fs nfs-common $portmap hwclock
5# Required-Stop: $remote_fs $portmap hwclock 5# Required-Stop: $remote_fs nfs-common $portmap hwclock
6# Default-Start: 2 3 4 5 6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6 7# Default-Stop: 0 1 6
8# Short-Description: Kernel NFS server support 8# Short-Description: Kernel NFS server support
@@ -24,8 +24,6 @@ test -r /etc/default/nfsd && . /etc/default/nfsd
24# Location of executables: 24# Location of executables:
25test -x "$NFS_MOUNTD" || NFS_MOUNTD=/usr/sbin/rpc.mountd 25test -x "$NFS_MOUNTD" || NFS_MOUNTD=/usr/sbin/rpc.mountd
26test -x "$NFS_NFSD" || NFS_NFSD=/usr/sbin/rpc.nfsd 26test -x "$NFS_NFSD" || NFS_NFSD=/usr/sbin/rpc.nfsd
27test -x "$NFS_STATD" || NFS_STATD=/usr/sbin/rpc.statd
28test -z "$STATD_PID" && STATD_PID=/var/run/rpc.statd.pid
29# 27#
30# The user mode program must also exist (it just starts the kernel 28# The user mode program must also exist (it just starts the kernel
31# threads using the kernel module code). 29# threads using the kernel module code).
@@ -36,34 +34,9 @@ test -x "$NFS_NFSD" || exit 0
36# ridiculous 99 34# ridiculous 99
37test "$NFS_SERVERS" != "" && test "$NFS_SERVERS" -gt 0 && test "$NFS_SERVERS" -lt 100 || NFS_SERVERS=8 35test "$NFS_SERVERS" != "" && test "$NFS_SERVERS" -gt 0 && test "$NFS_SERVERS" -lt 100 || NFS_SERVERS=8
38# 36#
39# The default state directory is /var/lib/nfs
40test -n "$NFS_STATEDIR" || NFS_STATEDIR=/var/lib/nfs
41#
42#---------------------------------------------------------------------- 37#----------------------------------------------------------------------
43# Startup and shutdown functions. 38# Startup and shutdown functions.
44# Actual startup/shutdown is at the end of this file. 39# Actual startup/shutdown is at the end of this file.
45#directories
46create_directories(){
47 echo -n 'creating NFS state directory: '
48 mkdir -p "$NFS_STATEDIR"
49 ( cd "$NFS_STATEDIR"
50 umask 077
51 mkdir -p sm sm.bak
52 test -w sm/state || {
53 rm -f sm/state
54 :>sm/state
55 }
56 umask 022
57 for file in xtab etab smtab rmtab
58 do
59 test -w "$file" || {
60 rm -f "$file"
61 :>"$file"
62 }
63 done
64 )
65 echo done
66}
67#mountd 40#mountd
68start_mountd(){ 41start_mountd(){
69 echo -n 'starting mountd: ' 42 echo -n 'starting mountd: '
@@ -124,17 +97,6 @@ stop_nfsd(){
124 fi 97 fi
125} 98}
126 99
127#statd
128start_statd(){
129 echo -n "starting statd: "
130 start-stop-daemon --start --exec "$NFS_STATD" --pidfile "$STATD_PID"
131 echo done
132}
133stop_statd(){
134 echo -n 'stopping statd: '
135 start-stop-daemon --stop --quiet --signal 1 --pidfile "$STATD_PID"
136 echo done
137}
138#---------------------------------------------------------------------- 100#----------------------------------------------------------------------
139# 101#
140# supported options: 102# supported options:
@@ -144,13 +106,11 @@ stop_statd(){
144# restart: stops and starts mountd 106# restart: stops and starts mountd
145#FIXME: need to create the /var/lib/nfs/... directories 107#FIXME: need to create the /var/lib/nfs/... directories
146case "$1" in 108case "$1" in
147 start) create_directories 109 start)
148 start_nfsd "$NFS_SERVERS" 110 start_nfsd "$NFS_SERVERS"
149 start_mountd 111 start_mountd
150 start_statd
151 test -r /etc/exports && exportfs -a;; 112 test -r /etc/exports && exportfs -a;;
152 stop) exportfs -ua 113 stop) exportfs -ua
153 stop_statd
154 stop_mountd 114 stop_mountd
155 stop_nfsd;; 115 stop_nfsd;;
156 status) 116 status)