Switch to MySQL
This commit is contained in:
parent
fe0bcfec3c
commit
27aca44d5c
|
@ -4,6 +4,7 @@ use esmith::Build::CreateLinks qw(:all);
|
|||
|
||||
# Templates to expand
|
||||
templates2events("/etc/dl.php", qw(bootstrap-console-save webapps-update));
|
||||
templates2events("/etc/e-smith/sql/init/dl", qw(bootstrap-console-save webapps-update));
|
||||
|
||||
# PHP header and footer
|
||||
safe_symlink("/etc/e-smith/templates-default/template-begin-php", "root/etc/e-smith/templates/etc/dl.php/template-begin");
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
my $db = $dl{'DbName'} || 'dl';
|
||||
my $user = $dl{'DbUser'} || 'dl';
|
||||
my $pass = $dl{'DbPassword'} || 'secret';
|
||||
|
||||
my $dbstruct = `rpm -qd dl | grep mysql.sql`;
|
||||
|
||||
$OUT .= <<"END";
|
||||
#! /bin/sh
|
||||
if [ ! -d /var/lib/mysql/$db ]; then
|
||||
/usr/bin/mysql -e 'create database $db'
|
||||
/usr/bin/mysql $db < $dbstruct
|
||||
fi
|
||||
|
||||
/usr/bin/mysql <<EOF
|
||||
USE mysql;
|
||||
|
||||
REPLACE INTO user (
|
||||
host,
|
||||
user,
|
||||
password)
|
||||
VALUES (
|
||||
'localhost',
|
||||
'$user',
|
||||
PASSWORD ('$pass'));
|
||||
|
||||
|
||||
REPLACE INTO db (
|
||||
host,
|
||||
db,
|
||||
user,
|
||||
select_priv, insert_priv, update_priv, delete_priv,
|
||||
create_priv, alter_priv, index_priv, drop_priv, create_tmp_table_priv,
|
||||
grant_priv, lock_tables_priv, references_priv)
|
||||
VALUES (
|
||||
'localhost',
|
||||
'$db',
|
||||
'$user',
|
||||
'Y', 'Y', 'Y', 'Y',
|
||||
'Y', 'Y', 'Y', 'Y', 'Y',
|
||||
'N', 'Y', 'Y');
|
||||
|
||||
FLUSH PRIVILEGES;
|
||||
EOF
|
||||
END
|
||||
}
|
Loading…
Reference in New Issue