Some hard-coded paths make problems when package is built into chroot like
Software Collections. Removing these hard-coded paths should fix it.

Upstream report: https://mariadb.atlassian.net/browse/MDEV-6485


diff -up mariadb-10.0.12/client/mysql_plugin.c.cmakepaths mariadb-10.0.12/client/mysql_plugin.c
--- mariadb-10.0.12/client/mysql_plugin.c.cmakepaths	2014-06-12 11:26:06.000000000 +0200
+++ mariadb-10.0.12/client/mysql_plugin.c	2014-07-25 08:40:15.898059511 +0200
@@ -90,6 +90,7 @@ static int find_plugin(char *tp_path);
 static int build_bootstrap_file(char *operation, char *bootstrap);
 static int dump_bootstrap_file(char *bootstrap_file);
 static int bootstrap_server(char *server_path, char *bootstrap_file);
+static int find_file_in_path(char *to,const char *name);
 
 
 int main(int argc,char *argv[])
@@ -122,7 +123,7 @@ int main(int argc,char *argv[])
   */
   if ((error= process_options(argc, argv, operation)) ||
       (error= check_access()) ||
-      (error= find_tool("mysqld" FN_EXEEXT, server_path)) ||
+      (error= find_file_in_path("mysqld" FN_EXEEXT, server_path)) ||
       (error= find_plugin(tp_path)) ||
       (error= build_bootstrap_file(operation, bootstrap)))
     goto exit;
@@ -325,7 +326,7 @@ static int get_default_values()
   FILE *file= 0;
 
   bzero(tool_path, FN_REFLEN);
-  if ((error= find_tool("my_print_defaults" FN_EXEEXT, tool_path)))
+  if ((error= find_file_in_path("my_print_defaults" FN_EXEEXT, tool_path)))
     goto exit;
   else
   {
@@ -954,6 +955,55 @@ exit:
 }
 
 
+#if defined(__WIN__)
+#define F_OK 0
+#define PATH_SEP ';'
+#define PROGRAM_EXTENSION ".exe"
+#else
+#define PATH_SEP ':'
+#endif
+
+static int find_file_in_path(char *to, const char *name)
+{
+  char *path,*pos,dir[2];
+  const char *ext="";
+
+  if (!(path=getenv("PATH")))
+    goto notfound;
+  dir[0]=FN_LIBCHAR; dir[1]=0;
+#ifdef PROGRAM_EXTENSION
+  if (!fn_ext(name)[0])
+    ext=PROGRAM_EXTENSION;
+#endif
+
+  for (pos=path ; (pos=strchr(pos,PATH_SEP)) ; path= ++pos)
+  {
+    if (path != pos)
+    {
+      strxmov(strnmov(to,path,(uint) (pos-path)),dir,name,ext,NullS);
+      if (!access(to,F_OK))
+      {
+        if (opt_verbose)
+          printf("# Found tool '%s' as '%s'.\n", name, to);
+	return 0;
+      }
+    }
+  }
+#ifdef __WIN__
+  to[0]=FN_CURLIB;
+  strxmov(to+1,dir,name,ext,NullS);
+  if (!access(to,F_OK))			/* Test in current dir */
+  {
+    if (opt_verbose)
+      printf("# Found tool '%s' as '%s'.\n", name, to);
+    return 0;
+  }
+#endif
+notfound:
+  fprintf(stderr, "WARNING: Cannot find %s.\n", name);
+  return 1;				/* File not found */
+}
+
 /**
   Locate the tool and form tool path.
 
diff -up mariadb-10.0.12/mysys/my_default.c.cmakepaths mariadb-10.0.12/mysys/my_default.c
--- mariadb-10.0.12/mysys/my_default.c.cmakepaths	2014-06-12 11:26:03.000000000 +0200
+++ mariadb-10.0.12/mysys/my_default.c	2014-07-25 08:39:04.875937851 +0200
@@ -1224,9 +1224,6 @@ static const char **init_default_directo
 
 #else
 
-  errors += add_directory(alloc, "/etc/", dirs);
-  errors += add_directory(alloc, "/etc/mysql/", dirs);
-
 #if defined(DEFAULT_SYSCONFDIR)
   if (DEFAULT_SYSCONFDIR[0])
     errors += add_directory(alloc, DEFAULT_SYSCONFDIR, dirs);
diff -up mariadb-10.0.12/scripts/mysqlaccess.sh.cmakepaths mariadb-10.0.12/scripts/mysqlaccess.sh
--- mariadb-10.0.12/scripts/mysqlaccess.sh.cmakepaths	2014-06-12 11:26:06.000000000 +0200
+++ mariadb-10.0.12/scripts/mysqlaccess.sh	2014-07-25 08:39:04.877937855 +0200
@@ -483,9 +483,6 @@ MySQLaccess::Report::Print_Header();
   elsif (-f "@sysconfdir@/$script_conf") {
      require "@sysconfdir@/$script_conf";
   }
-  elsif (-f "/etc/$script_conf") {
-     require "/etc/$script_conf";
-  }
 
 # ****************************
 # Read in all parameters
@@ -951,7 +948,6 @@ sub MergeConfigFile {
 sub MergeConfigFiles {
     my ($name,$pass,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = getpwuid $<;
     MergeConfigFile("@sysconfdir@/my.cnf");
-    MergeConfigFile("/etc/my.cnf");
     MergeConfigFile("$dir/.my.cnf");
 }
 
diff -up mariadb-10.0.12/scripts/mysqld_multi.sh.cmakepaths mariadb-10.0.12/scripts/mysqld_multi.sh
--- mariadb-10.0.12/scripts/mysqld_multi.sh.cmakepaths	2014-06-12 11:26:04.000000000 +0200
+++ mariadb-10.0.12/scripts/mysqld_multi.sh	2014-07-25 08:39:04.878937857 +0200
@@ -499,9 +499,7 @@ sub list_defaults_files
 
   my %seen;  # Don't list the same file more than once
   return grep { defined $_ and not $seen{$_}++ and -f $_ and -r $_ }
-              ('/etc/my.cnf',
-               '/etc/mysql/my.cnf',
-               '@sysconfdir@/my.cnf',
+              ('@sysconfdir@/my.cnf',
                ($ENV{MYSQL_HOME} ? "$ENV{MYSQL_HOME}/my.cnf" : undef),
                $opt{'extra-file'},
                ($ENV{HOME} ? "$ENV{HOME}/.my.cnf" : undef));
diff -up mariadb-10.0.12/scripts/mytop.sh.cmakepaths mariadb-10.0.12/scripts/mytop.sh
--- mariadb-10.0.12/scripts/mytop.sh.cmakepaths	2014-06-12 11:26:06.000000000 +0200
+++ mariadb-10.0.12/scripts/mytop.sh	2014-07-25 08:39:04.879937858 +0200
@@ -1829,8 +1829,8 @@ sub FindProg($)
 {
     my $prog  = shift;
     my $found = undef;
-    my @search_dirs = ("/bin", "/usr/bin", "/usr/sbin",
-                       "/usr/local/bin", "/usr/local/sbin");
+    my @search_dirs = ("@prefix@", "@prefix@/bin", "@prefix@/sbin",
+                       "@prefix@/local/bin", "@prefix@/local/sbin");
 
     for (@search_dirs)
     {
