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

a41a5b
diff -up mariadb-10.3.11/scripts/galera_new_cluster.sh.p90 mariadb-10.3.11/scripts/galera_new_cluster.sh
a41a5b
--- mariadb-10.3.11/scripts/galera_new_cluster.sh.p90	2018-12-18 17:47:15.963970827 +0100
a41a5b
+++ mariadb-10.3.11/scripts/galera_new_cluster.sh	2018-12-18 17:47:37.917160998 +0100
a41a5b
@@ -22,7 +22,7 @@ EOF
a41a5b
 fi
a41a5b
 
a41a5b
 systemctl set-environment _WSREP_NEW_CLUSTER='--wsrep-new-cluster' && \
a41a5b
-    systemctl start ${1:-mariadb}
a41a5b
+    systemctl start ${1:-@DAEMON_NAME@}
a41a5b
 
a41a5b
 extcode=$?
a41a5b
 
a41a5b
diff -up mariadb-10.3.11/scripts/mysqld_safe.sh.p90 mariadb-10.3.11/scripts/mysqld_safe.sh
a41a5b
--- mariadb-10.3.11/scripts/mysqld_safe.sh.p90	2018-12-18 17:45:20.907974139 +0100
a41a5b
+++ mariadb-10.3.11/scripts/mysqld_safe.sh	2018-12-18 17:45:20.910974165 +0100
a41a5b
@@ -11,6 +11,12 @@
a41a5b
 # mysql.server works by first doing a cd to the base directory and from there
a41a5b
 # executing mysqld_safe
a41a5b
 
a41a5b
+# we want start daemon only inside "scl enable" invocation
a41a5b
+if ! scl_enabled @SCL_NAME@ ; then
a41a5b
+    echo "Use \"scl enable @SCL_NAME@ 'service ...'\" invocation"
a41a5b
+    exit 1
a41a5b
+fi
a41a5b
+
a41a5b
 # Initialize script globals
a41a5b
 KILL_MYSQLD=1;
a41a5b
 MYSQLD=
a41a5b
diff -up mariadb-10.3.11/scripts/mysql_install_db.sh.p90 mariadb-10.3.11/scripts/mysql_install_db.sh
a41a5b
--- mariadb-10.3.11/scripts/mysql_install_db.sh.p90	2018-12-18 17:45:20.906974130 +0100
a41a5b
+++ mariadb-10.3.11/scripts/mysql_install_db.sh	2018-12-18 17:45:20.910974165 +0100
a41a5b
@@ -19,6 +19,12 @@
a41a5b
 #
a41a5b
 # All unrecognized arguments to this script are passed to mysqld.
a41a5b
 
a41a5b
+# we want start daemon only inside "scl enable" invocation
a41a5b
+if ! scl_enabled @SCL_NAME@ ; then
a41a5b
+    echo "Use \"scl enable @SCL_NAME@ 'service ...'\" invocation"
a41a5b
+    exit 1
a41a5b
+fi
a41a5b
+
a41a5b
 basedir=""
a41a5b
 builddir=""
a41a5b
 ldata="@localstatedir@"
a41a5b
@@ -514,16 +520,16 @@ else
a41a5b
   echo "The problem could be conflicting information in an external"
a41a5b
   echo "my.cnf files. You can ignore these by doing:"
a41a5b
   echo
a41a5b
-  echo "    shell> $0 --defaults-file=~/.my.cnf"
a41a5b
+  echo "    shell> su -s /bin/bash - mysql -c 'scl enable @SCL_NAME@ -- $0 --defaults-file=~/.my.cnf'"
a41a5b
   echo
a41a5b
   echo "You can also try to start the mysqld daemon with:"
a41a5b
   echo
a41a5b
-  echo "    shell> $mysqld --skip-grant-tables --general-log &"
a41a5b
+  echo "    shell> su -s /bin/bash - mysql -c 'scl enable @SCL_NAME@ -- $mysqld --skip-grant-tables --general-log &'"
a41a5b
   echo
a41a5b
   echo "and use the command line tool $bindir/mysql"
a41a5b
   echo "to connect to the mysql database and look at the grant tables:"
a41a5b
   echo
