Bug 19547: Deal with --create-db missing debian.cnf issue
authorMark Tompsett <mtompset@hotmail.com>
Tue, 31 Oct 2017 02:28:58 +0000 (02:28 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 19 Mar 2018 16:55:46 +0000 (13:55 -0300)
Followed test plan. Patch functions as described and both commands execute.
Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
debian/scripts/koha-create

index 1312ee3..cdfa63d 100755 (executable)
@@ -706,7 +706,13 @@ then
     # Set up MySQL database for this instance.
     if [ "$op" = create ]
     then
-        mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <<eof
+        if [ ! -e /etc/mysql/debian.cnf ]; then
+            MYSQL_OPTIONS="-u root"
+            echo "WARNING: The koha-common.cnf file is a dead soft link!"
+        else
+            MYSQL_OPTIONS="--defaults-extra-file=/etc/mysql/koha-common.cnf"
+        fi
+        mysql $MYSQL_OPTIONS <<eof
 CREATE DATABASE \`$mysqldb\`;
 CREATE USER \`$mysqluser\`@'$mysql_hostname' IDENTIFIED BY '$mysqlpwd';
 CREATE USER \`$mysqluser\`@'%' IDENTIFIED BY '$mysqlpwd';