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