From 662179cc24f05250d5542ef4d05d7d56124f0224 Mon Sep 17 00:00:00 2001 From: Andreas Jonsson Date: Mon, 17 Jun 2019 20:07:40 +0200 Subject: [PATCH] Bug 23141: Add mysql portnumber support when populating db --- debian/scripts/koha-create | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create index 5e60f7cd77..2402bdf56f 100755 --- a/debian/scripts/koha-create +++ b/debian/scripts/koha-create @@ -118,7 +118,7 @@ generate_config_file() { } getmysqlhost() { - if [ ! -f /etc/mysql/debian.cnf ] + if [ ! -f /etc/mysql/koha-common.cnf ] then echo localhost return @@ -143,6 +143,14 @@ getinstancemysqldatabase() { xmlstarlet sel -t -v 'yazgfs/config/database' "/etc/koha/sites/$1/koha-conf.xml" } +getinstancemysqlport() { + xmlstarlet sel -t -v 'yazgfs/config/port' "/etc/koha/sites/$1/koha-conf.xml" +} + +getinstancemysqlhost() { + xmlstarlet sel -t -v 'yazgfs/config/hostname' "/etc/koha/sites/$1/koha-conf.xml" +} + check_apache_config() { @@ -686,13 +694,15 @@ then # something. mysqluser=$(getinstancemysqluser $name) mysqldb=$(getinstancemysqldatabase $name) + mysqlhost=$(getinstancemysqlhost $name) + mysqlport=$(getinstancemysqlport $name) # Use the default database content if that exists. if [ -e "$DEFAULTSQL" ] then # Populate the database with default content. zcat -f "$DEFAULTSQL" | sed "s/__KOHASITE__/koha_$name/g" | - mysql --host="$mysqlhost" --user="$mysqluser" --password="$mysqlpwd" "$mysqldb" + mysql --host="$mysqlhost" --port="$mysqlport" --user="$mysqluser" --password="$mysqlpwd" "$mysqldb" # Change the default user's password. @@ -701,7 +711,7 @@ then perl -e ' use Digest::MD5 qw(md5_base64); while (<>) { print md5_base64($_), "\n"; }') - mysql --host="$mysqlhost" --user="$mysqluser" \ + mysql --host="$mysqlhost" --port="$mysqlport" --user="$mysqluser" \ --password="$mysqlpwd" <