summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/nfs-utils
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/nfs-utils')
-rw-r--r--meta/recipes-connectivity/nfs-utils/files/Set_nobody_user_group.patch18
-rw-r--r--meta/recipes-connectivity/nfs-utils/files/fix-ac-prereq.patch13
-rw-r--r--meta/recipes-connectivity/nfs-utils/libnfsidmap_0.25.bb26
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service11
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-server.service18
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service12
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.0.6-uclibc.patch27
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-sm-notify-res_init.patch36
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.conf35
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver164
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.8.bb92
11 files changed, 452 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/nfs-utils/files/Set_nobody_user_group.patch b/meta/recipes-connectivity/nfs-utils/files/Set_nobody_user_group.patch
new file mode 100644
index 0000000000..4633da919e
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/files/Set_nobody_user_group.patch
@@ -0,0 +1,18 @@
1Set nobody user and group
2
3Upstream-Status: Inappropriate [configuration]
4
5Signed-off-by: Roy.Li <rongqing.li@windriver.com>
6--- a/idmapd.conf
7+++ b/idmapd.conf
8@@ -17,8 +17,8 @@
9
10 [Mapping]
11
12-#Nobody-User = nobody
13-#Nobody-Group = nobody
14+Nobody-User = nobody
15+Nobody-Group = nogroup
16
17 [Translation]
18
diff --git a/meta/recipes-connectivity/nfs-utils/files/fix-ac-prereq.patch b/meta/recipes-connectivity/nfs-utils/files/fix-ac-prereq.patch
new file mode 100644
index 0000000000..d81c7c5f32
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/files/fix-ac-prereq.patch
@@ -0,0 +1,13 @@
1Upstream-Status: Inappropriate [configuration]
2
3--- a/configure.in
4+++ b/configure.in
5@@ -1,7 +1,7 @@
6 # -*- Autoconf -*-
7 # Process this file with autoconf to produce a configure script.
8
9-AC_PREREQ([2.68])
10+AC_PREREQ([2.65])
11 AC_INIT([libnfsidmap],[0.25],[linux-nfs@vger.kernel.org])
12 AC_CONFIG_SRCDIR([nfsidmap.h])
13 AC_CONFIG_MACRO_DIR([m4])
diff --git a/meta/recipes-connectivity/nfs-utils/libnfsidmap_0.25.bb b/meta/recipes-connectivity/nfs-utils/libnfsidmap_0.25.bb
new file mode 100644
index 0000000000..77c4a001e8
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/libnfsidmap_0.25.bb
@@ -0,0 +1,26 @@
1SUMMARY = "NFS id mapping library"
2DESCRIPTION = "NFS id mapping library"
3HOMEPAGE = "http://www.citi.umich.edu/projects/nfsv4/linux/"
4SECTION = "libs"
5
6LICENSE = "BSD"
7LIC_FILES_CHKSUM = "file://COPYING;md5=d9c6a2a0ca6017fda7cd905ed2739b37"
8PR = "r0"
9
10SRC_URI = "http://www.citi.umich.edu/projects/nfsv4/linux/libnfsidmap/${BPN}-${PV}.tar.gz \
11 file://fix-ac-prereq.patch \
12 file://Set_nobody_user_group.patch \
13 "
14
15SRC_URI[md5sum] = "2ac4893c92716add1a1447ae01df77ab"
16SRC_URI[sha256sum] = "656d245d84400e1030f8f40a5a27da76370690c4a932baf249110f047fe7efcf"
17
18inherit autotools
19
20EXTRA_OECONF = "--disable-ldap"
21
22do_install_append () {
23 install -d ${D}${sysconfdir}/
24 install -m 0644 ${WORKDIR}/${BPN}-${PV}/idmapd.conf ${D}${sysconfdir}/idmapd.conf
25}
26
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]
2Description=NFS Mount Daemon
3After=rpcbind.service nfs-server.service
4Requires=rpcbind.service nfs-server.service
5
6[Service]
7EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf
8ExecStart=@SBINDIR@/rpc.mountd -F $MOUNTD_OPTS
9
10[Install]
11WantedBy=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]
2Description=NFS Server
3Requires=rpcbind.service nfs-mountd.service
4After=rpcbind.service
5
6[Service]
7Type=oneshot
8EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf
9ExecStartPre=@SBINDIR@/exportfs -r
10ExecStart=@SBINDIR@/rpc.nfsd $NFSD_OPTS $NFSD_COUNT
11ExecStop=@SBINDIR@/rpc.nfsd 0
12ExecStopPost=@SBINDIR@/exportfs -f
13ExecReload=@SBINDIR@/exportfs -r
14StandardError=syslog
15RemainAfterExit=yes
16
17[Install]
18WantedBy=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]
2Description=NFS file locking service
3After=rpcbind.service
4Requires=rpcbind.service
5Before=remote-fs-pre.target
6
7[Service]
8EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf
9ExecStart=@SBINDIR@/rpc.statd -F $STATD_OPTS
10
11[Install]
12WantedBy=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 @@
1Signed-off-by: Khem Raj <raj.khem@gmail.com>
2
3Upstream-Status: Inappropriate [embedded specific]
4
5Index: 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 @@
1Fixes errors like
2sm-notify[1070]: DNS resolution of a.b.c.d..com failed; retrying later
3This error will occur anytime sm-notify is run before the network if fully up,
4which is happening more and more with parallel startup systems.
5The res_init() call is simple, safe, quick, and a patch to use it should be
6able to go upstream. Presumably the whole reason sm-notify tries several
7times is to wait for possible changes to the network configuration, but without
8calling res_init() it will never be aware of those changes
9
10Backported drom Fedora
11
12Upstream-Status: Pending
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14
15
16diff -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.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.
5NFSD_OPTS=""
6
7# Number of servers to start up; the default is 8 servers.
8NFSD_COUNT=""
9
10# Where to mount nfsd filesystem; the default is "/proc/fs/nfsd".
11PROCNFSD_MOUNTPOINT=""
12
13# Options used to mount nfsd filesystem; the default is "rw,nodev,noexec,nosuid".
14PROCNFSD_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.
19MOUNTD_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.
29NEED_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"
35STATD_OPTS=""
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..1ac6fec023
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver
@@ -0,0 +1,164 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: nfs-kernel-server
4# Required-Start: $remote_fs $portmap hwclock
5# Required-Stop: $remote_fs $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
22test -r /etc/default/nfsd && . /etc/default/nfsd
23#
24# Location of executables:
25test -x "$NFS_MOUNTD" || NFS_MOUNTD=/usr/sbin/rpc.mountd
26test -x "$NFS_NFSD" || NFS_NFSD=/usr/sbin/rpc.nfsd
27test -x "$NFS_STATD" || NFS_STATD=/usr/sbin/rpc.statd
28#
29# The user mode program must also exist (it just starts the kernel
30# threads using the kernel module code).
31test -x "$NFS_MOUNTD" || exit 0
32test -x "$NFS_NFSD" || exit 0
33#
34# Default is 8 threads, value is settable between 1 and the truely
35# ridiculous 99
36test "$NFS_SERVERS" != "" && test "$NFS_SERVERS" -gt 0 && test "$NFS_SERVERS" -lt 100 || NFS_SERVERS=8
37#
38# The default state directory is /var/lib/nfs
39test -n "$NFS_STATEDIR" || NFS_STATEDIR=/var/lib/nfs
40#
41#----------------------------------------------------------------------
42# Startup and shutdown functions.
43# Actual startup/shutdown is at the end of this file.
44#directories
45create_directories(){
46 echo -n 'creating NFS state directory: '
47 mkdir -p "$NFS_STATEDIR"
48 ( cd "$NFS_STATEDIR"
49 umask 077
50 mkdir -p sm sm.bak
51 test -w sm/state || {
52 rm -f sm/state
53 :>sm/state
54 }
55 umask 022
56 for file in xtab etab smtab rmtab
57 do
58 test -w "$file" || {
59 rm -f "$file"
60 :>"$file"
61 }
62 done
63 )
64 echo done
65}
66#mountd
67start_mountd(){
68 echo -n 'starting mountd: '
69 start-stop-daemon --start --exec "$NFS_MOUNTD" -- "-f /etc/exports $@"
70 echo done
71}
72stop_mountd(){
73 echo -n 'stopping mountd: '
74 start-stop-daemon --stop --quiet --exec "$NFS_MOUNTD"
75 echo done
76}
77#
78#nfsd
79start_nfsd(){
80 echo -n "starting $1 nfsd kernel threads: "
81 start-stop-daemon --start --exec "$NFS_NFSD" -- "$@"
82 echo done
83}
84delay_nfsd(){
85 for delay in 0 1 2 3 4 5 6 7 8 9
86 do
87 if pidof nfsd >/dev/null
88 then
89 echo -n .
90 sleep 1
91 else
92 return 0
93 fi
94 done
95 return 1
96}
97stop_nfsd(){
98 # WARNING: this kills any process with the executable
99 # name 'nfsd'.
100 echo -n 'stopping nfsd: '
101 start-stop-daemon --stop --quiet --signal 1 --name nfsd
102 if delay_nfsd || {
103 echo failed
104 echo ' using signal 9: '
105 start-stop-daemon --stop --quiet --signal 9 --name nfsd
106 delay_nfsd
107 }
108 then
109 echo done
110 else
111 echo failed
112 fi
113}
114
115#statd
116start_statd(){
117 echo -n "starting statd: "
118 start-stop-daemon --start --exec "$NFS_STATD"
119 echo done
120}
121stop_statd(){
122 # WARNING: this kills any process with the executable
123 # name 'statd'.
124 echo -n 'stopping statd: '
125 start-stop-daemon --stop --quiet --signal 1 --name statd
126 echo done
127}
128#----------------------------------------------------------------------
129#
130# supported options:
131# start
132# stop
133# reload: reloads the exports file
134# restart: stops and starts mountd
135#FIXME: need to create the /var/lib/nfs/... directories
136case "$1" in
137start) create_directories
138 start_nfsd "$NFS_SERVERS"
139 start_mountd
140 start_statd
141 test -r /etc/exports && exportfs -a;;
142stop) exportfs -ua
143 stop_statd
144 stop_mountd
145 stop_nfsd;;
146status)
147 status /usr/sbin/rpc.mountd
148 RETVAL=$?
149 status nfsd
150 rval=$?
151 [ $RETVAL -eq 0 ] && exit $rval
152 exit $RETVAL;;
153reload) test -r /etc/exports && exportfs -r;;
154restart)exportfs -ua
155 stop_mountd
156 stop_statd
157 # restart does not restart the kernel threads,
158 # only the user mode processes
159 start_mountd
160 start_statd
161 test -r /etc/exports && exportfs -a;;
162*) echo "Usage: $0 {start|stop|status|reload|restart}"
163 exit 1;;
164esac
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.8.bb b/meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.8.bb
new file mode 100644
index 0000000000..e3e8136c27
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.8.bb
@@ -0,0 +1,92 @@
1SUMMARY = "userspace utilities for kernel nfs"
2DESCRIPTION = "The nfs-utils package provides a daemon for the kernel \
3NFS server and related tools."
4HOMEPAGE = "http://nfs.sourceforge.net/"
5SECTION = "console/network"
6
7LICENSE = "MIT & GPLv2+ & BSD"
8LIC_FILES_CHKSUM = "file://COPYING;md5=95f3a93a5c3c7888de623b46ea085a84"
9
10# util-linux for libblkid
11DEPENDS = "libcap libnfsidmap libevent util-linux sqlite3"
12RDEPENDS_${PN} = "rpcbind"
13RRECOMMENDS_${PN} = "kernel-module-nfsd"
14
15SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.bz2 \
16 file://nfs-utils-1.0.6-uclibc.patch \
17 file://nfs-utils-1.2.3-sm-notify-res_init.patch \
18 file://nfsserver \
19 file://nfs-utils.conf \
20 file://nfs-server.service \
21 file://nfs-mountd.service \
22 file://nfs-statd.service "
23
24SRC_URI[md5sum] = "6e7d97de51e428a0b8698c16ca23db77"
25SRC_URI[sha256sum] = "1cc8f02a633eddbf0a1d93421f331479c4cdab4c5ab33b8bf8c7c369f9156ac6"
26
27PARALLEL_MAKE = ""
28
29# Only kernel-module-nfsd is required here (but can be built-in) - the nfsd module will
30# pull in the remainder of the dependencies.
31
32INITSCRIPT_NAME = "nfsserver"
33# The server has no dependencies at the user run levels, so just put
34# it in at the default levels. It must be terminated before the network
35# in the shutdown levels, but that works fine.
36INITSCRIPT_PARAMS = "defaults"
37
38inherit autotools update-rc.d systemd
39
40SYSTEMD_SERVICE_${PN} = "nfs-server.service nfs-mountd.service nfs-statd.service"
41SYSTEMD_AUTO_ENABLE = "disable"
42
43# --enable-uuid is need for cross-compiling
44EXTRA_OECONF = "--with-statduser=nobody \
45 --enable-mountconfig \
46 --enable-libmount-mount \
47 --disable-nfsv41 \
48 --enable-uuid \
49 --disable-gss \
50 --disable-tirpc \
51 --disable-nfsdcltrack \
52 --with-statdpath=/var/lib/nfs/statd \
53 "
54
55PACKAGECONFIG ??= "tcp-wrappers"
56PACKAGECONFIG[tcp-wrappers] = "--with-tcp-wrappers,--without-tcp-wrappers,tcp-wrappers"
57
58INHIBIT_AUTO_STAGE = "1"
59
60PACKAGES =+ "${PN}-client ${PN}-stats"
61FILES_${PN}-client = "${base_sbindir}/*mount.nfs*"
62FILES_${PN}-stats = "${sbindir}/mountstats ${sbindir}/nfsiostat"
63RDEPENDS_${PN}-stats = "python"
64
65# Make clean needed because the package comes with
66# precompiled 64-bit objects that break the build
67do_compile_prepend() {
68 make clean
69}
70
71do_install_append () {
72 install -d ${D}${sysconfdir}/init.d
73 install -d ${D}${localstatedir}/lib/nfs/statd
74 install -m 0755 ${WORKDIR}/nfsserver ${D}${sysconfdir}/init.d/nfsserver
75
76 install -m 0755 ${WORKDIR}/nfs-utils.conf ${D}${sysconfdir}
77 install -d ${D}${systemd_unitdir}/system
78 install -m 0644 ${WORKDIR}/nfs-server.service ${D}${systemd_unitdir}/system/
79 install -m 0644 ${WORKDIR}/nfs-mountd.service ${D}${systemd_unitdir}/system/
80 install -m 0644 ${WORKDIR}/nfs-statd.service ${D}${systemd_unitdir}/system/
81 sed -i -e 's,@SBINDIR@,${sbindir},g' \
82 -e 's,@SYSCONFDIR@,${sysconfdir},g' \
83 ${D}${systemd_unitdir}/system/*.service
84
85 # kernel code as of 3.8 hard-codes this path as a default
86 install -d ${D}/var/lib/nfs/v4recovery
87
88 # the following are built by CC_FOR_BUILD
89 rm -f ${D}${sbindir}/rpcdebug
90 rm -f ${D}${sbindir}/rpcgen
91 rm -f ${D}${sbindir}/locktest
92}