a41a5b
-  echo "    shell> $bindir/mysql -u root mysql"
a41a5b
+  echo "    shell> su -s /bin/bash - mysql -c 'scl enable @SCL_NAME@ -- $bindir/mysql -u root mysql''"
a41a5b
   echo "    mysql> show tables;"
a41a5b
   echo
a41a5b
   echo "Try 'mysqld --help' if you have problems with paths.  Using"
a41a5b
@@ -543,10 +549,6 @@ fi
a41a5b
 # the screen.
a41a5b
 if test "$cross_bootstrap" -eq 0 && test -z "$srcdir"
a41a5b
 then
a41a5b
-  s_echo
a41a5b
-  s_echo "To start mysqld at boot time you have to copy"
a41a5b
-  s_echo "support-files/mysql.server to the right place for your system"
a41a5b
-
a41a5b
   if test "$auth_root_authentication_method" = normal
a41a5b
   then
a41a5b
     echo
a41a5b
@@ -554,11 +556,11 @@ then
a41a5b
     echo "PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !"
a41a5b
     echo "To do so, start the server, then issue the following commands:"
a41a5b
     echo
a41a5b
-    echo "'$bindir/mysqladmin' -u root password 'new-password'"
a41a5b
-    echo "'$bindir/mysqladmin' -u root -h $hostname password 'new-password'"
a41a5b
+    echo "scl enable @SCL_NAME@ -- '$bindir/mysqladmin' -u root password 'new-password'"
a41a5b
+    echo "scl enable @SCL_NAME@ -- '$bindir/mysqladmin' -u root -h $hostname password 'new-password'"
a41a5b
     echo
a41a5b
     echo "Alternatively you can run:"
a41a5b
-    echo "'$bindir/mysql_secure_installation'"
a41a5b
+    echo "scl enable @SCL_NAME@ -- '$bindir/mysql_secure_installation'"
a41a5b
     echo
a41a5b
     echo "which will also give you the option of removing the test"
a41a5b
     echo "databases and anonymous user created by default.  This is"
a41a5b
@@ -577,6 +579,8 @@ then
a41a5b
     echo
a41a5b
     echo "You can test the MariaDB daemon with mysql-test-run.pl"
a41a5b
     echo "cd '$basedir/mysql-test' ; perl mysql-test-run.pl"
a41a5b
+    echo "after installing @SCL_NAME@-mariadb-test package."
a41a5b
+    echo "See @prefix@/share/mysql-test/README for instructions."
a41a5b
   fi
a41a5b
 
a41a5b
   echo
a41a5b
diff -up mariadb-10.3.11/scripts/mysql.service.in.p90 mariadb-10.3.11/scripts/mysql.service.in
a41a5b
--- mariadb-10.3.11/scripts/mysql.service.in.p90	2018-12-18 17:45:20.909974156 +0100
a41a5b
+++ mariadb-10.3.11/scripts/mysql.service.in	2018-12-18 17:45:20.910974165 +0100
a41a5b
@@ -40,14 +40,20 @@ Type=notify
a41a5b
 User=mysql
a41a5b
 Group=mysql
a41a5b
 
a41a5b
-ExecStartPre=@libexecdir@/mysql-check-socket
a41a5b
+# Load collections set to enabled for this service
a41a5b
+EnvironmentFile=@SCL_SCRIPTS@/service-environment
a41a5b
+
a41a5b
+# We want to start server only inside "scl enable" invocation
a41a5b
+ExecStartPre=/usr/bin/scl enable $@SCL_NAME_UPPER@_SCLS_ENABLED -- /usr/bin/scl_enabled @SCL_NAME@
a41a5b
+
a41a5b
+ExecStartPre=/usr/bin/scl enable $@SCL_NAME_UPPER@_SCLS_ENABLED -- @libexecdir@/mysql-check-socket
a41a5b
 # '%n' expands to 'Full unit name'; man systemd.unit
a41a5b
-ExecStartPre=@libexecdir@/mysql-prepare-db-dir %n
a41a5b
+ExecStartPre=/usr/bin/scl enable $@SCL_NAME_UPPER@_SCLS_ENABLED -- @libexecdir@/mysql-prepare-db-dir %n
a41a5b
 # MYSQLD_OPTS here is for users to set in /etc/systemd/system/@DAEMON_NAME@@.service.d/MY_SPECIAL.conf
