From 34c8f4454340c661c9b96af619d6440d1f1ade73 Mon Sep 17 00:00:00 2001 From: Chase Wright Date: Mon, 17 Jul 2017 18:05:08 -0500 Subject: [PATCH] automated schema upgrade check If the schema upgrade needs to happen then the file name would exist with the current version's name so it's easy enough to check for and run if necessary. --- guac-upgrade.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/guac-upgrade.sh b/guac-upgrade.sh index a747801..5d16275 100644 --- a/guac-upgrade.sh +++ b/guac-upgrade.sh @@ -24,8 +24,11 @@ wget ${SERVER}/incubator/guacamole/${VERSION}-incubating/binary/guacamole-auth-j tar -xzf guacamole-auth-jdbc-${VERSION}-incubating.tar.gz cp guacamole-auth-jdbc-${VERSION}-incubating/mysql/guacamole-auth-jdbc-mysql-${VERSION}-incubating.jar /etc/guacamole/extensions/ -# Commented out this lines as there is no schema upgrade from 0.9.11 to 0.9.12 -# mysql -u root -p guacamole_db < guacamole-auth-jdbc-${VERSION}-incubating/mysql/schema/upgrade/upgrade-pre-${VERSION}.sql +# Check if there is an schema upgrade file, if there is run it (will prompt for password) +if [ -f "guacamole-auth-jdbc-${VERSION}-incubating/mysql/schema/upgrade/upgrade-pre-${VERSION}.sql" ] +then + mysql -u root -p guacamole_db < guacamole-auth-jdbc-${VERSION}-incubating/mysql/schema/upgrade/upgrade-pre-${VERSION}.sql +fi # Start Tomcat service tomcat8 start