summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/nfs-utils
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:44 +0000
commitc0e048d33d5a5557ba24d74751aca7b000b16649 (patch)
tree533a51c9342854a62bb3ee62f9575d924e8d9441 /meta/recipes-connectivity/nfs-utils
parentfedd84f7eee7dba095459cde4df435975c7e6aac (diff)
downloadpoky-c0e048d33d5a5557ba24d74751aca7b000b16649.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. (From OE-Core rev: 39bb7e32c5eb930981392cec70a063e8dac152b7) Signed-off-by: Zhang Xiao <xiao.zhang@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity/nfs-utils')
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon90
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver46
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.9.bb27
3 files changed, 114 insertions, 49 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 @@
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
22test -x "$NFS_STATD" || NFS_STATD=/usr/sbin/rpc.statd
23test -z "$STATD_PID" && STATD_PID=/var/run/rpc.statd.pid
24#
25# The default state directory is /var/lib/nfs
26test -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#directories
32create_directories(){
33 echo -n 'creating NFS state directory: '
34 mkdir -p "$NFS_STATEDIR"
35 ( cd "$NFS_STATEDIR"
36 umask 077
37 mkdir -p rpc_pipefs
38 mkdir -p sm sm.bak statd
39 chown rpcuser sm sm.bak statd
40 test -w statd/state || {
41 rm -f statd/state
42 :>statd/state
43 }
44 umask 022
45 for file in xtab etab smtab rmtab
46 do
47 test -w "$file" || {
48 rm -f "$file"
49 :>"$file"
50 }
51 done
52 )
53 chown rpcuser "$NFS_STATEDIR"
54 echo done
55}
56
57#statd
58start_statd(){
59 echo -n "starting statd: "
60 start-stop-daemon --start --exec "$NFS_STATD" --pidfile "$STATD_PID"
61 echo done
62}
63stop_statd(){
64 echo -n 'stopping statd: '
65 start-stop-daemon --stop --quiet --signal 1 --pidfile "$STATD_PID"
66 echo done
67}
68#----------------------------------------------------------------------
69#
70# supported options:
71# start
72# stop
73# restart: stops and starts mountd
74#FIXME: need to create the /var/lib/nfs/... directories
75case "$1" in
76 start)
77 create_directories
78 start_statd;;
79 stop)
80 stop_statd;;
81 status)
82 status $NFS_STATD
83 exit $?;;
84 restart)
85 $0 stop
86 $0 start;;
87 *)
88 echo "Usage: $0 {start|stop|status|restart}"
89 exit 1;;
90esac
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver
index c263f14f32..6e0df7e2ea 100644
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver
@@ -1,8 +1,8 @@
1#!/bin/sh 1#!/bin/sh
2### BEGIN INIT INFO 2### BEGIN INIT INFO
3# Provides: nfs-kernel-server 3# Provides: nfs-kernel-server
4# Required-Start: $remote_fs $portmap hwclock 4# Required-Start: $remote_fs nfs-common $portmap hwclock
5# Required-Stop: $remote_fs $portmap hwclock 5# Required-Stop: $remote_fs nfs-common $portmap hwclock
6# Default-Start: 2 3 4 5 6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6 7# Default-Stop: 0 1 6
8# Short-Description: Kernel NFS server support 8# Short-Description: Kernel NFS server support
@@ -24,8 +24,6 @@ test -r /etc/default/nfsd && . /etc/default/nfsd
24# Location of executables: 24# Location of executables:
25test -x "$NFS_MOUNTD" || NFS_MOUNTD=/usr/sbin/rpc.mountd 25test -x "$NFS_MOUNTD" || NFS_MOUNTD=/usr/sbin/rpc.mountd
26test -x "$NFS_NFSD" || NFS_NFSD=/usr/sbin/rpc.nfsd 26test -x "$NFS_NFSD" || NFS_NFSD=/usr/sbin/rpc.nfsd
27test -x "$NFS_STATD" || NFS_STATD=/usr/sbin/rpc.statd
28test -z "$STATD_PID" && STATD_PID=/var/run/rpc.statd.pid
29# 27#
30# The user mode program must also exist (it just starts the kernel 28# The user mode program must also exist (it just starts the kernel
31# threads using the kernel module code). 29# threads using the kernel module code).
@@ -36,34 +34,9 @@ test -x "$NFS_NFSD" || exit 0
36# ridiculous 99 34# ridiculous 99
37test "$NFS_SERVERS" != "" && test "$NFS_SERVERS" -gt 0 && test "$NFS_SERVERS" -lt 100 || NFS_SERVERS=8 35test "$NFS_SERVERS" != "" && test "$NFS_SERVERS" -gt 0 && test "$NFS_SERVERS" -lt 100 || NFS_SERVERS=8
38# 36#
39# The default state directory is /var/lib/nfs
40test -n "$NFS_STATEDIR" || NFS_STATEDIR=/var/lib/nfs
41#
42#---------------------------------------------------------------------- 37#----------------------------------------------------------------------
43# Startup and shutdown functions. 38# Startup and shutdown functions.
44# Actual startup/shutdown is at the end of this file. 39# Actual startup/shutdown is at the end of this file.
45#directories
46create_directories(){
47 echo -n 'creating NFS state directory: '
48 mkdir -p "$NFS_STATEDIR"
49 ( cd "$NFS_STATEDIR"
50 umask 077
51 mkdir -p sm sm.bak
52 test -w sm/state || {
53 rm -f sm/state
54 :>sm/state
55 }
56 umask 022
57 for file in xtab etab smtab rmtab
58 do
59 test -w "$file" || {
60 rm -f "$file"
61 :>"$file"
62 }
63 done
64 )
65 echo done
66}
67#mountd 40#mountd
68start_mountd(){ 41start_mountd(){
69 echo -n 'starting mountd: ' 42 echo -n 'starting mountd: '
@@ -124,17 +97,6 @@ stop_nfsd(){
124 fi 97 fi
125} 98}
126 99
127#statd
128start_statd(){
129 echo -n "starting statd: "
130 start-stop-daemon --start --exec "$NFS_STATD" --pidfile "$STATD_PID"
131 echo done
132}
133stop_statd(){
134 echo -n 'stopping statd: '
135 start-stop-daemon --stop --quiet --signal 1 --pidfile "$STATD_PID"
136 echo done
137}
138#---------------------------------------------------------------------- 100#----------------------------------------------------------------------
139# 101#
140# supported options: 102# supported options:
@@ -144,13 +106,11 @@ stop_statd(){
144# restart: stops and starts mountd 106# restart: stops and starts mountd
145#FIXME: need to create the /var/lib/nfs/... directories 107#FIXME: need to create the /var/lib/nfs/... directories
146case "$1" in 108case "$1" in
147 start) create_directories 109 start)
148 start_nfsd "$NFS_SERVERS" 110 start_nfsd "$NFS_SERVERS"
149 start_mountd 111 start_mountd
150 start_statd
151 test -r /etc/exports && exportfs -a;; 112 test -r /etc/exports && exportfs -a;;
152 stop) exportfs -ua 113 stop) exportfs -ua
153 stop_statd
154 stop_mountd 114 stop_mountd
155 stop_nfsd;; 115 stop_nfsd;;
156 status) 116 status)
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.9.bb b/meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.9.bb
index ea4914670b..cbfb7c1331 100644
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.9.bb
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils_1.2.9.bb
@@ -9,14 +9,21 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=95f3a93a5c3c7888de623b46ea085a84"
9 9
10# util-linux for libblkid 10# util-linux for libblkid
11DEPENDS = "libcap libnfsidmap libevent util-linux sqlite3" 11DEPENDS = "libcap libnfsidmap libevent util-linux sqlite3"
12RDEPENDS_${PN} = "rpcbind" 12RDEPENDS_${PN}-client = "rpcbind"
13RDEPENDS_${PN} = "${PN}-client"
13RRECOMMENDS_${PN} = "kernel-module-nfsd" 14RRECOMMENDS_${PN} = "kernel-module-nfsd"
14 15
16inherit useradd
17
18USERADD_PACKAGES = "${PN}-client"
19USERADD_PARAM_${PN}-client = "-d /var/lib/nfs -r -s /bin/false rpcuser"
20
15SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.bz2 \ 21SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.bz2 \
16 file://0001-configure-Allow-to-explicitly-disable-nfsidmap.patch \ 22 file://0001-configure-Allow-to-explicitly-disable-nfsidmap.patch \
17 file://nfs-utils-1.0.6-uclibc.patch \ 23 file://nfs-utils-1.0.6-uclibc.patch \
18 file://nfs-utils-1.2.3-sm-notify-res_init.patch \ 24 file://nfs-utils-1.2.3-sm-notify-res_init.patch \
19 file://nfsserver \ 25 file://nfsserver \
26 file://nfscommon \
20 file://nfs-utils.conf \ 27 file://nfs-utils.conf \
21 file://nfs-server.service \ 28 file://nfs-server.service \
22 file://nfs-mountd.service \ 29 file://nfs-mountd.service \
@@ -30,15 +37,16 @@ PARALLEL_MAKE = ""
30# Only kernel-module-nfsd is required here (but can be built-in) - the nfsd module will 37# Only kernel-module-nfsd is required here (but can be built-in) - the nfsd module will
31# pull in the remainder of the dependencies. 38# pull in the remainder of the dependencies.
32 39
40INITSCRIPT_PACKAGES = "${PN} ${PN}-client"
33INITSCRIPT_NAME = "nfsserver" 41INITSCRIPT_NAME = "nfsserver"
34# The server has no dependencies at the user run levels, so just put
35# it in at the default levels. It must be terminated before the network
36# in the shutdown levels, but that works fine.
37INITSCRIPT_PARAMS = "defaults" 42INITSCRIPT_PARAMS = "defaults"
43INITSCRIPT_NAME_${PN}-client = "nfscommon"
44INITSCRIPT_PARAMS_${PN}-client = "start 44 S ."
38 45
39inherit autotools update-rc.d systemd 46inherit autotools update-rc.d systemd
40 47
41SYSTEMD_SERVICE_${PN} = "nfs-server.service nfs-mountd.service nfs-statd.service" 48SYSTEMD_SERVICE_${PN} = "nfs-server.service nfs-mountd.service"
49SYSTEMD_SERVICE_${PN}-client = "nfs-statd.service"
42SYSTEMD_AUTO_ENABLE = "disable" 50SYSTEMD_AUTO_ENABLE = "disable"
43 51
44# --enable-uuid is need for cross-compiling 52# --enable-uuid is need for cross-compiling
@@ -60,7 +68,13 @@ PACKAGECONFIG[nfsidmap] = "--enable-nfsidmap,--disable-nfsidmap,keyutils"
60INHIBIT_AUTO_STAGE = "1" 68INHIBIT_AUTO_STAGE = "1"
61 69
62PACKAGES =+ "${PN}-client ${PN}-stats" 70PACKAGES =+ "${PN}-client ${PN}-stats"
63FILES_${PN}-client = "${base_sbindir}/*mount.nfs*" 71FILES_${PN}-client = "${base_sbindir}/*mount.nfs* ${sbindir}/*statd \
72 ${sbindir}/rpc.idmapd ${sbindir}/sm-notify \
73 ${sbindir}/showmount ${sbindir}/nfsstat \
74 ${localstatedir}/lib/nfs \
75 ${sysconfdir}/nfs-utils.conf \
76 ${sysconfdir}/init.d/nfscommon \
77 ${systemd_unitdir}/system/nfs-statd.service"
64FILES_${PN}-stats = "${sbindir}/mountstats ${sbindir}/nfsiostat" 78FILES_${PN}-stats = "${sbindir}/mountstats ${sbindir}/nfsiostat"
65RDEPENDS_${PN}-stats = "python" 79RDEPENDS_${PN}-stats = "python"
66 80
@@ -74,6 +88,7 @@ do_install_append () {
74 install -d ${D}${sysconfdir}/init.d 88 install -d ${D}${sysconfdir}/init.d
75 install -d ${D}${localstatedir}/lib/nfs/statd 89 install -d ${D}${localstatedir}/lib/nfs/statd
76 install -m 0755 ${WORKDIR}/nfsserver ${D}${sysconfdir}/init.d/nfsserver 90 install -m 0755 ${WORKDIR}/nfsserver ${D}${sysconfdir}/init.d/nfsserver
91 install -m 0755 ${WORKDIR}/nfscommon ${D}${sysconfdir}/init.d/nfscommon
77 92
78 install -m 0755 ${WORKDIR}/nfs-utils.conf ${D}${sysconfdir} 93 install -m 0755 ${WORKDIR}/nfs-utils.conf ${D}${sysconfdir}
79 install -d ${D}${systemd_unitdir}/system 94 install -d ${D}${systemd_unitdir}/system