summaryrefslogtreecommitdiff
path: root/meta/packages/nfs-utils/files
diff options
context:
space:
mode:
authorMarcin Juszkiewicz <hrw@openedhand.com>2007-03-22 18:31:40 +0000
committerMarcin Juszkiewicz <hrw@openedhand.com>2007-03-22 18:31:40 +0000
commitf40f63143b48e2ec2572b31f101621f02dd77138 (patch)
treee5608c39da8971f80c525a35ce7f0b3ea94d30b3 /meta/packages/nfs-utils/files
parent6b86555e703297cba0431c8708efa2aacae5ce8c (diff)
downloadopenembedded-core-f40f63143b48e2ec2572b31f101621f02dd77138.tar.gz
openembedded-core-f40f63143b48e2ec2572b31f101621f02dd77138.tar.bz2
openembedded-core-f40f63143b48e2ec2572b31f101621f02dd77138.zip
nfs-utils: moved from meta-extras to meta
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1385 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/nfs-utils/files')
-rw-r--r--meta/packages/nfs-utils/files/nfs-utils-1.0.6-uclibc.patch18
-rw-r--r--meta/packages/nfs-utils/files/nfsserver132
2 files changed, 150 insertions, 0 deletions
diff --git a/meta/packages/nfs-utils/files/nfs-utils-1.0.6-uclibc.patch b/meta/packages/nfs-utils/files/nfs-utils-1.0.6-uclibc.patch
new file mode 100644
index 0000000000..ebd3276be2
--- /dev/null
+++ b/meta/packages/nfs-utils/files/nfs-utils-1.0.6-uclibc.patch
@@ -0,0 +1,18 @@
+--- ./support/nfs/svc_socket.c.orig 2004-12-12 06:43:52.000000000 +0000
++++ ./support/nfs/svc_socket.c 2004-12-12 06:50:04.000000000 +0000
+@@ -66,6 +66,7 @@
+ __bzero ((char *) &addr, sizeof (addr));
+ addr.sin_family = AF_INET;
+
++#ifndef __UCLIBC__ /* neither getrpcbynumber() nor getrpcbynumber_r() is SuSv3 */
+ ret = getrpcbynumber_r (number, &rpcbuf, rpcdata, sizeof rpcdata,
+ &rpcp);
+ if (ret == 0 && rpcp != NULL)
+@@ -99,6 +100,7 @@
+ }
+ }
+ else
++#endif
+ {
+ if (bindresvport (sock, &addr))
+ {
diff --git a/meta/packages/nfs-utils/files/nfsserver b/meta/packages/nfs-utils/files/nfsserver
new file mode 100644
index 0000000000..4ff75916d0
--- /dev/null
+++ b/meta/packages/nfs-utils/files/nfsserver
@@ -0,0 +1,132 @@
+#!/bin/sh
+#
+# Startup script for nfs-utils
+#
+# The nfsd kernel module must exist along with its dependencies
+modprobe -n nfsd || exit 0
+#
+# The environment variable NFS_SERVERS may be set in /etc/default/nfsd
+# Other control variables may be overridden here too
+test -r /etc/default/nfsd && . /etc/default/nfsd
+#
+# Location of exectuables:
+test -x "$NFS_MOUNTD" || NFS_MOUNTD=/usr/sbin/mountd
+test -x "$NFS_NFSD" || NFS_NFSD=/usr/sbin/nfsd
+#
+# The user mode program must also exist (it just starts the kernel
+# threads using the kernel module code).
+test -x "$NFS_MOUNTD" || exit 0
+test -x "$NFS_NFSD" || exit 0
+#
+# Default is 8 threads, value is settable between 1 and the truely
+# ridiculous 99
+test "$NFS_SERVERS" -gt 0 && test "$NFS_SERVERS" -lt 100 || NFS_SERVERS=8
+#
+# 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 sm sm.bak
+ test -w sm/state || {
+ rm -f sm/state
+ :>sm/state
+ }
+ umask 022
+ for file in xtab etab smtab rmtab
+ do
+ test -w "$file" || {
+ rm -f "$file"
+ :>"$file"
+ }
+ done
+ )
+ echo done
+}
+#mountd
+start_mountd(){
+ echo -n 'starting mountd: '
+ start-stop-daemon --start --exec "$NFS_MOUNTD" -- "-f /etc/exports $@"
+ echo done
+}
+stop_mountd(){
+ echo -n 'stopping mountd: '
+ start-stop-daemon --stop --quiet --exec "$NFS_MOUNTD"
+ echo done
+}
+#
+#nfsd
+start_nfsd(){
+ echo -n "starting $1 nfsd kernel threads: "
+ start-stop-daemon --start --exec "$NFS_NFSD" -- "$@"
+ echo done
+}
+delay_nfsd(){
+ for delay in 0 1 2 3 4 5 6 7 8 9
+ do
+ if pidof nfsd >/dev/null
+ then
+ echo -n .
+ sleep 1
+ else
+ return 0
+ fi
+ done
+ return 1
+}
+stop_nfsd(){
+ # WARNING: this kills any process with the executable
+ # name 'nfsd'.
+ echo -n 'stopping nfsd: '
+ start-stop-daemon --stop --quiet --signal 1 --name nfsd
+ if delay_nfsd || {
+ echo failed
+ echo ' using signal 9: '
+ start-stop-daemon --stop --quiet --signal 9 --name nfsd
+ delay_nfsd
+ }
+ then
+ echo done
+ # This will remove, recursively, dependencies
+ echo -n 'removing nfsd kernel module: '
+ if modprobe -r nfsd
+ then
+ echo done
+ else
+ echo failed
+ fi
+ else
+ echo failed
+ fi
+}
+#----------------------------------------------------------------------
+#
+# supported options:
+# start
+# stop
+# reload: reloads the exports file
+# restart: stops and starts mountd
+#FIXME: need to create the /var/lib/nfs/... directories
+case "$1" in
+start) create_directories
+ start_nfsd "$NFS_SERVERS"
+ start_mountd
+ test -r /etc/exports && exportfs -a;;
+stop) exportfs -ua
+ stop_mountd
+ stop_nfsd;;
+reload) test -r /etc/exports && exportfs -r;;
+restart)exportfs -ua
+ stop_mountd
+ # restart does not restart the kernel threads,
+ # only the user mode processes
+ start_mountd
+ test -r /etc/exports && exportfs -a;;
+esac