aboutsummaryrefslogtreecommitdiffstats
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:36 +0000
commit39bb7e32c5eb930981392cec70a063e8dac152b7 (patch)
tree70d98fa405a05f9b101774fe1dd93fe50638f30e /meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon
parent010ffabfb8631bd4894cc3f1f6f0834f3279f30c (diff)
downloadopenembedded-core-contrib-39bb7e32c5eb930981392cec70a063e8dac152b7.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. Signed-off-by: Zhang Xiao <xiao.zhang@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
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 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: nfs-common
+# Required-Start: $portmap hwclock
+# Required-Stop: $portmap hwclock
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: NFS support for both client and server
+# Description: NFS is a popular protocol for file sharing across
+# TCP/IP networks. This service provides various
+# support functions for NFS mounts.
+### END INIT INFO
+#
+# Startup script for nfs-utils
+#
+#
+# Location of executables:
+
+# Source function library.
+. /etc/init.d/functions
+
+test -x "$NFS_STATD" || NFS_STATD=/usr/sbin/rpc.statd
+test -z "$STATD_PID" && STATD_PID=/var/run/rpc.statd.pid
+#
+# The default state directory is /var/lib/nfs
+test -n "$NFS_STATEDIR" || NFS_STATEDIR=/var/lib/nfs
+#
+#----------------------------------------------------------------------
+# Startup and shutdown functions.
+# Actual startup/shutdown is at the end of this file.
+#directories
+create_directories(){
+ echo -n 'creating NFS state directory: '
+ mkdir -p "$NFS_STATEDIR"
+ ( cd "$NFS_STATEDIR"
+ umask 077
+ mkdir -p rpc_pipefs
+ mkdir -p sm sm.bak statd
+ chown rpcuser sm sm.bak statd
+ test -w statd/state || {
+ rm -f statd/state
+ :>statd/state
+ }
+ umask 022
+ for file in xtab etab smtab rmtab
+ do
+ test -w "$file" || {
+ rm -f "$file"
+ :>"$file"
+ }
+ done
+ )
+ chown rpcuser "$NFS_STATEDIR"
+ echo done
+}
+
+#statd
+start_statd(){
+ echo -n "starting statd: "
+ start-stop-daemon --start --exec "$NFS_STATD" --pidfile "$STATD_PID"
+ echo done
+}
+stop_statd(){
+ echo -n 'stopping statd: '
+ start-stop-daemon --stop --quiet --signal 1 --pidfile "$STATD_PID"
+ echo done
+}
+#----------------------------------------------------------------------
+#
+# supported options:
+# start
+# stop
+# restart: stops and starts mountd
+#FIXME: need to create the /var/lib/nfs/... directories
+case "$1" in
+ start)
+ create_directories
+ start_statd;;
+ stop)
+ stop_statd;;
+ status)
+ status $NFS_STATD
+ exit $?;;
+ restart)
+ $0 stop
+ $0 start;;
+ *)
+ echo "Usage: $0 {start|stop|status|restart}"
+ exit 1;;
+esac