From f12ff9e0c65571dc50dc219ae1cc0adb7d177060 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 25 May 2010 13:44:25 +1200 Subject: [PATCH] Add support for a remote mysql server. Signed-off-by: Galen Charlton --- debian/control | 2 +- debian/koha-common.postinst | 4 ++-- debian/scripts/koha-create | 12 +++++++++++- debian/templates/koha-conf-site.xml.in | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/debian/control b/debian/control index 999dbfa64b..459e1c3fe1 100644 --- a/debian/control +++ b/debian/control @@ -75,9 +75,9 @@ Depends: ${shlib:Depends}, ${misc:Depends}, ${koha:Depends}, libjs-jquery, libjs-yui, mysql-client, - mysql-server, tinymce2, yaz +Suggests: mysql-server Homepage: http://koha-community.org/ Description: integrated (physical) library management system Koha is an Integrated Library Managment system for real-world libraries diff --git a/debian/koha-common.postinst b/debian/koha-common.postinst index 0067ef9478..ffb21657a1 100644 --- a/debian/koha-common.postinst +++ b/debian/koha-common.postinst @@ -3,9 +3,9 @@ set -e conf=/etc/mysql/koha-common.cnf -if [ ! -e "$conf" ] +if [ ! -e "$conf" ] && [ ! -L "$conf" ] then - ln -s debian.cnf /etc/mysql/koha-common.cnf + ln -s debian.cnf "$conf" fi #DEBHELPER# diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create index cb0268d48c..f360cf2c30 100755 --- a/debian/scripts/koha-create +++ b/debian/scripts/koha-create @@ -37,6 +37,7 @@ generate_config_file() { -e "s/__INTRASERVER__/$intradomain/g" \ -e "s/__ZEBRA_PASS__/$zebrapwd/g" \ -e "s/__DB_NAME__/$mysqldb/g" \ + -e "s/__DB_HOST__/$mysqlhost/g" \ -e "s/__DB_USER__/$mysqluser/g" \ -e "s/__DB_PASS__/$mysqlpwd/g" \ -e "s/__UNIXUSER__/$username/g" \ @@ -44,6 +45,14 @@ generate_config_file() { "/etc/koha/$1" > "$2" } +getmysqlhost() { + awk ' + /^\[/ { inclient = 0 } + /^\[client\]/ { inclient = 1 } + inclient && /^ *host *=/ { print $3 }' \ + /etc/mysql/koha-common.cnf +} + # Set defaults and read config file, if it exists. DOMAIN="" @@ -93,11 +102,12 @@ zebrapwd="$(pwgen -1)" # Set up MySQL database for this instance. mysqldb="koha_$name" +mysqlhost="$(getmysqlhost)" mysqluser="koha_$name" mysqlpwd="$(pwgen -1)" mysql --defaults-extra-file=/etc/mysql/koha-common.cnf < mysql __DB_NAME__ - localhost + __DB_HOST__ 3306 __DB_USER__ __DB_PASS__ -- 2.39.5