ganapathi / rpms / mariadb

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