From 15fe66641f4d6062650ac049a7c464ca7eae1497 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 Content-Type: text/plain; charset="UTF-8" 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. --- 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 bb2b642..b0c418c 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 -- 1.7.2.5