nfs-utils: change owner/group of directories in do_install

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.

(From OE-Core rev: 8c27a1e25ae42a435ab7d290cab40f94f9286243)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Chen Qi 2014-11-07 16:47:19 +08:00 committed by Richard Purdie
parent 5fe3954013
commit 8f9ed2407f
2 changed files with 5 additions and 29 deletions

View 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;;

View 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