aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-connectivity/nfs-utils/nfs-utils
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-connectivity/nfs-utils/nfs-utils')
-rw-r--r--recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.0.6-uclibc.patch44
-rw-r--r--recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-uclibc-libio.h.patch52
-rw-r--r--recipes-connectivity/nfs-utils/nfs-utils/nfsserver161
3 files changed, 209 insertions, 48 deletions
diff --git a/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.0.6-uclibc.patch b/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.0.6-uclibc.patch
index 3c8f9fb..6d46d3a 100644
--- a/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.0.6-uclibc.patch
+++ b/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.0.6-uclibc.patch
@@ -1,22 +1,22 @@
-Upstream-Status: Inappropriate [embedded specific]
-
-Index: nfs-utils-1.2.3/support/nfs/svc_socket.c
-===================================================================
---- nfs-utils-1.2.3.orig/support/nfs/svc_socket.c
-+++ nfs-utils-1.2.3/support/nfs/svc_socket.c
-@@ -67,6 +67,7 @@ svc_socket (u_long number, int type, int
- memset (&addr, 0, 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)
-@@ -100,6 +101,7 @@ svc_socket (u_long number, int type, int
- }
- }
- else
-+#endif
- {
- addr.sin_port = 0;
- if (bind (sock, (struct sockaddr *) &addr, len) < 0)
+Upstream-Status: Inappropriate [embedded specific]
+
+Index: nfs-utils-1.2.3/support/nfs/svc_socket.c
+===================================================================
+--- nfs-utils-1.2.3.orig/support/nfs/svc_socket.c
++++ nfs-utils-1.2.3/support/nfs/svc_socket.c
+@@ -67,6 +67,7 @@ svc_socket (u_long number, int type, int
+ memset (&addr, 0, 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)
+@@ -100,6 +101,7 @@ svc_socket (u_long number, int type, int
+ }
+ }
+ else
++#endif
+ {
+ addr.sin_port = 0;
+ if (bind (sock, (struct sockaddr *) &addr, len) < 0)
diff --git a/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-uclibc-libio.h.patch b/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-uclibc-libio.h.patch
index b42111e..465144a 100644
--- a/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-uclibc-libio.h.patch
+++ b/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-uclibc-libio.h.patch
@@ -1,26 +1,26 @@
-[PATCH] fix build with uClibc
-
-uClibc doesn't have/need libio.h, so don't include it from sockaddr.h
-
-Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
----
- support/include/sockaddr.h | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-Upstream-Status: Pending
-
-Index: nfs-utils-1.2.3/support/include/sockaddr.h
-===================================================================
---- nfs-utils-1.2.3.orig/support/include/sockaddr.h
-+++ nfs-utils-1.2.3/support/include/sockaddr.h
-@@ -20,7 +20,10 @@
- #ifndef NFS_UTILS_SOCKADDR_H
- #define NFS_UTILS_SOCKADDR_H
-
-+/* uClibc doesn't have/need libio.h */
-+#ifndef __UCLIBC__
- #include <libio.h>
-+#endif
- #include <stdbool.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
+[PATCH] fix build with uClibc
+
+uClibc doesn't have/need libio.h, so don't include it from sockaddr.h
+
+Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
+---
+ support/include/sockaddr.h | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+Upstream-Status: Pending
+
+Index: nfs-utils-1.2.3/support/include/sockaddr.h
+===================================================================
+--- nfs-utils-1.2.3.orig/support/include/sockaddr.h
++++ nfs-utils-1.2.3/support/include/sockaddr.h
+@@ -20,7 +20,10 @@
+ #ifndef NFS_UTILS_SOCKADDR_H
+ #define NFS_UTILS_SOCKADDR_H
+
++/* uClibc doesn't have/need libio.h */
++#ifndef __UCLIBC__
+ #include <libio.h>
++#endif
+ #include <stdbool.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
diff --git a/recipes-connectivity/nfs-utils/nfs-utils/nfsserver b/recipes-connectivity/nfs-utils/nfs-utils/nfsserver
new file mode 100644
index 0000000..69c8718
--- /dev/null
+++ b/recipes-connectivity/nfs-utils/nfs-utils/nfsserver
@@ -0,0 +1,161 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: nfs-kernel-server
+# Required-Start: $remote_fs $portmap hwclock
+# Required-Stop: $remote_fs $portmap hwclock
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Kernel NFS server support
+# Description: NFS is a popular protocol for file sharing across
+# TCP/IP networks. This service provides NFS server
+# functionality, which is configured via the
+# /etc/exports file.
+### END INIT INFO
+#
+# Startup script for nfs-utils
+#
+#
+# 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 executables:
+test -x "$NFS_MOUNTD" || NFS_MOUNTD=/usr/sbin/rpc.mountd
+test -x "$NFS_NFSD" || NFS_NFSD=/usr/sbin/rpc.nfsd
+test -x "$NFS_STATD" || NFS_STATD=/usr/sbin/rpc.statd
+#
+# 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" != "" && 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
+}
+
+#statd
+start_statd(){
+ echo -n "starting statd: "
+ start-stop-daemon --start --exec "$NFS_STATD"
+ echo done
+}
+stop_statd(){
+ # WARNING: this kills any process with the executable
+ # name 'statd'.
+ echo -n 'stopping statd: '
+ start-stop-daemon --stop --quiet --signal 1 --name statd
+ echo done
+}
+#----------------------------------------------------------------------
+#
+# 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
+ start_statd
+ test -r /etc/exports && exportfs -a;;
+stop) exportfs -ua
+ stop_statd
+ stop_mountd
+ stop_nfsd;;
+reload) test -r /etc/exports && exportfs -r;;
+restart)exportfs -ua
+ stop_mountd
+ stop_statd
+ # restart does not restart the kernel threads,
+ # only the user mode processes
+ start_mountd
+ start_statd
+ test -r /etc/exports && exportfs -a;;
+esac