28ab1c
From 7a6dfe638d1ef92dfe830094db6b09cb0956c189 Mon Sep 17 00:00:00 2001
28ab1c
From: Lukas Nykryn <lnykryn@redhat.com>
28ab1c
Date: Mon, 19 Jul 2021 11:27:28 +0200
28ab1c
Subject: [PATCH] 95nfs: set correct ownership and permissions for statd 
28ab1c
 directory
28ab1c
28ab1c
The directory ownership for the statd directory should be
28ab1c
rpcuser:rpcuser.
28ab1c
28ab1c
Fixes: 5840c466 95nfs: /var/lib/nfs/statd/sm is /var/lib/nfs/sm on SUSE
28ab1c
28ab1c
Resolves: #1924950
28ab1c
---
28ab1c
 modules.d/95nfs/module-setup.sh | 8 +++++++-
28ab1c
 1 file changed, 7 insertions(+), 1 deletion(-)
28ab1c
28ab1c
diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
28ab1c
index 2ca75d07..ac6d1761 100755
28ab1c
--- a/modules.d/95nfs/module-setup.sh
28ab1c
+++ b/modules.d/95nfs/module-setup.sh
28ab1c
@@ -104,7 +104,13 @@ install() {
28ab1c
     inst "$moddir/nfs-lib.sh" "/lib/nfs-lib.sh"
28ab1c
     mkdir -m 0755 -p "$initdir/var/lib/nfs/rpc_pipefs"
28ab1c
     mkdir -m 0770 -p "$initdir/var/lib/rpcbind"
28ab1c
-    mkdir -m 0755 -p "$initdir/var/lib/nfs/statd/sm"
28ab1c
+    [ -d "$dracutsysrootdir/var/lib/nfs/statd/sm" ] && \
28ab1c
+        mkdir -m 0700 -p "$initdir/var/lib/nfs/statd" && \
28ab1c
+        mkdir -m 0755 -p "$initdir/var/lib/nfs/statd/sm" && \
28ab1c
+        chown -R rpcuser:rpcuser "$initdir/var/lib/nfs/statd"
28ab1c
+    [ -d "$dracutsysrootdir/var/lib/nfs/sm" ] && \
28ab1c
+        mkdir -m 0755 -p "$initdir/var/lib/nfs/sm" &&
28ab1c
+        chown -R rpcuser:rpcuser "$initdir/var/lib/nfs/sm"
28ab1c
 
28ab1c
     # Rather than copy the passwd file in, just set a user for rpcbind
28ab1c
     # We'll save the state and restart the daemon from the root anyway
28ab1c