ganapathi / rpms / mariadb

Forked from rpms/mariadb 4 years ago
Clone

Blame SOURCES/mariadb-scl-env-check.patch

4b7078
diff -rup mariadb-10.0.15-orig/scripts/mysqld_safe.sh mariadb-10.0.15/scripts/mysqld_safe.sh
4b7078
--- mariadb-10.0.15-orig/scripts/mysqld_safe.sh	2014-12-04 19:43:46.199488213 +0100
4b7078
+++ mariadb-10.0.15/scripts/mysqld_safe.sh	2014-12-04 19:51:33.461984234 +0100
4b7078
@@ -11,6 +11,12 @@
4b7078
 # mysql.server works by first doing a cd to the base directory and from there
4b7078
 # executing mysqld_safe
4b7078
 
4b7078
+# we want start daemon only inside "scl enable" invocation
4b7078
+if ! scl_enabled @SCL_NAME@ ; then
4b7078
+    echo "Use \"scl enable @SCL_NAME@ 'service ...'\" invocation"
4b7078
+    exit 1
4b7078
+fi
4b7078
+
4b7078
 # Initialize script globals
4b7078
 KILL_MYSQLD=1;
4b7078
 MYSQLD=
4b7078
diff -rup mariadb-10.0.15-orig/scripts/mysql.init.in mariadb-10.0.15/scripts/mysql.init.in
4b7078
--- mariadb-10.0.15-orig/scripts/mysql.init.in	2014-12-04 19:43:46.310488382 +0100
4b7078
+++ mariadb-10.0.15/scripts/mysql.init.in	2014-12-04 20:00:42.273120004 +0100
4b7078
@@ -145,6 +145,18 @@ condrestart(){
4b7078
     [ -e $lockfile ] && restart || :
4b7078
 }
4b7078
 
4b7078
+# We have to re-enable SCL environment, because /sbin/service
4b7078
+# clears almost all environment variables.
4b7078
+# Since X_SCLS is cleared as well, we lose information about other
4b7078
+# collections enabled.
4b7078
+source @SCL_SCRIPTS@/service-environment
4b7078
+source scl_source enable $MARIADB@MAJOR_VERSION@@MINOR_VERSION@_SCLS_ENABLED
4b7078
+
4b7078
+# we want start daemon only inside "scl enable" invocation
4b7078
+if ! scl_enabled @SCL_NAME@ ; then
4b7078
+    echo "Collection @SCL_NAME@ has to be listed in @SCL_SCRIPTS@/service-environment"
4b7078
+    exit 1
4b7078
+fi
4b7078
 
4b7078
 # See how we were called.
4b7078
 case "$1" in
4b7078
diff -rup mariadb-10.0.15-orig/scripts/mysql_install_db.sh mariadb-10.0.15/scripts/mysql_install_db.sh
4b7078
--- mariadb-10.0.15-orig/scripts/mysql_install_db.sh	2014-12-04 19:43:46.308488379 +0100
4b7078
+++ mariadb-10.0.15/scripts/mysql_install_db.sh	2014-12-04 19:57:02.056065525 +0100
4b7078
@@ -19,6 +19,12 @@
4b7078
 #
4b7078
 # All unrecognized arguments to this script are passed to mysqld.
4b7078
 
4b7078
+# we want start daemon only inside "scl enable" invocation
4b7078
+if ! scl_enabled @SCL_NAME@ ; then
4b7078
+    echo "Use \"scl enable @SCL_NAME@ 'service ...'\" invocation"
4b7078
+    exit 1
4b7078
+fi
4b7078
+
4b7078
 basedir=""
4b7078
 builddir=""
4b7078
 ldata="@localstatedir@"
4b7078
@@ -435,16 +441,16 @@ else
4b7078
   echo "The problem could be conflicting information in an external"
4b7078
   echo "my.cnf files. You can ignore these by doing:"
4b7078
   echo
4b7078
-  echo "    shell> $scriptdir/scripts/mysql_install_db --defaults-file=~/.my.cnf"
4b7078
+  echo "    shell> su -s /bin/bash - mysql -c 'scl enable @SCL_NAME@ -- $scriptdir/scripts/mysql_install_db --defaults-file=~/.my.cnf'"
4b7078
   echo
4b7078
   echo "You can also try to start the mysqld daemon with:"
4b7078
   echo
4b7078
-  echo "    shell> $mysqld --skip-grant --general-log &"
4b7078
+  echo "    shell> su -s /bin/bash - mysql -c 'scl enable @SCL_NAME@ -- $mysqld --skip-grant --general-log &'"
4b7078
   echo
4b7078
   echo "and use the command line tool $bindir/mysql"
4b7078
   echo "to connect to the mysql database and look at the grant tables:"
4b7078
   echo
4b7078
-  echo "    shell> $bindir/mysql -u root mysql"
4b7078
+  echo "    shell> scl enable @SCL_NAME@ -- $bindir/mysql -u root mysql"
4b7078
   echo "    mysql> show tables;"
