diff options
author | Tudor Florea <tudor.florea@enea.com> | 2015-10-09 22:59:03 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2015-10-09 22:59:03 +0200 |
commit | 972dcfcdbfe75dcfeb777150c136576cf1a71e99 (patch) | |
tree | 97a61cd7e293d7ae9d56ef7ed0f81253365bb026 /meta/recipes-connectivity/nfs-utils/nfs-utils | |
download | poky-972dcfcdbfe75dcfeb777150c136576cf1a71e99.tar.gz |
initial commit for Enea Linux 5.0 arm
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta/recipes-connectivity/nfs-utils/nfs-utils')
11 files changed, 457 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure-Allow-to-explicitly-disable-nfsidmap.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure-Allow-to-explicitly-disable-nfsidmap.patch new file mode 100644 index 0000000000..7025fb555c --- /dev/null +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure-Allow-to-explicitly-disable-nfsidmap.patch | |||
@@ -0,0 +1,43 @@ | |||
1 | From 9b84cff305866abd150cf1a4c6e7e5ebf8a7eb3a Mon Sep 17 00:00:00 2001 | ||
2 | From: Martin Jansa <Martin.Jansa@gmail.com> | ||
3 | Date: Fri, 15 Nov 2013 23:21:35 +0100 | ||
4 | Subject: [PATCH] configure: Allow to explicitly disable nfsidmap | ||
5 | |||
6 | * keyutils availability is autodetected and builds aren't reproducible | ||
7 | |||
8 | Upstream-Status: Pending | ||
9 | |||
10 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
11 | --- | ||
12 | configure.ac | 10 +++++++++- | ||
13 | 1 file changed, 9 insertions(+), 1 deletion(-) | ||
14 | |||
15 | diff --git a/configure.ac b/configure.ac | ||
16 | index bf433d6..28a8f62 100644 | ||
17 | --- a/configure.ac | ||
18 | +++ b/configure.ac | ||
19 | @@ -69,6 +69,12 @@ AC_ARG_ENABLE(nfsv4, | ||
20 | AC_SUBST(enable_nfsv4) | ||
21 | AM_CONDITIONAL(CONFIG_NFSV4, [test "$enable_nfsv4" = "yes"]) | ||
22 | |||
23 | +AC_ARG_ENABLE(nfsidmap, | ||
24 | + [AC_HELP_STRING([--enable-nfsidmap], | ||
25 | + [enable support for NFSv4 idmapper @<:@default=yes@:>@])], | ||
26 | + enable_nfsidmap=$enableval, | ||
27 | + enable_nfsidmap=yes) | ||
28 | + | ||
29 | AC_ARG_ENABLE(nfsv41, | ||
30 | [AC_HELP_STRING([--enable-nfsv41], | ||
31 | [enable support for NFSv41 @<:@default=yes@:>@])], | ||
32 | @@ -296,7 +302,7 @@ fi | ||
33 | |||
34 | dnl enable nfsidmap when its support by libnfsidmap | ||
35 | AM_CONDITIONAL(CONFIG_NFSDCLTRACK, [test "$enable_nfsdcltrack" = "yes" ]) | ||
36 | -AM_CONDITIONAL(CONFIG_NFSIDMAP, [test "$ac_cv_header_keyutils_h$ac_cv_lib_nfsidmap_nfs4_owner_to_uid" = "yesyes"]) | ||
37 | +AM_CONDITIONAL(CONFIG_NFSIDMAP, [test "$enable_nfsidmap$ac_cv_header_keyutils_h$ac_cv_lib_nfsidmap_nfs4_owner_to_uid" = "yesyesyes"]) | ||
38 | |||
39 | |||
40 | if test "$knfsd_cv_glibc2" = no; then | ||
41 | -- | ||
42 | 1.8.4.3 | ||
43 | |||
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-statd-fixed-the-with-statdpath-flag.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-statd-fixed-the-with-statdpath-flag.patch new file mode 100644 index 0000000000..2ce824cf9e --- /dev/null +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-statd-fixed-the-with-statdpath-flag.patch | |||
@@ -0,0 +1,41 @@ | |||
1 | From 3b1457d219ceb1058d44bacc657581f13437ae40 Mon Sep 17 00:00:00 2001 | ||
2 | From: Steve Dickson <steved@redhat.com> | ||
3 | Date: Tue, 17 Jun 2014 13:28:53 -0400 | ||
4 | Subject: [PATCH] statd: fixed the --with-statdpath= flag | ||
5 | |||
6 | Create the given path set with --with-statdpath | ||
7 | |||
8 | Signed-off-by: chendt.fnst@cn.fujitsu.com | ||
9 | Reported-by: yaoxp@cn.fujitsu.com | ||
10 | Signed-off-by: Steve Dickson <steved@redhat.com> | ||
11 | Upstream-Status: Backport | ||
12 | --- | ||
13 | Makefile.am | 10 +++++----- | ||
14 | 1 file changed, 5 insertions(+), 5 deletions(-) | ||
15 | |||
16 | diff --git a/Makefile.am b/Makefile.am | ||
17 | index ae7cd16..5824adc 100644 | ||
18 | --- a/Makefile.am | ||
19 | +++ b/Makefile.am | ||
20 | @@ -54,13 +54,13 @@ install-data-hook: | ||
21 | touch $(DESTDIR)$(statedir)/xtab; chmod 644 $(DESTDIR)$(statedir)/xtab | ||
22 | touch $(DESTDIR)$(statedir)/etab; chmod 644 $(DESTDIR)$(statedir)/etab | ||
23 | touch $(DESTDIR)$(statedir)/rmtab; chmod 644 $(DESTDIR)$(statedir)/rmtab | ||
24 | - mkdir -p $(DESTDIR)$(statedir)/sm $(DESTDIR)$(statedir)/sm.bak | ||
25 | - touch $(DESTDIR)$(statedir)/state | ||
26 | - chmod go-rwx $(DESTDIR)$(statedir)/sm $(DESTDIR)$(statedir)/sm.bak $(DESTDIR)$(statedir)/state | ||
27 | - -chown $(statduser) $(DESTDIR)$(statedir)/sm $(DESTDIR)$(statedir)/sm.bak $(DESTDIR)$(statedir)/state | ||
28 | + mkdir -p $(DESTDIR)$(statdpath)/sm $(DESTDIR)$(statdpath)/sm.bak | ||
29 | + touch $(DESTDIR)$(statdpath)/state | ||
30 | + chmod go-rwx $(DESTDIR)$(statdpath)/sm $(DESTDIR)$(statdpath)/sm.bak $(DESTDIR)$(statdpath)/state | ||
31 | + -chown $(statduser) $(DESTDIR)$(statdpath)/sm $(DESTDIR)$(statdpath)/sm.bak $(DESTDIR)$(statdpath)/state | ||
32 | |||
33 | uninstall-hook: | ||
34 | rm $(DESTDIR)$(statedir)/xtab | ||
35 | rm $(DESTDIR)$(statedir)/etab | ||
36 | rm $(DESTDIR)$(statedir)/rmtab | ||
37 | - rm $(DESTDIR)$(statedir)/state | ||
38 | + rm $(DESTDIR)$(statdpath)/state | ||
39 | -- | ||
40 | 1.8.4.2 | ||
41 | |||
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service new file mode 100644 index 0000000000..613ddc003a --- /dev/null +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service | |||
@@ -0,0 +1,11 @@ | |||
1 | [Unit] | ||
2 | Description=NFS Mount Daemon | ||
3 | After=rpcbind.service nfs-server.service | ||
4 | Requires=rpcbind.service nfs-server.service | ||
5 | |||
6 | [Service] | ||
7 | EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf | ||
8 | ExecStart=@SBINDIR@/rpc.mountd -F $MOUNTD_OPTS | ||
9 | |||
10 | [Install] | ||
11 | WantedBy=multi-user.target | ||
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-server.service b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-server.service new file mode 100644 index 0000000000..147d7a7b5f --- /dev/null +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-server.service | |||
@@ -0,0 +1,18 @@ | |||
1 | [Unit] | ||
2 | Description=NFS Server | ||
3 | Requires=rpcbind.service nfs-mountd.service | ||
4 | After=rpcbind.service | ||
5 | |||
6 | [Service] | ||
7 | Type=oneshot | ||
8 | EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf | ||
9 | ExecStartPre=@SBINDIR@/exportfs -r | ||
10 | ExecStart=@SBINDIR@/rpc.nfsd $NFSD_OPTS $NFSD_COUNT | ||
11 | ExecStop=@SBINDIR@/rpc.nfsd 0 | ||
12 | ExecStopPost=@SBINDIR@/exportfs -f | ||
13 | ExecReload=@SBINDIR@/exportfs -r | ||
14 | StandardError=syslog | ||
15 | RemainAfterExit=yes | ||
16 | |||
17 | [Install] | ||
18 | WantedBy=multi-user.target | ||
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service new file mode 100644 index 0000000000..746dacf056 --- /dev/null +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service | |||
@@ -0,0 +1,12 @@ | |||
1 | [Unit] | ||
2 | Description=NFS file locking service | ||
3 | After=rpcbind.service | ||
4 | Requires=rpcbind.service | ||
5 | Before=remote-fs-pre.target | ||
6 | |||
7 | [Service] | ||
8 | EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf | ||
9 | ExecStart=@SBINDIR@/rpc.statd -F $STATD_OPTS | ||
10 | |||
11 | [Install] | ||
12 | WantedBy=multi-user.target | ||
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.0.6-uclibc.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.0.6-uclibc.patch new file mode 100644 index 0000000000..c3442380e1 --- /dev/null +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.0.6-uclibc.patch | |||
@@ -0,0 +1,27 @@ | |||
1 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
2 | |||
3 | Upstream-Status: Inappropriate [embedded specific] | ||
4 | |||
5 | Index: nfs-utils-1.2.6/support/nfs/svc_socket.c | ||
6 | =================================================================== | ||
7 | --- nfs-utils-1.2.6.orig/support/nfs/svc_socket.c 2012-05-14 07:40:52.000000000 -0700 | ||
8 | +++ nfs-utils-1.2.6/support/nfs/svc_socket.c 2012-10-28 02:42:50.179222457 -0700 | ||
9 | @@ -40,8 +40,9 @@ | ||
10 | char rpcdata[1024], servdata[1024]; | ||
11 | struct rpcent rpcbuf, *rpcp; | ||
12 | struct servent servbuf, *servp = NULL; | ||
13 | - int ret; | ||
14 | + int ret = 0; | ||
15 | |||
16 | +#ifndef __UCLIBC__ /* neither getrpcbynumber() nor getrpcbynumber_r() is SuSv3 */ | ||
17 | ret = getrpcbynumber_r(number, &rpcbuf, rpcdata, sizeof rpcdata, | ||
18 | &rpcp); | ||
19 | if (ret == 0 && rpcp != NULL) { | ||
20 | @@ -60,6 +61,7 @@ | ||
21 | } | ||
22 | } | ||
23 | } | ||
24 | +#endif /* __UCLIBC__ */ | ||
25 | |||
26 | if (ret == 0 && servp != NULL) | ||
27 | return ntohs(servp->s_port); | ||
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-sm-notify-res_init.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-sm-notify-res_init.patch new file mode 100644 index 0000000000..d8f8181670 --- /dev/null +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-sm-notify-res_init.patch | |||
@@ -0,0 +1,36 @@ | |||
1 | Fixes errors like | ||
2 | sm-notify[1070]: DNS resolution of a.b.c.d..com failed; retrying later | ||
3 | This error will occur anytime sm-notify is run before the network if fully up, | ||
4 | which is happening more and more with parallel startup systems. | ||
5 | The res_init() call is simple, safe, quick, and a patch to use it should be | ||
6 | able to go upstream. Presumably the whole reason sm-notify tries several | ||
7 | times is to wait for possible changes to the network configuration, but without | ||
8 | calling res_init() it will never be aware of those changes | ||
9 | |||
10 | Backported drom Fedora | ||
11 | |||
12 | Upstream-Status: Pending | ||
13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
14 | |||
15 | |||
16 | diff -up nfs-utils-1.2.3/utils/statd/sm-notify.c.orig nfs-utils-1.2.3/utils/statd/sm-notify.c | ||
17 | --- nfs-utils-1.2.3/utils/statd/sm-notify.c.orig 2010-09-28 08:24:16.000000000 -0400 | ||
18 | +++ nfs-utils-1.2.3/utils/statd/sm-notify.c 2010-10-15 16:44:43.487119601 -0400 | ||
19 | @@ -28,6 +28,9 @@ | ||
20 | #include <netdb.h> | ||
21 | #include <errno.h> | ||
22 | #include <grp.h> | ||
23 | +#include <netinet/in.h> | ||
24 | +#include <arpa/nameser.h> | ||
25 | +#include <resolv.h> | ||
26 | |||
27 | #include "sockaddr.h" | ||
28 | #include "xlog.h" | ||
29 | @@ -84,6 +87,7 @@ smn_lookup(const char *name) | ||
30 | }; | ||
31 | int error; | ||
32 | |||
33 | + res_init(); | ||
34 | error = getaddrinfo(name, NULL, &hint, &ai); | ||
35 | if (error != 0) { | ||
36 | xlog(D_GENERAL, "getaddrinfo(3): %s", gai_strerror(error)); | ||
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-Do-not-pass-CFLAGS-to-gcc-while-building.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-Do-not-pass-CFLAGS-to-gcc-while-building.patch new file mode 100644 index 0000000000..993f1e5ea5 --- /dev/null +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-Do-not-pass-CFLAGS-to-gcc-while-building.patch | |||
@@ -0,0 +1,42 @@ | |||
1 | nfs-utils: Do not pass CFLAGS to gcc while building | ||
2 | |||
3 | Do not pass CFLAGS/LDFLAGS to gcc while building, The needed flags has | ||
4 | been passed by xxx_CFLAGS=$(CFLAGS_FOR_BUILD). | ||
5 | |||
6 | Upstream-Status: Pending | ||
7 | |||
8 | Signed-off-by: Chong Lu <Chong.Lu@windriver.com> | ||
9 | --- | ||
10 | tools/locktest/Makefile.am | 2 ++ | ||
11 | tools/rpcgen/Makefile.am | 2 ++ | ||
12 | 2 files changed, 4 insertions(+) | ||
13 | |||
14 | diff --git a/tools/locktest/Makefile.am b/tools/locktest/Makefile.am | ||
15 | index 3156815..1729fd1 100644 | ||
16 | --- a/tools/locktest/Makefile.am | ||
17 | +++ b/tools/locktest/Makefile.am | ||
18 | @@ -1,6 +1,8 @@ | ||
19 | ## Process this file with automake to produce Makefile.in | ||
20 | |||
21 | CC=$(CC_FOR_BUILD) | ||
22 | +CFLAGS= | ||
23 | +LDFLAGS= | ||
24 | LIBTOOL = @LIBTOOL@ --tag=CC | ||
25 | |||
26 | noinst_PROGRAMS = testlk | ||
27 | diff --git a/tools/rpcgen/Makefile.am b/tools/rpcgen/Makefile.am | ||
28 | index 8a9ec89..8bacdaa 100644 | ||
29 | --- a/tools/rpcgen/Makefile.am | ||
30 | +++ b/tools/rpcgen/Makefile.am | ||
31 | @@ -1,6 +1,8 @@ | ||
32 | ## Process this file with automake to produce Makefile.in | ||
33 | |||
34 | CC=$(CC_FOR_BUILD) | ||
35 | +CFLAGS= | ||
36 | +LDFLAGS= | ||
37 | LIBTOOL = @LIBTOOL@ --tag=CC | ||
38 | |||
39 | noinst_PROGRAMS = rpcgen | ||
40 | -- | ||
41 | 1.7.9.5 | ||
42 | |||
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.conf b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.conf new file mode 100644 index 0000000000..a1007a7fbf --- /dev/null +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.conf | |||
@@ -0,0 +1,35 @@ | |||
1 | # Parameters to be passed to nfs-utils (clients & server) service files. | ||
2 | # | ||
3 | |||
4 | # Options to pass to rpc.nfsd. | ||
5 | NFSD_OPTS="" | ||
6 | |||
7 | # Number of servers to start up; the default is 8 servers. | ||
8 | NFSD_COUNT="" | ||
9 | |||
10 | # Where to mount nfsd filesystem; the default is "/proc/fs/nfsd". | ||
11 | PROCNFSD_MOUNTPOINT="" | ||
12 | |||
13 | # Options used to mount nfsd filesystem; the default is "rw,nodev,noexec,nosuid". | ||
14 | PROCNFSD_MOUNTOPTS="" | ||
15 | |||
16 | # Options for rpc.mountd. | ||
17 | # If you have a port-based firewall, you might want to set up | ||
18 | # a fixed port here using the --port option. | ||
19 | MOUNTD_OPTS="" | ||
20 | |||
21 | # Parameters to be passed to nfs-common (nfs clients & server) init script. | ||
22 | # | ||
23 | |||
24 | # If you do not set values for the NEED_ options, they will be attempted | ||
25 | # autodetected; this should be sufficient for most people. Valid alternatives | ||
26 | # for the NEED_ options are "yes" and "no". | ||
27 | |||
28 | # Do you want to start the statd daemon? It is not needed for NFSv4. | ||
29 | NEED_STATD="" | ||
30 | |||
31 | # Options to pass to rpc.statd. | ||
32 | # N.B. statd normally runs on both client and server, and run-time | ||
33 | # options should be specified accordingly. | ||
34 | # STATD_OPTS="-p 32765 -o 32766" | ||
35 | STATD_OPTS="" | ||
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..992267d5a1 --- /dev/null +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon | |||
@@ -0,0 +1,63 @@ | |||
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 | |||
22 | test -x "$NFS_STATD" || NFS_STATD=/usr/sbin/rpc.statd | ||
23 | test -z "$STATD_PID" && STATD_PID=/var/run/rpc.statd.pid | ||
24 | # | ||
25 | # The default state directory is /var/lib/nfs | ||
26 | test -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 | |||
32 | start_statd(){ | ||
33 | echo -n "starting statd: " | ||
34 | start-stop-daemon --start --exec "$NFS_STATD" --pidfile "$STATD_PID" | ||
35 | echo done | ||
36 | } | ||
37 | stop_statd(){ | ||
38 | echo -n 'stopping statd: ' | ||
39 | start-stop-daemon --stop --quiet --signal 1 --pidfile "$STATD_PID" | ||
40 | echo done | ||
41 | } | ||
42 | #---------------------------------------------------------------------- | ||
43 | # | ||
44 | # supported options: | ||
45 | # start | ||
46 | # stop | ||
47 | # restart: stops and starts mountd | ||
48 | #FIXME: need to create the /var/lib/nfs/... directories | ||
49 | case "$1" in | ||
50 | start) | ||
51 | start_statd;; | ||
52 | stop) | ||
53 | stop_statd;; | ||
54 | status) | ||
55 | status $NFS_STATD | ||
56 | exit $?;; | ||
57 | restart) | ||
58 | $0 stop | ||
59 | $0 start;; | ||
60 | *) | ||
61 | echo "Usage: $0 {start|stop|status|restart}" | ||
62 | exit 1;; | ||
63 | esac | ||
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver new file mode 100644 index 0000000000..6e0df7e2ea --- /dev/null +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver | |||
@@ -0,0 +1,129 @@ | |||
1 | #!/bin/sh | ||
2 | ### BEGIN INIT INFO | ||
3 | # Provides: nfs-kernel-server | ||
4 | # Required-Start: $remote_fs nfs-common $portmap hwclock | ||
5 | # Required-Stop: $remote_fs nfs-common $portmap hwclock | ||
6 | # Default-Start: 2 3 4 5 | ||
7 | # Default-Stop: 0 1 6 | ||
8 | # Short-Description: Kernel NFS server support | ||
9 | # Description: NFS is a popular protocol for file sharing across | ||
10 | # TCP/IP networks. This service provides NFS server | ||
11 | # functionality, which is configured via the | ||
12 | # /etc/exports file. | ||
13 | ### END INIT INFO | ||
14 | # | ||
15 | # Startup script for nfs-utils | ||
16 | # | ||
17 | # Source function library. | ||
18 | . /etc/init.d/functions | ||
19 | # | ||
20 | # The environment variable NFS_SERVERS may be set in /etc/default/nfsd | ||
21 | # Other control variables may be overridden here too | ||
22 | test -r /etc/default/nfsd && . /etc/default/nfsd | ||
23 | # | ||
24 | # Location of executables: | ||
25 | test -x "$NFS_MOUNTD" || NFS_MOUNTD=/usr/sbin/rpc.mountd | ||
26 | test -x "$NFS_NFSD" || NFS_NFSD=/usr/sbin/rpc.nfsd | ||
27 | # | ||
28 | # The user mode program must also exist (it just starts the kernel | ||
29 | # threads using the kernel module code). | ||
30 | test -x "$NFS_MOUNTD" || exit 0 | ||
31 | test -x "$NFS_NFSD" || exit 0 | ||
32 | # | ||
33 | # Default is 8 threads, value is settable between 1 and the truely | ||
34 | # ridiculous 99 | ||
35 | test "$NFS_SERVERS" != "" && test "$NFS_SERVERS" -gt 0 && test "$NFS_SERVERS" -lt 100 || NFS_SERVERS=8 | ||
36 | # | ||
37 | #---------------------------------------------------------------------- | ||
38 | # Startup and shutdown functions. | ||
39 | # Actual startup/shutdown is at the end of this file. | ||
40 | #mountd | ||
41 | start_mountd(){ | ||
42 | echo -n 'starting mountd: ' | ||
43 | start-stop-daemon --start --exec "$NFS_MOUNTD" -- "-f /etc/exports $@" | ||
44 | echo done | ||
45 | } | ||
46 | stop_mountd(){ | ||
47 | echo -n 'stopping mountd: ' | ||
48 | start-stop-daemon --stop --quiet --exec "$NFS_MOUNTD" | ||
49 | echo done | ||
50 | } | ||
51 | # | ||
52 | #nfsd | ||
53 | start_nfsd(){ | ||
54 | modprobe -q nfsd | ||
55 | grep -q nfsd /proc/filesystems || { | ||
56 | echo NFS daemon support not enabled in kernel | ||
57 | exit 1 | ||
58 | } | ||
59 | grep -q nfsd /proc/mounts || mount -t nfsd nfsd /proc/fs/nfsd | ||
60 | grep -q nfsd /proc/mounts || { | ||
61 | echo nfsd filesystem could not be mounted at /proc/fs/nfsd | ||
62 | exit 1 | ||
63 | } | ||
64 | |||
65 | echo -n "starting $1 nfsd kernel threads: " | ||
66 | start-stop-daemon --start --exec "$NFS_NFSD" -- "$@" | ||
67 | echo done | ||
68 | } | ||
69 | delay_nfsd(){ | ||
70 | for delay in 0 1 2 3 4 5 6 7 8 9 | ||
71 | do | ||
72 | if pidof nfsd >/dev/null | ||
73 | then | ||
74 | echo -n . | ||
75 | sleep 1 | ||
76 | else | ||
77 | return 0 | ||
78 | fi | ||
79 | done | ||
80 | return 1 | ||
81 | } | ||
82 | stop_nfsd(){ | ||
83 | # WARNING: this kills any process with the executable | ||
84 | # name 'nfsd'. | ||
85 | echo -n 'stopping nfsd: ' | ||
86 | start-stop-daemon --stop --quiet --signal 1 --name nfsd | ||
87 | if delay_nfsd || { | ||
88 | echo failed | ||
89 | echo ' using signal 9: ' | ||
90 | start-stop-daemon --stop --quiet --signal 9 --name nfsd | ||
91 | delay_nfsd | ||
92 | } | ||
93 | then | ||
94 | echo done | ||
95 | else | ||
96 | echo failed | ||
97 | fi | ||
98 | } | ||
99 | |||
100 | #---------------------------------------------------------------------- | ||
101 | # | ||
102 | # supported options: | ||
103 | # start | ||
104 | # stop | ||
105 | # reload: reloads the exports file | ||
106 | # restart: stops and starts mountd | ||
107 | #FIXME: need to create the /var/lib/nfs/... directories | ||
108 | case "$1" in | ||
109 | start) | ||
110 | start_nfsd "$NFS_SERVERS" | ||
111 | start_mountd | ||
112 | test -r /etc/exports && exportfs -a;; | ||
113 | stop) exportfs -ua | ||
114 | stop_mountd | ||
115 | stop_nfsd;; | ||
116 | status) | ||
117 | status /usr/sbin/rpc.mountd | ||
118 | RETVAL=$? | ||
119 | status nfsd | ||
120 | rval=$? | ||
121 | [ $RETVAL -eq 0 ] && exit $rval | ||
122 | exit $RETVAL;; | ||
123 | reload) test -r /etc/exports && exportfs -r;; | ||
124 | restart) | ||
125 | $0 stop | ||
126 | $0 start;; | ||
127 | *) echo "Usage: $0 {start|stop|status|reload|restart}" | ||
128 | exit 1;; | ||
129 | esac | ||