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