diff -up mariadb-10.2.8/scripts/mysqld_safe.sh.p90 mariadb-10.2.8/scripts/mysqld_safe.sh --- mariadb-10.2.8/scripts/mysqld_safe.sh.p90 2017-08-17 12:05:39.000000000 +0200 +++ mariadb-10.2.8/scripts/mysqld_safe.sh 2017-09-21 21:47:46.128058738 +0200 @@ -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 -up mariadb-10.2.8/scripts/mysql.init.in_patched mariadb-10.2.8/scripts/mysql.init.in --- mariadb-10.2.8/scripts/mysql.init.in_patched 2019-04-16 15:21:21.507306567 +0200 +++ mariadb-10.2.8/scripts/mysql.init.in 2019-04-16 14:53:08.519336544 +0200 @@ -104,7 +104,7 @@ start(){ @libexecdir@/mysql-check-socket || return 1 # KNOWN ISSUE: Per standard, following line should return '1' on error # Leaving '4' for behaviour compatibility with released versions of this script - su - $MYUSER -s /bin/bash -c "@libexecdir@/mysql-prepare-db-dir $MYUSER $MYGROUP" || return 4 + su - $MYUSER -s /bin/bash -c "scl enable @SCL_NAME@ -- @libexecdir@/mysql-prepare-db-dir $MYUSER $MYGROUP" || return 4 # Pass all the options determined above, to ensure consistent behavior. # In many cases mysqld_safe would arrive at the same conclusions anyway @@ -113,13 +113,13 @@ start(){ # and some users might prefer to configure logging to syslog.) # Note: set --basedir to prevent probes that might trigger SELinux # alarms, per bug #547485 - su - $MYUSER -s /bin/bash -c "$exec --datadir='$datadir' --socket='$socketfile' \ + su - $MYUSER -s /bin/bash -c "scl enable @SCL_NAME@ -- $exec --datadir='$datadir' --socket='$socketfile' \ --pid-file='$pidfile' $MYSQLD_OPTS $_WSREP_NEW_CLUSTER \ --basedir=@prefix@ --user=$MYUSER" >/dev/null 2>&1 & safe_pid=$! # Wait until the daemon is up - su - $MYUSER -s /bin/bash -c "@libexecdir@/mysql-wait-ready '$safe_pid'" + su - $MYUSER -s /bin/bash -c "scl enable @SCL_NAME@ -- @libexecdir@/mysql-wait-ready '$safe_pid'" ret=$? if [ $ret -eq 0 ]; then @@ -197,6 +197,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 $@SCL_NAME_UPPER@_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 -up mariadb-10.2.8/scripts/mysql_install_db.sh.p90 mariadb-10.2.8/scripts/mysql_install_db.sh --- mariadb-10.2.8/scripts/mysql_install_db.sh.p90 2017-09-21 21:47:46.095058650 +0200 +++ mariadb-10.2.8/scripts/mysql_install_db.sh 2017-09-21 21:47:46.129058741 +0200 @@ -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@" --- mariadb-10.2.17/scripts/mysql_install_db.sh 2018-08-12 13:29:50.000000000 +0200 +++ mariadb-10.2.17/scripts/mysql_install_db.sh_patched 2018-09-09 05:18:41.193087156 +0200 @@ -497,16 +497,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> $0 --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-tables --general-log &" + echo " shell> su -s /bin/bash - mysql -c 'scl enable @SCL_NAME@ -- $mysqld --skip-grant-tables --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" @@ -526,10 +526,6 @@ 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" - if test "$auth_root_authentication_method" = normal then echo @@ -537,11 +533,11 @@ then 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" @@ -559,7 +555,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 -up mariadb-10.2.8/scripts/mysql.service.in.p90 mariadb-10.2.8/scripts/mysql.service.in --- mariadb-10.2.8/scripts/mysql.service.in.p90 2017-09-21 21:47:46.123058725 +0200 +++ mariadb-10.2.8/scripts/mysql.service.in 2017-09-21 21:47:46.129058741 +0200 @@ -33,14 +33,20 @@ Type=notify User=mysql Group=mysql -ExecStartPre=@libexecdir@/mysql-check-socket +# 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 $@SCL_NAME_UPPER@_SCLS_ENABLED -- /usr/bin/scl_enabled @SCL_NAME@ + +ExecStartPre=/usr/bin/scl enable $@SCL_NAME_UPPER@_SCLS_ENABLED -- @libexecdir@/mysql-check-socket # '%n' expands to 'Full unit name'; man systemd.unit -ExecStartPre=@libexecdir@/mysql-prepare-db-dir %n +ExecStartPre=/usr/bin/scl enable $@SCL_NAME_UPPER@_SCLS_ENABLED -- @libexecdir@/mysql-prepare-db-dir %n # MYSQLD_OPTS here is for users to set in /etc/systemd/system/@DAEMON_NAME@@.service.d/MY_SPECIAL.conf # Note: we set --basedir to prevent probes that might trigger SELinux alarms, # per bug #547485 -ExecStart=@libexecdir@/mysqld --basedir=@prefix@ $MYSQLD_OPTS $_WSREP_NEW_CLUSTER -ExecStartPost=@libexecdir@/mysql-check-upgrade +ExecStart=@libexecdir@/mysqld-scl-helper enable $@SCL_NAME_UPPER@_SCLS_ENABLED -- @libexecdir@/mysqld --basedir=@prefix@ $MYSQLD_OPTS $_WSREP_NEW_CLUSTER +ExecStartPost=/usr/bin/scl enable $@SCL_NAME_UPPER@_SCLS_ENABLED -- @libexecdir@/mysql-check-upgrade # Setting this to true can break replication and the Type=notify settings # See also bind-address mysqld option. diff -up mariadb-10.2.8/scripts/mysql@.service.in.p90 mariadb-10.2.8/scripts/mysql@.service.in --- mariadb-10.2.8/scripts/mysql@.service.in.p90 2017-09-21 21:47:46.125058730 +0200 +++ mariadb-10.2.8/scripts/mysql@.service.in 2017-09-21 21:47:46.129058741 +0200 @@ -40,13 +40,19 @@ Type=notify User=mysql Group=mysql -ExecStartPre=@libexecdir@/mysql-check-socket --defaults-group-suffix=.%I -ExecStartPre=@libexecdir@/mysql-prepare-db-dir --defaults-group-suffix=.%I %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 $@SCL_NAME_UPPER@_SCLS_ENABLED -- /usr/bin/scl_enabled @SCL_NAME@ + +ExecStartPre=/usr/bin/scl enable $@SCL_NAME_UPPER@_SCLS_ENABLED -- @libexecdir@/mysql-check-socket --defaults-group-suffix=.%I +ExecStartPre=/usr/bin/scl enable $@SCL_NAME_UPPER@_SCLS_ENABLED -- @libexecdir@/mysql-prepare-db-dir --defaults-group-suffix=.%I %n # MYSQLD_OPTS here is for users to set in /etc/systemd/system/@DAEMON_NAME@@.service.d/MY_SPECIAL.conf # Note: we set --basedir to prevent probes that might trigger SELinux alarms, # per bug #547485 -ExecStart=@libexecdir@/mysqld --defaults-group-suffix=.%I --basedir=@prefix@ $MYSQLD_OPTS $_WSREP_NEW_CLUSTER -ExecStartPost=@libexecdir@/mysql-check-upgrade --defaults-group-suffix=.%I +ExecStart=@libexecdir@/mysqld-scl-helper enable $@SCL_NAME_UPPER@_SCLS_ENABLED -- @libexecdir@/mysqld --defaults-group-suffix=.%I --basedir=@prefix@ $MYSQLD_OPTS $_WSREP_NEW_CLUSTER +ExecStartPost=/usr/bin/scl enable $@SCL_NAME_UPPER@_SCLS_ENABLED -- @libexecdir@/mysql-check-upgrade --defaults-group-suffix=.%I # Setting this to true can break replication and the Type=notify settings # See also bind-address mysqld option. diff -up mariadb-10.2.8/support-files/mysql-log-rotate.sh.p90 mariadb-10.2.8/support-files/mysql-log-rotate.sh --- mariadb-10.2.8/support-files/mysql-log-rotate.sh.p90 2017-09-21 21:47:46.084058621 +0200 +++ mariadb-10.2.8/support-files/mysql-log-rotate.sh 2017-09-21 21:47:46.129058741 +0200 @@ -29,9 +29,9 @@ # postrotate # # just if mysqld is really running # if test -x @bindir@/mysqladmin && \ -# @bindir@/mysqladmin ping &>/dev/null +# /usr/bin/scl enable @SCL_NAME@ -- @bindir@/mysqladmin ping &>/dev/null # then -# @bindir@/mysqladmin --local flush-error-log \ +# /usr/bin/scl enable @SCL_NAME@ -- @bindir@/mysqladmin --local flush-error-log \ # flush-engine-log flush-general-log flush-slow-log # fi # endscript