4b7078
   echo
4b7078
   echo "Try 'mysqld --help' if you have problems with paths.  Using"
4b7078
@@ -474,19 +480,15 @@ fi
4b7078
 # the screen.
4b7078
 if test "$cross_bootstrap" -eq 0 && test -z "$srcdir"
4b7078
 then
4b7078
-  s_echo
4b7078
-  s_echo "To start mysqld at boot time you have to copy"
4b7078
-  s_echo "support-files/mysql.server to the right place for your system"
4b7078
-
4b7078
   echo
4b7078
   echo "PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !"
4b7078
   echo "To do so, start the server, then issue the following commands:"
4b7078
   echo
4b7078
-  echo "'$bindir/mysqladmin' -u root password 'new-password'"
4b7078
-  echo "'$bindir/mysqladmin' -u root -h $hostname password 'new-password'"
4b7078
+  echo "scl enable @SCL_NAME@ -- '$bindir/mysqladmin' -u root password 'new-password'"
4b7078
+  echo "scl enable @SCL_NAME@ -- '$bindir/mysqladmin' -u root -h $hostname password 'new-password'"
4b7078
   echo
4b7078
   echo "Alternatively you can run:"
4b7078
-  echo "'$bindir/mysql_secure_installation'"
4b7078
+  echo "scl enable @SCL_NAME@ -- '$bindir/mysql_secure_installation'"
4b7078
   echo
4b7078
   echo "which will also give you the option of removing the test"
4b7078
   echo "databases and anonymous user created by default.  This is"
4b7078
@@ -502,7 +504,8 @@ then
4b7078
     echo "cd '$basedir' ; $bindir/mysqld_safe --datadir='$ldata'"
4b7078
     echo
4b7078
     echo "You can test the MariaDB daemon with mysql-test-run.pl"
4b7078
-    echo "cd '$basedir/mysql-test' ; perl mysql-test-run.pl"
4b7078
+    echo "after installing @SCL_NAME@-mariadb-test package."
4b7078
+    echo "See @prefix@/share/mysql-test/README for instructions."
4b7078
   fi
4b7078
 
4b7078
   echo
4b7078
diff -rup mariadb-10.0.15-orig/scripts/mysql.service.in mariadb-10.0.15/scripts/mysql.service.in
4b7078
--- mariadb-10.0.15-orig/scripts/mysql.service.in	2014-12-04 19:43:46.310488382 +0100
4b7078
+++ mariadb-10.0.15/scripts/mysql.service.in	2014-12-04 19:49:28.626953351 +0100
4b7078
@@ -32,13 +32,19 @@ Type=simple
4b7078
 User=mysql
4b7078
 Group=mysql
4b7078
 
4b7078
-ExecStartPre=@libexecdir@/mysql-check-socket
4b7078
-ExecStartPre=@libexecdir@/mysql-prepare-db-dir %n
4b7078
+# Load collections set to enabled for this service
4b7078
+EnvironmentFile=@SCL_SCRIPTS@/service-environment
4b7078
+
4b7078
+# We want to start server only inside "scl enable" invocation
4b7078
+ExecStartPre=/usr/bin/scl enable $MARIADB@MAJOR_VERSION@@MINOR_VERSION@_SCLS_ENABLED -- /usr/bin/scl_enabled @SCL_NAME@
4b7078
+
4b7078
+ExecStartPre=/usr/bin/scl enable $MARIADB@MAJOR_VERSION@@MINOR_VERSION@_SCLS_ENABLED -- @libexecdir@/mysql-check-socket
4b7078
+ExecStartPre=/usr/bin/scl enable $MARIADB@MAJOR_VERSION@@MINOR_VERSION@_SCLS_ENABLED -- @libexecdir@/mysql-prepare-db-dir %n
4b7078
 # Note: we set --basedir to prevent probes that might trigger SELinux alarms,
4b7078
 # per bug #547485
4b7078
-ExecStart=@bindir@/mysqld_safe --basedir=@prefix@
4b7078
-ExecStartPost=@libexecdir@/mysql-wait-ready $MAINPID
4b7078
-ExecStartPost=@libexecdir@/mysql-check-upgrade
4b7078
+ExecStart=/usr/bin/scl enable $MARIADB@MAJOR_VERSION@@MINOR_VERSION@_SCLS_ENABLED -- @bindir@/mysqld_safe --basedir=@prefix@
4b7078
+ExecStartPost=/usr/bin/scl enable $MARIADB@MAJOR_VERSION@@MINOR_VERSION@_SCLS_ENABLED -- @libexecdir@/mysql-wait-ready $MAINPID
4b7078
+ExecStartPost=/usr/bin/scl enable $MARIADB@MAJOR_VERSION@@MINOR_VERSION@_SCLS_ENABLED -- @libexecdir@/mysql-check-upgrade
4b7078
 
4b7078
 # Give a reasonable amount of time for the server to start up/shut down
4b7078
 TimeoutSec=300