initial commit of file from CVS for smeserver-mysql on Sat Mar 23 16:06:28 AEDT 2024

This commit is contained in:
Trevor Batley
2024-03-23 16:06:28 +11:00
parent 715005ffa3
commit df83d181c9
67 changed files with 2762 additions and 2 deletions

View File

@@ -0,0 +1,3 @@
#! /bin/sh
cd /var/opt/rh/rh-mariadb!!!VER!!!/lib/mysql && find . -type f | xargs rm -f

View File

@@ -0,0 +1,3 @@
#!/bin/sh
exec /bin/rm -f /home/e-smith/db/mariadb!!!VER!!!/*.dump

View File

@@ -0,0 +1,58 @@
#!/bin/sh
# 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.
. /opt/rh/rh-mariadb!!!VER!!!/service-environment
for sclname in $RH_MARIADB!!!VER!!!_SCLS_ENABLED ; do
. /opt/rh/$sclname/enable
export X_SCLS="$X_SCLS $sclname"
done
# we want start daemon only inside "scl enable" invocation
if ! scl_enabled $sclname ; then
echo "Collection $sclname has to be listed in /opt/rh/rh-mariadb!!!VER!!!/service-environment"
exit 1
fi
status=$(/sbin/e-smith/config getprop mariadb status)
fixtables=$(/sbin/e-smith/config getprop mariadb autofixtables || echo "disabled")
if [ "$fixtables" = "enabled" ]; then
/sbin/e-smith/config delprop mariadb failsbackup
fi
failsbackup=$(/sbin/e-smith/config getprop mariadb failsbackup || echo "disabled")
onfailure () {
db=$1
message=""
if [ "$failsbackup" = "enabled" ]; then
exit 1;
message="There was an error trying to dump database $db, please fix this db. We stop there without backups."
echo $message
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 --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 --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
echo $message | /usr/bin/mail -s "error on backup of $db MariaDB database" admin
}
if [ "$status" = "disabled" ]
then
echo "mysqld is disabled - no tables dumped" >&2
exit 0
fi
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 --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

View File

@@ -0,0 +1,17 @@
#!/bin/sh
status=$(/sbin/e-smith/config getprop mariadb!!!VER!!!-mariadb status)
if [ "$status" = "disabled" ]
then
echo "mysqld is disabled - no tables restored" >&2
exit 0
fi
/bin/rm -f /home/e-smith/db/mariadb!!!VER!!!/information_schema.dump
/bin/rm -f /home/e-smith/db/mariadb!!!VER!!!/performance_schema.dump
if [ ! -f /var/opt/rh/rh-mariadb!!!VER!!!/lib/mysql/mysql/user.frm ]
then
for db in $(ls /home/e-smith/db/mariadb!!!VER!!!/*.dump 2> /dev/null | grep -v '/mysql.dump')
do
mv $db /etc/e-smith/sql/init!!!VER!!!/01_$(basename $db .dump).sql
done
fi

View File

@@ -0,0 +1,5 @@
socket=/var/lib/mysql/mariadb!!!VER!!!.sock
{
my $localonly = ${'mariadb!!!VER!!!-mariadb'}{'LocalNetworkingOnly'} || "no";
$OUT = ($localonly eq 'yes') ? "skip-networking" : "skip-networking=0\n# networking is enabled";
}

View File

@@ -0,0 +1,7 @@
{
$OUT = "";
my $localonly = ${'mariadb!!!VER!!!-mariadb'}{'LocalNetworkingOnly'} || "no";
# define port
my $port = ${'mariadb!!!VER!!!-mariadb'}{'port'} || "!!!PORT!!!";
$OUT .= ($localonly eq 'yes') ? "#no port as skip-networking\n" : "port=$port\n";
}

View File

@@ -0,0 +1,84 @@
/* Server Mariadb !!!VER!!! localhost (config:root) [1] */
$i++;
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['connect_type'] = 'socket';
$cfg['Servers'][$i]['socket'] = '!!!SOCKET!!!';
$cfg['Servers'][$i]['compress'] = false;
# standalone or login mode
$scriptname=end(explode('/',$_SERVER['PHP_SELF']));
$scriptpath=str_replace($scriptname,"",$_SERVER['PHP_SELF']);
# standalone login part
{
my $adminaccess = ($phpmyadmin{'adminaccess'} || 'enabled');
my $multiaccess = ($phpmyadmin{'multiaccess'} || 'disabled');
if (("$adminaccess" eq "enabled"))
{
$OUT .="if (\$scriptpath==\"/phpmyadmin/\" && \$_SERVER['PHP_AUTH_USER']=='admin')\n";
$OUT .="{\n";
$OUT .="\$cfg['Servers'][\$i]['auth_type'] = 'config';\n";
$OUT .="\$cfg['Servers'][\$i]['user'] = 'root';\n";
open (PW, "/etc/openldap/ldap.pw")
|| die "Could not read LDAP password.\n";
my $pw = <PW>;
chomp ($pw);
close PW;
$OUT .="\$cfg['Servers'][\$i]['password'] = '$pw';\n";
$OUT .="}";
}
else
{
$OUT .="# standelaone admin configuration disabled";
}
}
# end of standalone login part
# multiuser login part
{
my $adminaccess = ($phpmyadmin{'adminaccess'} || 'enabled');
my $multiaccess = ($phpmyadmin{'multiaccess'} || 'disabled');
$OUT .="\n";
if (("$multiaccess" eq "enabled") && ("$adminaccess" eq "enabled"))
{
$OUT .="if (\$scriptpath==\"/phpmyadmin-multi/\")\n";
$OUT .="{\n";
}
if (("$multiaccess" eq "enabled"))
{
$OUT .="\$cfg['Servers'][\$i]['auth_type'] = 'cookie';\n";
my $secret = ${'httpd-admin'}{TKTAuthSecret} || "34322500-7330-4400-423A-3A00434F5245";
$OUT .="\$cfg['blowfish_secret'] = '$secret';\n";
}
else
{
$OUT .="# multiuser disabled\n";
}
if (("$multiaccess" eq "enabled") && ("$adminaccess" eq "enabled"))
{
$OUT .="}\n";
}
}
# end of multiuser login part
$cfg['Servers'][$i]['controluser'] = "";
$cfg['Servers'][$i]['controlpass'] = "";
$cfg['Servers'][$i]['only_db'] = "";
$cfg['Servers'][$i]['hide_db'] = "";
$cfg['Servers'][$i]['verbose'] = 'Mariadb!!!VER!!!';// here is the name as it appears in phpmyadmin
$cfg['Servers'][$i]['pmadb'] = "";
$cfg['Servers'][$i]['bookmarktable'] = "";
$cfg['Servers'][$i]['relation'] = "";
$cfg['Servers'][$i]['table_info'] = "";
$cfg['Servers'][$i]['table_coords'] = "";
$cfg['Servers'][$i]['pdf_pages'] = "";
$cfg['Servers'][$i]['column_info'] = "";
$cfg['Servers'][$i]['history'] = "";
$cfg['Servers'][$i]['verbose_check'] = TRUE;
$cfg['Servers'][$i]['AllowRoot'] = TRUE;
$cfg['Servers'][$i]['AllowDeny']['order']="";
$cfg['Servers'][$i]['AllowDeny']['rules']= array();
$cfg['Servers'][$i]['AllowNoPassword']= FALSE;
$cfg['Servers'][$i]['designer_coords']= "";
$cfg['Servers'][$i]['bs_garbage_threshold']= 50;
$cfg['Servers'][$i]['bs_repository_threshold']= '32M';
$cfg['Servers'][$i]['bs_temp_blob_timeout']= 600;
$cfg['Servers'][$i]['bs_temp_log_threshold']= '32M';

View File

@@ -0,0 +1,17 @@
/var/log/mariadb!!!VER!!!/*.log {
create 640 mysql mysql
notifempty
daily
rotate 7
missingok
compress
postrotate
# just if mysqld is really running
if test -x /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqladmin && \
/usr/bin/scl enable rh-mariadb!!!VER!!! -- /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqladmin --socket=!!!SOCKET!!! ping &>/dev/null
then
/usr/bin/scl enable rh-mariadb!!!VER!!! -- /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysqladmin --socket=!!!SOCKET!!! --local flush-error-log \
flush-engine-log flush-general-log flush-slow-log
fi
endscript
}