--- rpms/smeserver-mysql/sme10/smeserver-mysql-2.7.0-bz11899-sclo.patch 2022/03/14 05:05:33 1.6 +++ rpms/smeserver-mysql/sme10/smeserver-mysql-2.7.0-bz11899-sclo.patch 2022/03/16 20:10:05 1.10 @@ -112,25 +112,68 @@ diff -Nur --no-dereference smeserver-mys +PERMS=0400 +UID="root" +GID="root" -diff -Nur --no-dereference smeserver-mysql-2.7.0.old/rootscl/sbin/e-smith/systemd/mariadb_VER_-initialize smeserver-mysql-2.7.0/rootscl/sbin/e-smith/systemd/mariadb_VER_-initialize ---- smeserver-mysql-2.7.0.old/rootscl/sbin/e-smith/systemd/mariadb_VER_-initialize 2022-03-14 00:10:47.160000000 -0400 -+++ smeserver-mysql-2.7.0/rootscl/sbin/e-smith/systemd/mariadb_VER_-initialize 2022-03-14 01:01:42.194000000 -0400 -@@ -38,6 +38,8 @@ - if [ !!!VER!!! -le 103 ] - then - /opt/rh/rh-mariadb!!!VER!!!/root/usr/libexec/mysqld --bootstrap --datadir="$datadir" --user="mysql" < /var/lib/mysql/set.password -+ else -+ /opt/rh/rh-mariadb!!!VER!!!/root/usr/libexec/mysqld --bootstrap --datadir="$datadir" --user="mysql" < /var/lib/mysql/set.password2 - fi - # upgrade does not need to be run on a fresh datadir - #echo "5.7.24" >"$datadir/mysql_upgrade_info" -@@ -53,6 +55,9 @@ - if [ !!!VER!!! -le 103 ] - then - /opt/rh/rh-mariadb!!!VER!!!/root/usr/libexec/mysqld --bootstrap --datadir="$datadir" --user="mysql" < /var/lib/mysql/set.password -+ else -+ /opt/rh/rh-mariadb!!!VER!!!/root/usr/libexec/mysqld --bootstrap --datadir="$datadir" --user="mysql" < /var/lib/mysql/set.password2 - fi +diff -Nur --no-dereference smeserver-mysql-2.7.0.old/rootscl/sbin/e-smith/systemd/mariadb_VER_-post smeserver-mysql-2.7.0/rootscl/sbin/e-smith/systemd/mariadb_VER_-post +--- smeserver-mysql-2.7.0.old/rootscl/sbin/e-smith/systemd/mariadb_VER_-post 1969-12-31 19:00:00.000000000 -0500 ++++ smeserver-mysql-2.7.0/rootscl/sbin/e-smith/systemd/mariadb_VER_-post 2022-03-14 02:28:09.537000000 -0400 +@@ -0,0 +1,18 @@ ++#!/bin/bash ++ ++for i in $(seq 1 20); ++do ++ if [ -S !!!SOCKET!!! ] ++ then ++ /usr/bin/mysql!!!VER!!! < /var/lib/mysql/set.password2 ++ echo "root password set" ++ exit 0 ++ fi ++ echo waiting for rh-mariadb105-mariadb to start to set root password ++ sleep 1 ++done ++echo failed to set root password ++# we fail silently, mariadb will still work, only issue is for phpmyadmin ++# and non socket access ++exit 0 + - exit 0 +diff -Nur smeserver-mysql-2.7.0.old/rootscl/etc/e-smith/events/actions/mariadb_VER_-dump-tables smeserver-mysql-2.7.0/rootscl/etc/e-smith/events/actions/mariadb_VER_-dump-tables +--- smeserver-mysql-2.7.0.old/rootscl/etc/e-smith/events/actions/mariadb_VER_-dump-tables 2022-03-12 04:00:37.000000000 +0100 ++++ smeserver-mysql-2.7.0/rootscl/etc/e-smith/events/actions/mariadb_VER_-dump-tables 2022-03-16 08:25:24.372541028 +0100 +@@ -35,12 +35,12 @@ + echo $message | /usr/bin/mail -s "error on backup of $db MariaDB !!!VER!!! database" admin + fi + message="$message \nThere was an error trying to dump database $db, please check for table errors in this db. Forcing a backup of the corrupted DB." +- /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqldump --force --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mariadb!!!VER!!!/"$db"-failed.dump || message="$message \nFailed to force backup of corrupted db $db as $db-failed.dump" >&2 ++ /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqldump --socket=!!!SOCKET!!! --force --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mariadb!!!VER!!!/"$db"-failed.dump || message="$message \nFailed to force backup of corrupted db $db as $db-failed.dump" >&2 + if [ "$fixtables" = "enabled" ]; then + repair="failure" + message="$message \nTrying to auto-repair the db and do a backup after..." +- /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqlcheck -s --auto-repair -c "$db" && \ +- /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqldump --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mariadb!!!VER!!!/"$db".dump && repair="success" ++ /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqlcheck --socket=!!!SOCKET!!! -s --auto-repair -c "$db" && \ ++ /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqldump --socket=!!!SOCKET!!! --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mariadb!!!VER!!!/"$db".dump && repair="success" + message="$message \n => $repair" + fi + echo $message +@@ -52,7 +52,7 @@ + echo "mysqld is disabled - no tables dumped" >&2 + exit 0 fi +-for db in $(/opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysql -BNre "show databases;"|egrep -vi "^information_schema$|^performance_schema$") ++for db in $(/opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysql --socket=!!!SOCKET!!! -BNre "show databases;"|egrep -vi "^information_schema$|^performance_schema$") + do +- /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqldump --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mariadb!!!VER!!!/"$db".dump || onfailure $db ++ /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqldump --socket=!!!SOCKET!!! --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mariadb!!!VER!!!/"$db".dump || onfailure $db + done +diff -Nur --no-dereference smeserver-mysql-2.7.0.old/rootscl/usr/lib/systemd/system/mariadb_VER_-mysql.init.service smeserver-mysql-2.7.0/rootscl/usr/lib/systemd/system/mariadb_VER_-mysql.init.service +--- smeserver-mysql-2.7.0.old/rootscl/usr/lib/systemd/system/mariadb_VER_-mysql.init.service 2022-03-16 16:01:25.209000000 -0400 ++++ smeserver-mysql-2.7.0/rootscl/usr/lib/systemd/system/mariadb_VER_-mysql.init.service 2022-03-11 15:26:08.000000000 -0500 +@@ -12,8 +12,8 @@ + KillMode=process + GuessMainPID=no + RemainAfterExit=yes ++ExecStart=/sbin/e-smith/systemd/mariadb!!!VER!!!-mysql.init start ++ExecStop=/sbin/e-smith/systemd/mariadb!!!VER!!!-mysql.init stop +-ExecStart=/sbin/e-smith/systemd/mariadb!!!VER!!!-mariadb.init start +-ExecStop=/sbin/e-smith/systemd/mariadb!!!VER!!!-mariadb.init stop + + [Install] + WantedBy=sme-server.target