1
0
mirror of https://github.com/MysticRyuujin/guac-install.git synced 2023-10-10 13:36:56 +02:00
guac-install/guac-upgrade.sh
Chase Wright 8dc1cce78b Tomcat Variable (#13)
* Tomcat Variable

I don't know a good way to know which tomcat version is already running, and of course someone could theoretically run more than one...so the upgrade script is just a variable but the install script will check apt-cache and try to install tomcat8, then tomcat7, then tomcat6...

* Optional commented line

Added a commented out line in case someone wants to force an older/specific tomcat install
2017-08-02 06:24:36 -05:00

52 lines
1.9 KiB
Bash

#!/bin/bash
# Version Numbers of Guacamole and MySQL Connection/J to download
VERSION="0.9.13"
MCJVERSION="5.1.43"
# I'm assuming tomcat8, you can change it here...
TOMCAT="tomcat8"
SERVER=$(curl -s 'https://www.apache.org/dyn/closer.cgi?as_json=1' | jq --raw-output '.preferred|rtrimstr("/")')
# Stop Tomcat
service ${TOMCAT} stop
# Download and install Guacamole Server
wget ${SERVER}/incubator/guacamole/${VERSION}-incubating/source/guacamole-server-${VERSION}-incubating.tar.gz
tar -xzf guacamole-server-${VERSION}-incubating.tar.gz
cd guacamole-server-${VERSION}-incubating
./configure --with-init-dir=/etc/init.d
make
make install
ldconfig
systemctl enable guacd
cd ..
# Download and replace Guacamole Client
wget ${SERVER}/incubator/guacamole/${VERSION}-incubating/binary/guacamole-${VERSION}-incubating.war
mv guacamole-${VERSION}-incubating.war /etc/guacamole/guacamole.war
# Download and upgrade SQL components
wget ${SERVER}/incubator/guacamole/${VERSION}-incubating/binary/guacamole-auth-jdbc-${VERSION}-incubating.tar.gz
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/
# Upgrade the MySQL Connector-J
wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-${MCJVERSION}.tar.gz
tar -xzf mysql-connector-java-${MCJVERSION}.tar.gz
cp mysql-connector-java-${MCJVERSION}/mysql-connector-java-${MCJVERSION}-bin.jar /etc/guacamole/lib/
rm -rf mysql-connector-java-${MCJVERSION}*
# 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 ${TOMCAT} start
# Cleanup
rm -rf guacamole*