From 89a3cbff926d343407eb313895d85acec2fe4b10 Mon Sep 17 00:00:00 2001 From: Robin Sheat Date: Fri, 20 Jul 2012 12:20:47 +0200 Subject: [PATCH] Bug 8162: allow packages to work on Ubuntu Precise The newer version of MySQL in Ubuntu 12.04 installs a default 'localhost' user with no username. Due to the way that MySQL looks up user details when you connect, if you connect from localhost and the user was only created with a wildcard host (%), the anonymous localhost user will be found instead. This means that your username is lost for the connection, and you have no privileges. This patch creates a second user with a hostname of 'localhost'. This will not work if your database is on a remote server, but you probably know what you are doing if that's the case. Patches to determine this server's name relative to the MySQL server are welcome (or even ideas on how to do it.) It also fixes up a couple of other small things: * make koha-remove stop zebra properly * stop the warning that the password file is missing on create Signed-off-by: Jared Camins-Esakov Works as promised. Signed-off-by: Chris Cormack Allows 3.8.4 packages to work on Ubuntu 12.04 (cherry picked from commit 7d8078472d6ad04e1fb61ab3542f86226517a45a) Signed-off-by: Jared Camins-Esakov --- debian/scripts/koha-create | 7 ++++++- debian/scripts/koha-remove | 10 ++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create index bb2b642082..b0c418c1bc 100755 --- a/debian/scripts/koha-create +++ b/debian/scripts/koha-create @@ -163,7 +163,7 @@ opacdomain="$OPACPREFIX$name$OPACSUFFIX$DOMAIN" intradomain="$INTRAPREFIX$name$INTRASUFFIX$DOMAIN" -if [ `cat $PASSWDFILE | grep "^$name:"` ] +if [ -f $PASSWDFILE ] && [ `cat $PASSWDFILE | grep "^$name:"` ] then passwdline=`cat $PASSWDFILE | grep "^$name:"` mysqluser=`echo $passwdline | cut -d ":" -f 2` @@ -221,11 +221,15 @@ then # Generate Zebra database password. zebrapwd="$(pwgen -s 12 1)" + # Future enhancement: make this configurable for when your db is on + # another server. + mysql_hostname="localhost" # Set up MySQL database for this instance. if [ "$op" = create ] then mysql --defaults-extra-file=/etc/mysql/koha-common.cnf < /dev/null && deluser --quiet "$name-koha" # in case the site has already been disabled, we don't want to break the loop now. - a2dissite "$name" | /bin/true + a2dissite "$name" || /bin/true done service apache2 restart -- 2.39.5