From 27aca44d5cc0dd55dc7e5fc3369afb75e444af4c Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Wed, 20 Nov 2013 12:46:40 +0100 Subject: [PATCH] Switch to MySQL --- createlinks | 1 + .../e-smith/templates/etc/e-smith/sql/init/dl | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 root/etc/e-smith/templates/etc/e-smith/sql/init/dl diff --git a/createlinks b/createlinks index 030ed9f..f5afc00 100644 --- a/createlinks +++ b/createlinks @@ -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"); diff --git a/root/etc/e-smith/templates/etc/e-smith/sql/init/dl b/root/etc/e-smith/templates/etc/e-smith/sql/init/dl new file mode 100644 index 0000000..5712eeb --- /dev/null +++ b/root/etc/e-smith/templates/etc/e-smith/sql/init/dl @@ -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 <