1 |
jpp |
1.1 |
diff -Nur --no-dereference smeserver-mysql-2.7.0.old/rootscl/etc/logrotate.d/mariadb_VER_ smeserver-mysql-2.7.0/rootscl/etc/logrotate.d/mariadb_VER_ |
2 |
|
|
--- smeserver-mysql-2.7.0.old/rootscl/etc/logrotate.d/mariadb_VER_ 2022-03-11 21:34:28.000000000 -0500 |
3 |
|
|
+++ smeserver-mysql-2.7.0/rootscl/etc/logrotate.d/mariadb_VER_ 2022-03-13 01:33:07.924000000 -0500 |
4 |
|
|
@@ -7,10 +7,10 @@ |
5 |
|
|
compress |
6 |
|
|
postrotate |
7 |
|
|
# just if mysqld is really running |
8 |
|
|
- if test -x /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqladmin && \ |
9 |
|
|
- /usr/bin/scl enable rh-mariadb!!!VER!!! -- /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqladmin ping &>/dev/null |
10 |
|
|
+ if test -x /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqladmin && \ |
11 |
|
|
+ /usr/bin/scl enable rh-mariadb!!!VER!!! -- /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqladmin --socket=!!!SOCKET!!! ping &>/dev/null |
12 |
|
|
then |
13 |
|
|
- /usr/bin/scl enable rh-mariadb!!!VER!!! -- /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqladmin --local flush-error-log \ |
14 |
|
|
+ /usr/bin/scl enable rh-mariadb!!!VER!!! -- /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqladmin --socket=!!!SOCKET!!! --local flush-error-log \ |
15 |
|
|
flush-engine-log flush-general-log flush-slow-log |
16 |
|
|
fi |
17 |
|
|
endscript |
18 |
jpp |
1.5 |
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 |
19 |
|
|
--- smeserver-mysql-2.7.0.old/rootscl/sbin/e-smith/systemd/mariadb_VER_-initialize 2022-03-12 00:27:43.000000000 -0500 |
20 |
|
|
+++ smeserver-mysql-2.7.0/rootscl/sbin/e-smith/systemd/mariadb_VER_-initialize 2022-03-13 01:24:53.334000000 -0500 |
21 |
|
|
@@ -34,8 +34,11 @@ |
22 |
|
|
fi |
23 |
|
|
exit $ret |
24 |
|
|
fi |
25 |
|
|
- # set root password |
26 |
|
|
- /opt/rh/rh-mariadb!!!VER!!!/root/usr/libexec/mysqld --bootstrap --datadir="$datadir" --user="mysql" < /var/lib/mysql/set.password |
27 |
|
|
+ # set root password , 104 and above have a different syntax and allow root passwordless access |
28 |
|
|
+ if [ !!!VER!!! -le 103 ] |
29 |
|
|
+ then |
30 |
jcrisp |
1.11 |
+ /opt/rh/rh-mariadb!!!VER!!!/root/usr/libexec/mysqld --bootstrap --datadir="$datadir" --user="mysql" < /var/lib/mysql/set.password2 |
31 |
jpp |
1.5 |
+ fi |
32 |
|
|
# upgrade does not need to be run on a fresh datadir |
33 |
|
|
#echo "5.7.24" >"$datadir/mysql_upgrade_info" |
34 |
|
|
# In case we're running as root, make sure files are owned properly |
35 |
|
|
@@ -46,7 +49,10 @@ |
36 |
|
|
/sbin/e-smith/expand-template /etc/e-smith/sql/init!!!VER!!!/00_restore_dumped_dbs |
37 |
|
|
fi |
38 |
|
|
else |
39 |
|
|
- # else we set root password anyway ! just to be sure ! |
40 |
|
|
- /opt/rh/rh-mariadb!!!VER!!!/root/usr/libexec/mysqld --bootstrap --datadir="$datadir" --user="mysql" < /var/lib/mysql/set.password |
41 |
|
|
- |
42 |
|
|
+ # else we set root password anyway ! just to be sure ! 104 and above have a different syntax and allow root passwordless access |
43 |
|
|
+ if [ !!!VER!!! -le 103 ] |
44 |
|
|
+ then |
45 |
jcrisp |
1.11 |
+ /opt/rh/rh-mariadb!!!VER!!!/root/usr/libexec/mysqld --bootstrap --datadir="$datadir" --user="mysql" < /var/lib/mysql/set.password2 |
46 |
jpp |
1.5 |
+ fi |
47 |
|
|
+ exit 0 |
48 |
|
|
fi |
49 |
jpp |
1.2 |
diff -Nur --no-dereference smeserver-mysql-2.7.0.old/rootscl/etc/e-smith/templates/etc/phpMyAdmin/config.inc.php/11configMysql_VER_ smeserver-mysql-2.7.0/rootscl/etc/e-smith/templates/etc/phpMyAdmin/config.inc.php/11configMysql_VER_ |
50 |
|
|
--- smeserver-mysql-2.7.0.old/rootscl/etc/e-smith/templates/etc/phpMyAdmin/config.inc.php/11configMysql_VER_ 2022-03-12 16:39:10.000000000 -0500 |
51 |
|
|
+++ smeserver-mysql-2.7.0/rootscl/etc/e-smith/templates/etc/phpMyAdmin/config.inc.php/11configMysql_VER_ 2022-03-13 21:14:10.966000000 -0400 |
52 |
|
|
@@ -3,7 +3,7 @@ |
53 |
|
|
$cfg['Servers'][$i]['host'] = 'localhost'; |
54 |
|
|
$cfg['Servers'][$i]['extension'] = 'mysqli'; |
55 |
|
|
$cfg['Servers'][$i]['connect_type'] = 'socket'; |
56 |
|
|
-$cfg['Servers'][$i]['socket'] = '/var/lib/mysql/mariadb!!!VER!!!.sock'; |
57 |
|
|
+$cfg['Servers'][$i]['socket'] = '!!!SOCKET!!!'; |
58 |
|
|
$cfg['Servers'][$i]['compress'] = false; |
59 |
|
|
# standalone or login mode |
60 |
|
|
$scriptname=end(explode('/',$_SERVER['PHP_SELF'])); |
61 |
|
|
diff -Nur --no-dereference smeserver-mysql-2.7.0.old/rootscl/sbin/e-smith/systemd/mariadb_VER_-mysql.init smeserver-mysql-2.7.0/rootscl/sbin/e-smith/systemd/mariadb_VER_-mysql.init |
62 |
|
|
--- smeserver-mysql-2.7.0.old/rootscl/sbin/e-smith/systemd/mariadb_VER_-mysql.init 2022-03-11 20:43:05.000000000 -0500 |
63 |
|
|
+++ smeserver-mysql-2.7.0/rootscl/sbin/e-smith/systemd/mariadb_VER_-mysql.init 2022-03-13 21:13:39.386000000 -0400 |
64 |
|
|
@@ -52,7 +52,7 @@ |
65 |
|
|
|
66 |
|
|
for i in $(seq 1 10) |
67 |
|
|
do |
68 |
|
|
- if test -e /var/lib/mysql/mariadb!!!VER!!!.sock |
69 |
|
|
+ if test -e !!!SOCKET!!! |
70 |
|
|
then |
71 |
|
|
exit_value=0 |
72 |
|
|
HOME=/root |
73 |
jpp |
1.6 |
diff -Nur --no-dereference smeserver-mysql-2.7.0.old/createlinks smeserver-mysql-2.7.0/createlinks |
74 |
|
|
--- smeserver-mysql-2.7.0.old/createlinks 2022-03-12 16:41:41.000000000 -0500 |
75 |
|
|
+++ smeserver-mysql-2.7.0/createlinks 2022-03-14 00:59:46.386000000 -0400 |
76 |
|
|
@@ -113,6 +113,7 @@ |
77 |
|
|
templates2events("/etc/my.cnf", $event); |
78 |
|
|
templates2events("/root/.my.cnf", $event); |
79 |
|
|
templates2events("/var/lib/mysql/set.password", $event); |
80 |
|
|
+templates2events("/var/lib/mysql/set.password2", $event); |
81 |
|
|
templates2events("/etc/phpMyAdmin/config.inc.php", $event); |
82 |
|
|
templates2events("/etc/opt/rh/rh-mariadb$_/my.cnf", $event); |
83 |
|
|
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mariadb$_-mariadb"); |
84 |
|
|
diff -Nur --no-dereference smeserver-mysql-2.7.0.old/root/etc/e-smith/templates/var/lib/mysql/set.password smeserver-mysql-2.7.0/root/etc/e-smith/templates/var/lib/mysql/set.password |
85 |
|
|
--- smeserver-mysql-2.7.0.old/root/etc/e-smith/templates/var/lib/mysql/set.password 2022-03-11 10:32:13.000000000 -0500 |
86 |
|
|
+++ smeserver-mysql-2.7.0/root/etc/e-smith/templates/var/lib/mysql/set.password 2022-03-14 00:55:17.357000000 -0400 |
87 |
|
|
@@ -6,6 +6,7 @@ |
88 |
|
|
$OUT .= "use mysql;\n"; |
89 |
|
|
$OUT .= "ALTER TABLE user MODIFY Password char(41) NOT NULL default '';\n"; |
90 |
|
|
$OUT .= "UPDATE user SET password=password('$pw') WHERE user='root';\n"; |
91 |
|
|
+ $OUT .= "DELETE FROM db WHERE user='';\n"; |
92 |
|
|
$OUT .= "DELETE FROM user WHERE user='';\n"; |
93 |
|
|
$OUT .= "FLUSH PRIVILEGES;\n"; |
94 |
|
|
} |
95 |
|
|
diff -Nur --no-dereference smeserver-mysql-2.7.0.old/root/etc/e-smith/templates/var/lib/mysql/set.password2 smeserver-mysql-2.7.0/root/etc/e-smith/templates/var/lib/mysql/set.password2 |
96 |
|
|
--- smeserver-mysql-2.7.0.old/root/etc/e-smith/templates/var/lib/mysql/set.password2 1969-12-31 19:00:00.000000000 -0500 |
97 |
|
|
+++ smeserver-mysql-2.7.0/root/etc/e-smith/templates/var/lib/mysql/set.password2 2022-03-14 00:54:10.293000000 -0400 |
98 |
|
|
@@ -0,0 +1,9 @@ |
99 |
|
|
+{ |
100 |
|
|
+ use esmith::util; |
101 |
|
|
+ |
102 |
|
|
+ my $pw = esmith::util::LdapPassword(); |
103 |
|
|
+ |
104 |
|
|
+ $OUT .= "use mysql;\n"; |
105 |
|
|
+ $OUT .= "SET PASSWORD FOR 'root'\@localhost = PASSWORD(\"$pw\"); \n"; |
106 |
|
|
+ $OUT .= "FLUSH PRIVILEGES;\n"; |
107 |
|
|
+} |
108 |
|
|
diff -Nur --no-dereference smeserver-mysql-2.7.0.old/root/etc/e-smith/templates.metadata/var/lib/mysql/set.password2 smeserver-mysql-2.7.0/root/etc/e-smith/templates.metadata/var/lib/mysql/set.password2 |
109 |
|
|
--- smeserver-mysql-2.7.0.old/root/etc/e-smith/templates.metadata/var/lib/mysql/set.password2 1969-12-31 19:00:00.000000000 -0500 |
110 |
|
|
+++ smeserver-mysql-2.7.0/root/etc/e-smith/templates.metadata/var/lib/mysql/set.password2 2022-03-14 00:58:28.856000000 -0400 |
111 |
|
|
@@ -0,0 +1,3 @@ |
112 |
|
|
+PERMS=0400 |
113 |
|
|
+UID="root" |
114 |
|
|
+GID="root" |
115 |
jpp |
1.7 |
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 |
116 |
|
|
--- smeserver-mysql-2.7.0.old/rootscl/sbin/e-smith/systemd/mariadb_VER_-post 1969-12-31 19:00:00.000000000 -0500 |
117 |
|
|
+++ smeserver-mysql-2.7.0/rootscl/sbin/e-smith/systemd/mariadb_VER_-post 2022-03-14 02:28:09.537000000 -0400 |
118 |
|
|
@@ -0,0 +1,18 @@ |
119 |
|
|
+#!/bin/bash |
120 |
|
|
+ |
121 |
|
|
+for i in $(seq 1 20); |
122 |
|
|
+do |
123 |
|
|
+ if [ -S !!!SOCKET!!! ] |
124 |
|
|
+ then |
125 |
|
|
+ /usr/bin/mysql!!!VER!!! < /var/lib/mysql/set.password2 |
126 |
|
|
+ echo "root password set" |
127 |
|
|
+ exit 0 |
128 |
|
|
+ fi |
129 |
|
|
+ echo waiting for rh-mariadb105-mariadb to start to set root password |
130 |
|
|
+ sleep 1 |
131 |
|
|
+done |
132 |
|
|
+echo failed to set root password |
133 |
|
|
+# we fail silently, mariadb will still work, only issue is for phpmyadmin |
134 |
|
|
+# and non socket access |
135 |
|
|
+exit 0 |
136 |
jpp |
1.6 |
+ |
137 |
jpp |
1.8 |
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 |
138 |
|
|
--- smeserver-mysql-2.7.0.old/rootscl/etc/e-smith/events/actions/mariadb_VER_-dump-tables 2022-03-12 04:00:37.000000000 +0100 |
139 |
|
|
+++ smeserver-mysql-2.7.0/rootscl/etc/e-smith/events/actions/mariadb_VER_-dump-tables 2022-03-16 08:25:24.372541028 +0100 |
140 |
|
|
@@ -35,12 +35,12 @@ |
141 |
|
|
echo $message | /usr/bin/mail -s "error on backup of $db MariaDB !!!VER!!! database" admin |
142 |
|
|
fi |
143 |
|
|
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." |
144 |
|
|
- /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 |
145 |
|
|
+ /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 |
146 |
|
|
if [ "$fixtables" = "enabled" ]; then |
147 |
|
|
repair="failure" |
148 |
|
|
message="$message \nTrying to auto-repair the db and do a backup after..." |
149 |
|
|
- /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqlcheck -s --auto-repair -c "$db" && \ |
150 |
|
|
- /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" |
151 |
|
|
+ /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqlcheck --socket=!!!SOCKET!!! -s --auto-repair -c "$db" && \ |
152 |
|
|
+ /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" |
153 |
|
|
message="$message \n => $repair" |
154 |
|
|
fi |
155 |
|
|
echo $message |
156 |
|
|
@@ -52,7 +52,7 @@ |
157 |
|
|
echo "mysqld is disabled - no tables dumped" >&2 |
158 |
|
|
exit 0 |
159 |
|
|
fi |
160 |
|
|
-for db in $(/opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysql -BNre "show databases;"|egrep -vi "^information_schema$|^performance_schema$") |
161 |
|
|
+for db in $(/opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysql --socket=!!!SOCKET!!! -BNre "show databases;"|egrep -vi "^information_schema$|^performance_schema$") |
162 |
|
|
do |
163 |
|
|
- /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 |
164 |
|
|
+ /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 |
165 |
|
|
done |
166 |
jpp |
1.9 |
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 |
167 |
|
|
--- smeserver-mysql-2.7.0.old/rootscl/usr/lib/systemd/system/mariadb_VER_-mysql.init.service 2022-03-16 16:01:25.209000000 -0400 |
168 |
|
|
+++ smeserver-mysql-2.7.0/rootscl/usr/lib/systemd/system/mariadb_VER_-mysql.init.service 2022-03-11 15:26:08.000000000 -0500 |
169 |
|
|
@@ -12,8 +12,8 @@ |
170 |
|
|
KillMode=process |
171 |
|
|
GuessMainPID=no |
172 |
|
|
RemainAfterExit=yes |
173 |
jpp |
1.10 |
+ExecStart=/sbin/e-smith/systemd/mariadb!!!VER!!!-mysql.init start |
174 |
|
|
+ExecStop=/sbin/e-smith/systemd/mariadb!!!VER!!!-mysql.init stop |
175 |
|
|
-ExecStart=/sbin/e-smith/systemd/mariadb!!!VER!!!-mariadb.init start |
176 |
|
|
-ExecStop=/sbin/e-smith/systemd/mariadb!!!VER!!!-mariadb.init stop |
177 |
jpp |
1.9 |
|
178 |
|
|
[Install] |
179 |
|
|
WantedBy=sme-server.target |