From d412c5d1c35cc68e5a0b3abd8d903d227b8539f4 Mon Sep 17 00:00:00 2001 From: Eric Vantillard Date: Tue, 9 May 2017 23:10:21 +0200 Subject: [PATCH] Bug 18564: Improve koha-common.cnf parsing to pick the mysql host Content-Type: text/plain; charset=utf-8 my koha-common.cnf is using this form: [client] host=db user=root password="move_rootpwd_to_dotenv" this file is working has expected with mysql tools. but koha-create parsing will not find the db host resulting in koha-conf.xml containing no values in hostname element. Signed-off-by: Jonathan Druart Signed-off-by: Marcel de Rooy --- debian/scripts/koha-create | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create index 74888bc..7b6b512 100755 --- a/debian/scripts/koha-create +++ b/debian/scripts/koha-create @@ -124,9 +124,10 @@ generate_config_file() { getmysqlhost() { awk ' - /^\[/ { inclient = 0 } - /^\[client\]/ { inclient = 1 } - inclient && /^ *host *=/ { print $3 }' \ + BEGIN { FS="=" } + $1 ~/\[/ { inclient=0 } + $1 ~/\[client\]/ { inclient=1; next } + inclient==1 && $1 ~/host/ { gsub(/ /, "", $2); print $2 }' \ /etc/mysql/koha-common.cnf } -- 2.1.4