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

6f9931
diff -up mysql-5.5.36/mysqld.service.scl-env-check mysql-5.5.36/mysqld.service
6f9931
--- mysql-5.5.36/mysqld.service.scl-env-check	2014-03-28 00:19:39.645698340 +0100
6f9931
+++ mysql-5.5.36/mysqld.service	2014-03-28 00:20:58.013619784 +0100
6f9931
@@ -27,12 +27,17 @@ Type=simple
6f9931
 User=mysql
6f9931
 Group=mysql
6f9931
 
6f9931
-ExecStartPre=/usr/libexec/mysqld-prepare-db-dir %n
6f9931
+# Load collections set to enabled for this service
6f9931
+EnvironmentFile=__SCL_SCRIPTS__/service-environment
6f9931
+
6f9931
+# We want to start server only inside "scl enable" invocation
6f9931
+ExecStartPre=/usr/bin/scl enable $MYSQL55_SCLS_ENABLED -- /usr/bin/scl_enabled __SCL_NAME__
6f9931
+ExecStartPre=/usr/bin/scl enable $MYSQL55_SCLS_ENABLED -- /usr/libexec/mysqld-prepare-db-dir %n
6f9931
 # Note: we set --basedir to prevent probes that might trigger SELinux alarms,
6f9931
 # per bug #547485
6f9931
-ExecStart=/usr/bin/mysqld_safe --basedir=/usr
6f9931
-ExecStartPost=/usr/libexec/mysqld-wait-ready $MAINPID
6f9931
-ExecStopPost=/usr/libexec/mysqld-wait-stop
6f9931
+ExecStart=/usr/bin/scl enable $MYSQL55_SCLS_ENABLED -- /usr/bin/mysqld_safe --basedir=/usr
6f9931
+ExecStartPost=/usr/bin/scl enable $MYSQL55_SCLS_ENABLED -- /usr/libexec/mysqld-wait-ready $MAINPID
6f9931
+ExecStopPost=/usr/bin/scl enable $MYSQL55_SCLS_ENABLED -- /usr/libexec/mysqld-wait-stop
6f9931
 
6f9931
 # Give a reasonable amount of time for the server to start up/shut down
6f9931
 TimeoutSec=300
6f9931
diff -up mysql-5.5.36/scripts/mysqld_safe.sh.scl-env-check mysql-5.5.36/scripts/mysqld_safe.sh
6f9931
--- mysql-5.5.36/scripts/mysqld_safe.sh.scl-env-check	2014-03-28 00:19:39.611698374 +0100
6f9931
+++ mysql-5.5.36/scripts/mysqld_safe.sh	2014-03-28 00:19:39.646698339 +0100
6f9931
@@ -11,6 +11,12 @@
6f9931
 # mysql.server works by first doing a cd to the base directory and from there
6f9931
 # executing mysqld_safe
6f9931
 
6f9931
+# we want start daemon only inside "scl enable" invocation
6f9931
+if ! scl_enabled __SCL_NAME__ ; then
6f9931
+    echo "Use \"scl enable __SCL_NAME__ 'service ...'\" invocation"
6f9931
+    exit 1
6f9931
+fi
6f9931
+
6f9931
 # Initialize script globals
6f9931
 KILL_MYSQLD=1;
6f9931
 MYSQLD=
6f9931
diff -up mysql-5.5.36/scripts/mysql_install_db.sh.scl-env-check mysql-5.5.36/scripts/mysql_install_db.sh
6f9931
--- mysql-5.5.36/scripts/mysql_install_db.sh.scl-env-check	2014-01-14 09:16:26.000000000 +0100
6f9931
+++ mysql-5.5.36/scripts/mysql_install_db.sh	2014-03-28 00:19:39.646698339 +0100
6f9931
@@ -18,6 +18,12 @@
6f9931
 #
6f9931
 # All unrecognized arguments to this script are passed to mysqld.
6f9931
 
6f9931
+# we want start daemon only inside "scl enable" invocation
6f9931
+if ! scl_enabled __SCL_NAME__ ; then
6f9931
+    echo "Use \"scl enable __SCL_NAME__ 'service ...'\" invocation"
6f9931
+    exit 1
6f9931
+fi
6f9931
+
6f9931
 basedir=""
6f9931
 builddir=""
6f9931
 ldata="@localstatedir@"
6f9931
@@ -410,15 +416,15 @@ else
6f9931
   echo
6f9931
   echo "You can try to start the mysqld daemon with:"
6f9931
   echo
6f9931
-  echo "    shell> $mysqld --skip-grant &"
6f9931
+  echo "    shell> su -s /bin/bash - mysql -c 'scl enable __SCL_NAME__ -- $mysqld --skip-grant --general-log &'"
6f9931
   echo
6f9931
   echo "and use the command line tool $bindir/mysql"
6f9931
   echo "to connect to the mysql database and look at the grant tables:"
6f9931
   echo
6f9931
-  echo "    shell> $bindir/mysql -u root mysql"
6f9931
+  echo "    shell> scl enable __SCL_NAME__ -- mysql -u root mysql"
6f9931
   echo "    mysql> show tables"
6f9931
   echo
6f9931
-  echo "Try 'mysqld --help' if you have problems with paths.  Using --log"
6f9931
+  echo "Try 'scl enable __SCL_NAME__ -- mysqld --help' if you have problems with paths.  Using --log"
6f9931
   echo "gives you a log in $ldata that may be helpful."
6f9931
   echo
6f9931
   echo "Please consult the MySQL manual section"
6f9931
@@ -447,19 +453,15 @@ fi
6f9931
 # the screen.
6f9931
 if test "$cross_bootstrap" -eq 0 && test -z "$srcdir"
6f9931
 then
6f9931
-  s_echo
6f9931
-  s_echo "To start mysqld at boot time you have to copy"
6f9931
-  s_echo "support-files/mysql.server to the right place for your system"
6f9931
-
6f9931
   echo
6f9931
   echo "PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !"
6f9931
   echo "To do so, start the server, then issue the following commands:"
6f9931
   echo
6f9931
-  echo "$bindir/mysqladmin -u root password 'new-password'"
6f9931
-  echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'"
6f9931
+  echo "scl enable __SCL_NAME__ -- $bindir/mysqladmin -u root password 'new-password'"
6f9931
+  echo "scl enable __SCL_NAME__ -- $bindir/mysqladmin -u root -h $hostname password 'new-password'"
6f9931
   echo
6f9931
   echo "Alternatively you can run:"
6f9931
-  echo "$bindir/mysql_secure_installation"
6f9931
+  echo "scl enable __SCL_NAME__ -- $bindir/mysql_secure_installation"
6f9931
   echo
6f9931
   echo "which will also give you the option of removing the test"
6f9931
   echo "databases and anonymous user created by default.  This is"
6f9931
@@ -471,10 +473,11 @@ then
6f9931
   then
6f9931
     echo
6f9931
     echo "You can start the MySQL daemon with:"
6f9931
-    echo "cd $basedir ; $bindir/mysqld_safe &"
6f9931
+    echo "systemctl start __SCL_NAME__-mysqld"
6f9931
     echo
6f9931
     echo "You can test the MySQL daemon with mysql-test-run.pl"
6f9931
-    echo "cd $basedir/mysql-test ; perl mysql-test-run.pl"
6f9931
+    echo "after installing __SCL_NAME__-mysql-test package."
6f9931
+    echo "See @prefix@/share/mysql-test/README for instructions."
6f9931
   fi
6f9931
 
6f9931
   echo