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 <