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' && \
261253
-    systemctl restart ${1:-mariadb}
261253
+    systemctl restart ${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=
e7095a
diff -up mariadb-10.5.11-downstream_modified/scripts/mysql_install_db.sh.old mariadb-10.5.11-downstream_modified/scripts/mysql_install_db.sh
e7095a
--- mariadb-10.5.11-downstream_modified/scripts/mysql_install_db.sh.old	2021-08-24 12:53:01.750421887 +0200
e7095a
+++ mariadb-10.5.11-downstream_modified/scripts/mysql_install_db.sh	2021-08-24 12:56:28.256855656 +0200
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@"
4f2a65
@@ -593,16 +599,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
4f2a65
   echo "You can also try to start the mariadbd 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
4f2a65
   echo "and use the command line tool $bindir/mariadb"
a41a5b
   echo "to connect to the mysql database and look at the grant tables:"
a41a5b
   echo
4f2a65
-  echo "    shell> $bindir/mariadb -u root mysql"
a41a5b
+  echo "    shell> su -s /bin/bash - mysql -c 'scl enable @SCL_NAME@ -- $bindir/mysql -u root mysql''"
4f2a65
   echo "    MariaDB> show tables;"
a41a5b
   echo
4f2a65
   echo "Try '$mysqld --help' if you have problems with paths.  Using"
4f2a65
@@ -622,10 +628,6 @@ fi
a41a5b
 # the screen.
a41a5b
 if test "$cross_bootstrap" -eq 0 && test -z "$srcdir"
a41a5b
 then
a41a5b
-  s_echo
4f2a65
-  s_echo "To start mariadbd at boot time you have to copy"
4f2a65
-  s_echo "support-files/mariadb.service to the right place for your system"
a41a5b
-
a41a5b
   if test "$auth_root_authentication_method" = normal
a41a5b
   then
a41a5b
     echo
4f2a65
@@ -633,7 +635,7 @@ then
a41a5b
     echo "PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !"
e7095a
     echo "To do so, start the server, then issue the following command:"
a41a5b
     echo
4f2a65
-    echo "'$bindir/mariadb-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"
4f2a65
@@ -659,8 +661,8 @@ then
4f2a65
     echo "You can start the MariaDB daemon with:"
4f2a65
     echo "cd '$basedir' ; $bindir/mariadb-safe --datadir='$ldata'"
a41a5b
     echo
4f2a65
-    echo "You can test the MariaDB daemon with mysql-test-run.pl"
4f2a65
-    echo "cd '$basedir/@INSTALL_MYSQLTESTDIR@' ; perl mariadb-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.