0d2dc2
This scirpt is ran by the systemd service.
0d2dc2
In Fedora the service has priviledges dropped to the mysql user.
0d2dc2
Thus "chown 0" will always fail
0d2dc2
0d2dc2
Never parse 'ls' output!
0d2dc2
http://mywiki.wooledge.org/BashFAQ/087
0d2dc2
0d2dc2
--- mariadb-10.4.12/scripts/mysql_install_db.sh	2020-01-26 21:43:53.000000000 +0100
0d2dc2
+++ mariadb-10.4.12/scripts/mysql_install_db.sh_patched	2020-01-29 11:11:09.448812331 +0100
0d2dc2
@@ -482,13 +482,16 @@ if test -n "$user"
0d2dc2
 then
0d2dc2
   if test -z "$srcdir" -a "$in_rpm" -eq 0
0d2dc2
   then
0d2dc2
-    chown 0 "$pamtooldir/auth_pam_tool_dir/auth_pam_tool" && \
0d2dc2
-    chmod 04755 "$pamtooldir/auth_pam_tool_dir/auth_pam_tool"
0d2dc2
-    if test $? -ne 0
0d2dc2
+    if [ `stat "$pamtooldir/auth_pam_tool_dir/auth_pam_tool" -c %u` -ne 0 ]
0d2dc2
     then
0d2dc2
+      chown 0 "$pamtooldir/auth_pam_tool_dir/auth_pam_tool" && \
0d2dc2
+      chmod 04755 "$pamtooldir/auth_pam_tool_dir/auth_pam_tool"
0d2dc2
+      if test $? -ne 0
0d2dc2
+      then
0d2dc2
         echo "Couldn't set an owner to '$pamtooldir/auth_pam_tool_dir/auth_pam_tool'."
0d2dc2
         echo "It must be root, the PAM authentication plugin doesn't work otherwise.."
0d2dc2
         echo
0d2dc2
+      fi
0d2dc2
     fi
0d2dc2
     chown $user "$pamtooldir/auth_pam_tool_dir" && \
0d2dc2
     chmod 0700 "$pamtooldir/auth_pam_tool_dir"