a41a5b
 # Note: we set --basedir to prevent probes that might trigger SELinux alarms,
a41a5b
 # per bug #547485
a41a5b
-ExecStart=@libexecdir@/mysqld --basedir=@prefix@ $MYSQLD_OPTS $_WSREP_NEW_CLUSTER
a41a5b
-ExecStartPost=@libexecdir@/mysql-check-upgrade
a41a5b
+ExecStart=@libexecdir@/mysqld-scl-helper enable $@SCL_NAME_UPPER@_SCLS_ENABLED -- @libexecdir@/mysqld --basedir=@prefix@ $MYSQLD_OPTS $_WSREP_NEW_CLUSTER
a41a5b
+ExecStartPost=/usr/bin/scl enable $@SCL_NAME_UPPER@_SCLS_ENABLED -- @libexecdir@/mysql-check-upgrade
a41a5b
 
a41a5b
 # Setting this to true can break replication and the Type=notify settings
a41a5b
 # See also bind-address mysqld option.
a41a5b
diff -up mariadb-10.3.11/scripts/mysql@.service.in.p90 mariadb-10.3.11/scripts/mysql@.service.in
a41a5b
--- mariadb-10.3.11/scripts/mysql@.service.in.p90	2018-12-18 17:45:20.909974156 +0100
a41a5b
+++ mariadb-10.3.11/scripts/mysql@.service.in	2018-12-18 17:45:20.910974165 +0100
a41a5b
@@ -47,13 +47,19 @@ Type=notify
a41a5b
 User=mysql
a41a5b
 Group=mysql
a41a5b
 
a41a5b
-ExecStartPre=@libexecdir@/mysql-check-socket --defaults-group-suffix=.%I
a41a5b
-ExecStartPre=@libexecdir@/mysql-prepare-db-dir --defaults-group-suffix=.%I %n
a41a5b
+# Load collections set to enabled for this service
a41a5b
+EnvironmentFile=@SCL_SCRIPTS@/service-environment
a41a5b
+
a41a5b
+# We want to start server only inside "scl enable" invocation
a41a5b
+ExecStartPre=/usr/bin/scl enable $@SCL_NAME_UPPER@_SCLS_ENABLED -- /usr/bin/scl_enabled @SCL_NAME@
a41a5b
+
a41a5b
+ExecStartPre=/usr/bin/scl enable $@SCL_NAME_UPPER@_SCLS_ENABLED -- @libexecdir@/mysql-check-socket --defaults-group-suffix=.%I
a41a5b
+ExecStartPre=/usr/bin/scl enable $@SCL_NAME_UPPER@_SCLS_ENABLED -- @libexecdir@/mysql-prepare-db-dir --defaults-group-suffix=.%I %n
a41a5b
 # MYSQLD_OPTS here is for users to set in /etc/systemd/system/@DAEMON_NAME@@.service.d/MY_SPECIAL.conf
a41a5b
 # Note: we set --basedir to prevent probes that might trigger SELinux alarms,
a41a5b
 # per bug #547485
a41a5b
-ExecStart=@libexecdir@/mysqld --defaults-group-suffix=.%I --basedir=@prefix@ $MYSQLD_OPTS $_WSREP_NEW_CLUSTER
a41a5b
-ExecStartPost=@libexecdir@/mysql-check-upgrade --defaults-group-suffix=.%I
a41a5b
+ExecStart=@libexecdir@/mysqld-scl-helper enable $@SCL_NAME_UPPER@_SCLS_ENABLED -- @libexecdir@/mysqld --defaults-group-suffix=.%I --basedir=@prefix@ $MYSQLD_OPTS $_WSREP_NEW_CLUSTER
a41a5b
+ExecStartPost=/usr/bin/scl enable $@SCL_NAME_UPPER@_SCLS_ENABLED -- @libexecdir@/mysql-check-upgrade --defaults-group-suffix=.%I
a41a5b
 
a41a5b
 # Setting this to true can break replication and the Type=notify settings
a41a5b
 # See also bind-address mysqld option.