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 <