]> code.ossystems Code Review - openembedded-core.git/commitdiff
nfs-utils: change owner/group of directories in do_install
authorChen Qi <Qi.Chen@windriver.com>
Fri, 7 Nov 2014 08:47:19 +0000 (16:47 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 9 Nov 2014 10:17:05 +0000 (10:17 +0000)
Previously, the owners/groups of directories like /var/lib/nfs/statd
are changed in the init script, /etc/init.d/nfscommon. This is actually
a workaround. We need to change them at do_install time.

This patch fixes the above problem by changing owners/groups at do_install
time.

Besides, configuration option '--with-staduser=nobody' is changed to be
'--with-statduser=rpcuser'. And /var/lib/nfs/statd/state is modified to have
permission 0644, just like other distros (ubuntu, fedora, etc.) do.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon
meta/recipes-connectivity/nfs-utils/nfs-utils_1.3.0.bb

index 65fdd1dd4ff66734b6b01e15b297d73859def432..992267d5a1610214c1aacfb223ed090d89f09438 100644 (file)
@@ -28,33 +28,7 @@ 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 rpc_pipefs
-               mkdir -p sm sm.bak statd
-               chown rpcuser:rpcuser sm sm.bak statd
-               test -w statd/state || {
-                       rm -f statd/state
-                       :>statd/state
-               }
-               umask 022
-               for file in xtab etab smtab rmtab
-               do
-                       test -w "$file" || {
-                               rm -f "$file"
-                               :>"$file"
-                       }
-               done
-       )
-       chown rpcuser:rpcuser "$NFS_STATEDIR"
-       echo done
-}
 
-#statd
 start_statd(){
        echo -n "starting statd: "
        start-stop-daemon --start --exec "$NFS_STATD" --pidfile "$STATD_PID"
@@ -74,7 +48,6 @@ stop_statd(){
 #FIXME: need to create the /var/lib/nfs/... directories
 case "$1" in
   start)
-       create_directories
        start_statd;;
   stop)
        stop_statd;;
index 4933e10403f20378f3b8c4537c0b746fbc3dc71f..37a2e1a6dae62bda8ea5fc325ce2eb5e6fb47460 100644 (file)
@@ -56,7 +56,7 @@ SYSTEMD_SERVICE_${PN}-client = "nfs-statd.service"
 SYSTEMD_AUTO_ENABLE = "disable"
 
 # --enable-uuid is need for cross-compiling
-EXTRA_OECONF = "--with-statduser=nobody \
+EXTRA_OECONF = "--with-statduser=rpcuser \
                 --enable-mountconfig \
                 --enable-libmount-mount \
                 --disable-nfsv41 \
@@ -92,7 +92,6 @@ do_compile_prepend() {
 
 do_install_append () {
        install -d ${D}${sysconfdir}/init.d
-       install -d ${D}${localstatedir}/lib/nfs/statd
        install -m 0755 ${WORKDIR}/nfsserver ${D}${sysconfdir}/init.d/nfsserver
        install -m 0755 ${WORKDIR}/nfscommon ${D}${sysconfdir}/init.d/nfscommon
 
@@ -108,6 +107,10 @@ do_install_append () {
        # kernel code as of 3.8 hard-codes this path as a default
        install -d ${D}/var/lib/nfs/v4recovery
 
+       # chown the directories and files
+       chown -R rpcuser:rpcuser ${D}${localstatedir}/lib/nfs/statd
+       chmod 0644 ${D}${localstatedir}/lib/nfs/statd/state
+
        # the following are built by CC_FOR_BUILD
        rm -f ${D}${sbindir}/rpcdebug
        rm -f ${D}${sbindir}/rpcgen