Switch to MySQL

tags/smeserver-dl-0.2.1-1
Daniel Berteaud 11 years ago
parent fe0bcfec3c
commit 27aca44d5c
  1. 1
      createlinks
  2. 46
      root/etc/e-smith/templates/etc/e-smith/sql/init/dl

@ -4,6 +4,7 @@ use esmith::Build::CreateLinks qw(:all);
# Templates to expand # Templates to expand
templates2events("/etc/dl.php", qw(bootstrap-console-save webapps-update)); 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 # PHP header and footer
safe_symlink("/etc/e-smith/templates-default/template-begin-php", "root/etc/e-smith/templates/etc/dl.php/template-begin"); 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…
Cancel
Save