diff -Nur e-smith-mysql-2.6.0.old/createlinks e-smith-mysql-2.6.0/createlinks --- e-smith-mysql-2.6.0.old/createlinks 2020-12-07 21:55:44.804000000 -0500 +++ e-smith-mysql-2.6.0/createlinks 2020-12-07 22:15:38.989000000 -0500 @@ -33,7 +33,7 @@ foreach (qw( /etc/my.cnf /root/.my.cnf - /var/service/mariadb/set.password + /var/lib/mysql/set.password )) { templates2events("$_", $event); @@ -52,11 +52,6 @@ templates2events("/etc/e-smith/sql/init/10mysql_upgrade", "bootstrap-console-save"); -safe_touch("root/var/service/mariadb/down"); -safe_symlink("/var/service/mariadb", "root/service/mariadb"); -safe_symlink("../daemontools", "root/etc/rc.d/init.d/supervise/mariadb"); -service_link_enhanced("mariadb", 50, 7); - #-------------------------------------------------- # actions for e-smith-mysql-update event #-------------------------------------------------- @@ -65,7 +60,7 @@ foreach (qw( /etc/my.cnf /root/.my.cnf - /var/service/mariadb/set.password + /var/lib/mysql/set.password )) { templates2events("$_", $event); diff -Nur e-smith-mysql-2.6.0.old/root/etc/e-smith/templates/var/lib/mysql/set.password e-smith-mysql-2.6.0/root/etc/e-smith/templates/var/lib/mysql/set.password --- e-smith-mysql-2.6.0.old/root/etc/e-smith/templates/var/lib/mysql/set.password 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-mysql-2.6.0/root/etc/e-smith/templates/var/lib/mysql/set.password 2020-12-07 21:55:44.773000000 -0500 @@ -0,0 +1,11 @@ +{ + use esmith::util; + + my $pw = esmith::util::LdapPassword(); + + $OUT .= "use mysql;\n"; + $OUT .= "ALTER TABLE user MODIFY Password char(41) NOT NULL default '';\n"; + $OUT .= "UPDATE user SET password=password('$pw') WHERE user='root';\n"; + $OUT .= "DELETE FROM user WHERE user='';\n"; + $OUT .= "FLUSH PRIVILEGES;\n"; +} diff -Nur e-smith-mysql-2.6.0.old/root/etc/e-smith/templates/var/service/mariadb/set.password e-smith-mysql-2.6.0/root/etc/e-smith/templates/var/service/mariadb/set.password --- e-smith-mysql-2.6.0.old/root/etc/e-smith/templates/var/service/mariadb/set.password 2020-12-07 21:55:44.773000000 -0500 +++ e-smith-mysql-2.6.0/root/etc/e-smith/templates/var/service/mariadb/set.password 1969-12-31 19:00:00.000000000 -0500 @@ -1,11 +0,0 @@ -{ - use esmith::util; - - my $pw = esmith::util::LdapPassword(); - - $OUT .= "use mysql;\n"; - $OUT .= "ALTER TABLE user MODIFY Password char(41) NOT NULL default '';\n"; - $OUT .= "UPDATE user SET password=password('$pw') WHERE user='root';\n"; - $OUT .= "DELETE FROM user WHERE user='';\n"; - $OUT .= "FLUSH PRIVILEGES;\n"; -} diff -Nur e-smith-mysql-2.6.0.old/root/etc/e-smith/templates.metadata/var/lib/mysql/set.password e-smith-mysql-2.6.0/root/etc/e-smith/templates.metadata/var/lib/mysql/set.password --- e-smith-mysql-2.6.0.old/root/etc/e-smith/templates.metadata/var/lib/mysql/set.password 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-mysql-2.6.0/root/etc/e-smith/templates.metadata/var/lib/mysql/set.password 2020-12-07 22:07:30.287000000 -0500 @@ -0,0 +1,3 @@ +PERMS=0400 +UID="root" +GID="root" diff -Nur e-smith-mysql-2.6.0.old/root/etc/e-smith/templates.metadata/var/service/mariadb/set.password e-smith-mysql-2.6.0/root/etc/e-smith/templates.metadata/var/service/mariadb/set.password --- e-smith-mysql-2.6.0.old/root/etc/e-smith/templates.metadata/var/service/mariadb/set.password 2020-12-07 21:55:44.773000000 -0500 +++ e-smith-mysql-2.6.0/root/etc/e-smith/templates.metadata/var/service/mariadb/set.password 1969-12-31 19:00:00.000000000 -0500 @@ -1 +0,0 @@ -PERMS=0400 diff -Nur e-smith-mysql-2.6.0.old/root/sbin/e-smith/systemd/mariadb-initialize e-smith-mysql-2.6.0/root/sbin/e-smith/systemd/mariadb-initialize --- e-smith-mysql-2.6.0.old/root/sbin/e-smith/systemd/mariadb-initialize 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-mysql-2.6.0/root/sbin/e-smith/systemd/mariadb-initialize 2020-12-07 22:03:28.381000000 -0500 @@ -0,0 +1,14 @@ +#! /bin/sh + +exec 2>&1 +if [ ! -f /var/lib/mysql/mysql/user.frm ] +then + setuidgid mysql sh /usr/bin/mysql_install_db + /usr/libexec/mysqld --bootstrap --user=mysql --skip-grant-tables < /var/lib/mysql/set.password + if [ -f /home/e-smith/db/mysql/mysql.dump ] + then + /sbin/e-smith/expand-template /etc/e-smith/sql/init/00_restore_dumped_dbs + fi +else + /usr/libexec/mysqld --bootstrap --user=mysql --skip-grant-tables < /var/lib/mysql/set.password +fi diff -Nur e-smith-mysql-2.6.0.old/root/usr/lib/systemd/system/mariadb.service.d/50koozali.conf e-smith-mysql-2.6.0/root/usr/lib/systemd/system/mariadb.service.d/50koozali.conf --- e-smith-mysql-2.6.0.old/root/usr/lib/systemd/system/mariadb.service.d/50koozali.conf 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-mysql-2.6.0/root/usr/lib/systemd/system/mariadb.service.d/50koozali.conf 2020-12-07 21:59:46.298000000 -0500 @@ -0,0 +1,43 @@ +[Unit] +Description=MariaDB database server +After=syslog.target +After=network.target + +[Service] +Type=simple +User=root +Group=root + +#reset +ExecStartPre= +#ours : we need root user as + and ! are not yet supported +ExecStartPre=-/sbin/e-smith/service-status mariadb +ExecStartPre=-/sbin/e-smith/expand-template /var/lib/mysql/set.password +ExecStartPre=-/sbin/e-smith/expand-template /root/.my.cnf +ExecStartPre=-/sbin/e-smith/expand-template /etc/my.cnf +ExecStartPre=/sbin/e-smith/systemd/mariadb-initialize + +#reset +ExecStart= +#ours +ExecStart=/usr/libexec/mysqld \ + --defaults-file=/etc/my.cnf \ + --basedir=/usr \ + --datadir=/var/lib/mysql \ + --user=mysql \ + --pid-file=/var/run/mariadb/mariadb.pid + +#reset +ExecStartPost= +#ours +ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID + +# Give a reasonable amount of time for the server to start up/shut down +TimeoutSec=300 + +# Place temp files in a secure directory, not /tmp +PrivateTmp=true + +[Install] +WantedBy=sme-server.target +