From 714ae7f20da0af9a32139d1b92df544eb5bf84f9 Mon Sep 17 00:00:00 2001 From: Chase Wright Date: Thu, 15 Feb 2018 09:17:05 -0600 Subject: [PATCH] Allow Remote MySQL Upgrade Thanks dockworka@netattack.it --- guac-upgrade.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/guac-upgrade.sh b/guac-upgrade.sh index 24f21da..e73e4f8 100644 --- a/guac-upgrade.sh +++ b/guac-upgrade.sh @@ -2,6 +2,7 @@ # Try to get database from /etc/guacamole/guacamole.properties DATABASE=$(grep -oP 'mysql-database:\K.*' /etc/guacamole/guacamole.properties | awk '{print $1}') +MYSQL_SERVER=$(grep -oP ‘mysql-hostname:\K.*’ /etc/guacamole/guacamole.properties | awk ‘{print $1}’) # Get MySQL root password echo @@ -10,7 +11,7 @@ do read -s -p "Enter MySQL ROOT Password: " mysqlrootpassword export MYSQL_PWD=${mysqlrootpassword} echo - mysql -u root ${DATABASE} -e"quit" && break + mysql -u root -h ${MYSQL_SERVER} ${DATABASE} -e"quit" && break echo done echo @@ -81,7 +82,7 @@ do if [[ $(echo -e "${FILEVERSION}\n${OLDVERSION}" | sort -V | head -n1) == ${OLDVERSION} && ${FILEVERSION} != ${OLDVERSION} ]] then echo "Patching ${DATABASE} with ${FILE}" - mysql -u root ${DATABASE} < guacamole-auth-jdbc-${GUACVERSION}/mysql/schema/upgrade/${FILE} + mysql -u root -h ${MYSQL_SERVER} ${DATABASE} < guacamole-auth-jdbc-${GUACVERSION}/mysql/schema/upgrade/${FILE} fi done