DBName patch
"Derek Atkins" <[email protected]>
| Newsgroups | gmane.mail.virus.maiamailguard |
|---|---|
| Message-ID | <[email protected]> |
Here is a proposed patch for allowing one to choose the DB Name.
Note: I have not actually tested this patch, but wanted to let you all
see it to review.
Let me know what you think
-derek
--
Derek Atkins 617-623-3745
[email protected] www.ihtfp.com
Computer and Internet Security Consultant
_______________________________________________
Maia-users mailing list
[email protected]
http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users
maiadb.patch
(text/x-patch, 3.4 KB)
diff --git a/cfg_tpl/config.php.tmpl b/cfg_tpl/config.php.tmpl
index e40ce24..aa35ac7 100644
--- a/cfg_tpl/config.php.tmpl
+++ b/cfg_tpl/config.php.tmpl
@@ -131,7 +131,7 @@
//$maia_sql_dsn = "mysql://dbuser:passwd@unix(/var/tmp/mysql.sock)/maia";
//$maia_sql_dsn = "mysql://dbuser:passwd/maia";
- $maia_sql_dsn = "mysqli://maia:__PASSWORD__@tcp(__DBHOST__:3306)/maia";
+ $maia_sql_dsn = "mysqli://maia:__PASSWORD__@tcp(__DBHOST__:3306)/__DBNAME__";
// To pass more options into DB:connect, set them in this array
// For more details, see:
diff --git a/cfg_tpl/maia.conf.tmpl b/cfg_tpl/maia.conf.tmpl
index 87a4dd6..122e2c1 100644
--- a/cfg_tpl/maia.conf.tmpl
+++ b/cfg_tpl/maia.conf.tmpl
@@ -7,7 +7,7 @@
# Configure your Maia database DSN here
#dsn = 'DBI:mysql:maia:localhost:mysql_socket=/var/lib/mysql/mysql.sock';
-$dsn = 'DBI:mysql:maia:__DBHOST__:3306';
+$dsn = 'DBI:mysql:__DBNAME__:__DBHOST__:3306';
# Your Maia database user's login name
$username = 'maia';
diff --git a/cfg_tpl/maiad.conf.tmpl b/cfg_tpl/maiad.conf.tmpl
index 21a2d54..c8428ee 100644
--- a/cfg_tpl/maiad.conf.tmpl
+++ b/cfg_tpl/maiad.conf.tmpl
@@ -191,7 +191,7 @@ $LOGFILE = "/var/log/maia/maiad.log";
# * dbuser is the name of your Maia database user, typically 'maia'
# * dbpass is the Maia database user's password
-@lookup_sql_dsn = ( ['DBI:mysql:maia:__DBHOST__:3306', 'maia', '__PASSWORD__'] );
+@lookup_sql_dsn = ( ['DBI:mysql:__DBNAME__:__DBHOST__:3306', 'maia', '__PASSWORD__'] );
# BerkeleyDB/libdb ($enable_db)
diff --git a/scripts/get-info.sh b/scripts/get-info.sh
index 26ff5cc..2b3aae7 100755
--- a/scripts/get-info.sh
+++ b/scripts/get-info.sh
@@ -17,9 +17,14 @@ if [ $junk == 'y' ] || [ $junk == 'Y' ]; then
dbserver=localhost
fi
+dbname=maia
if [ $localdb -eq 0 ]; then
echo -n "Enter the resolvable name or IP of the maia DB server: "
read dbserver
+ echo
+ echo -n "Enter the maia database name (default: maia): "
+ read dbname
+ [ "${dbname}X" == "X" ] && dbname="maia"
fi
# get the maia password
@@ -55,6 +60,8 @@ echo "the fully qualified hostname is $fqdn"
echo
echo "the domain seems to be $domain"
echo
+echo "mysql database name: $dbname"
+echo
echo "mysql password for maia: $mydbpass"
if [ $needsmarthost == 1 ]; then
@@ -74,6 +81,7 @@ echo "HOST=$shost" > installer.tmpl
echo "FQDN=$fqdn" >> installer.tmpl
echo "DOMAIN=$domain" >> installer.tmpl
echo "DBSERVER=$dbserver" >> installer.tmpl
+echo "DBNAME=$dbname" >> installer.tmpl
echo "MAIAPASS=$mydbpass" >> installer.tmpl
echo "WEBSRV=$fqdn" >> installer.tmpl
diff --git a/scripts/process-changes.sh b/scripts/process-changes.sh
index e5b0a6e..fbf81ab 100755
--- a/scripts/process-changes.sh
+++ b/scripts/process-changes.sh
@@ -11,6 +11,7 @@ HOST=`grep HOST installer.tmpl | awk -F\= '{ print $2 }'`
FQDN=`grep FQDN installer.tmpl | awk -F\= '{ print $2 }'`
DOMAIN=`grep DOMA installer.tmpl | awk -F\= '{ print $2 }'`
dbhost=`grep DBSERVER installer.tmpl | awk -F\= '{ print $2 }'`
+dbname=`grep DBNAME installer.tmpl | awk -F\= '{ print $2 }'`
passwd=`grep MAIAPASS installer.tmpl | awk -F\= '{ print $2 }'`
websrv=`grep WEBSRV installer.tmpl | awk -F\= '{ print $2 }'`
@@ -28,6 +29,8 @@ for i in config.php maia.conf maiad.conf
do
echo "editing DBHOST"
inline-edit.sh __DBHOST__ $dbhost $i
+ echo "editing DBNAME"
+ inline-edit.sh __DBNAME__ $dbname $i
echo "editing PASSWORD/${passwd}"
inline-edit.sh '__PASSWORD__' $passwd $i
done