From 2ae1e3c21da0c41f9daccffe27fce7ed5be188d2 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 25 May 2010 13:44:24 +1200 Subject: [PATCH] Use /etc/mysql/koha-common.cnf instead of the Debian one. koha-common.postinst now creates a symlink to the Debian one. The sysadmin may replace that manually with something that allows Koha to access a remote mysql server. Signed-off-by: Galen Charlton --- debian/koha-common.README.Debian | 10 ++++++++++ debian/koha-common.postinst | 11 +++++++++++ debian/scripts/koha-create | 6 +++--- debian/scripts/koha-remove | 2 +- debian/scripts/koha-reset-passwd | 2 +- debian/scripts/koha-restore | 6 +++--- 6 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 debian/koha-common.postinst diff --git a/debian/koha-common.README.Debian b/debian/koha-common.README.Debian index 221e1a399b..067628421e 100644 --- a/debian/koha-common.README.Debian +++ b/debian/koha-common.README.Debian @@ -17,3 +17,13 @@ Each Koha instance has files in the following places: * /var/run/koha/$name -- run-time sockets etc * /var/spool/koha/$name -- database dumps + +Koha and MySQL +============== + +koha-common's postinst script sets up the /etc/mysql/koha-common.cnf, +and all scripts use that to access the MySQL database. By default, it +is a symlink pointing at debian.cnf, and only works on localhost. +If you wish, you can create a file /etc/mysql/koha-common.cnf instead +of the symlink, and point it at a remote server. There is currently +no tool to help you do that, but it should be fairly straightforward. diff --git a/debian/koha-common.postinst b/debian/koha-common.postinst new file mode 100644 index 0000000000..0067ef9478 --- /dev/null +++ b/debian/koha-common.postinst @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +conf=/etc/mysql/koha-common.cnf +if [ ! -e "$conf" ] +then + ln -s debian.cnf /etc/mysql/koha-common.cnf +fi + +#DEBHELPER# diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create index 45f65e4465..cb0268d48c 100755 --- a/debian/scripts/koha-create +++ b/debian/scripts/koha-create @@ -95,7 +95,7 @@ zebrapwd="$(pwgen -1)" mysqldb="koha_$name" mysqluser="koha_$name" mysqlpwd="$(pwgen -1)" -mysql --defaults-extra-file=/etc/mysql/debian.cnf <) { print md5_base64($_), "\n"; }') - mysql --defaults-extra-file=/etc/mysql/debian.cnf <> "$temp" done -mysql --defaults-extra-file=/etc/mysql/debian.cnf < "$temp" +mysql --defaults-extra-file=/etc/mysql/koha-common.cnf < "$temp" rm "$temp" diff --git a/debian/scripts/koha-restore b/debian/scripts/koha-restore index 6e15fd0f15..560dc406c0 100755 --- a/debian/scripts/koha-restore +++ b/debian/scripts/koha-restore @@ -70,11 +70,11 @@ tar -C / -xf "$configdump" mysqldb="koha_$name" mysqluser="koha_$name" mysqlpwd="$(sed -n '/.*\(.*\)<\/pass>.*/s//\1/p' /etc/koha/sites/$name/koha-conf.xml)" -zcat "$sqldump" | mysql --defaults-extra-file=/etc/mysql/debian.cnf -mysql --defaults-extra-file=/etc/mysql/debian.cnf <