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

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