summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon
diff options
context:
space:
mode:
authorZhang Xiao <xiao.zhang@windriver.com>2013-11-21 16:07:24 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-12-09 18:01:44 +0000
commitc0e048d33d5a5557ba24d74751aca7b000b16649 (patch)
tree533a51c9342854a62bb3ee62f9575d924e8d9441 /meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon
parentfedd84f7eee7dba095459cde4df435975c7e6aac (diff)
downloadpoky-c0e048d33d5a5557ba24d74751aca7b000b16649.tar.gz
nfs-utils: separate package as Debain style
Move binaries used for both nfs client and server into client package. Add an init script for client package and move necessary progress from server's init script to this one. Make client package more powerful and let server package depends on client one, as Debain does. (From OE-Core rev: 39bb7e32c5eb930981392cec70a063e8dac152b7) Signed-off-by: Zhang Xiao <xiao.zhang@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon')
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon90
1 files changed, 90 insertions, 0 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