mirror of
https://github.com/MysticRyuujin/guac-install.git
synced 2023-10-10 13:36:56 +02:00
0.9.14 fixes (#28)
* Replace VERSION with GUACVERSION #26 #25 * Make database name dynamic from the guacamole.properties file #27
This commit is contained in:
parent
c45f9a62c7
commit
bcce82bbc0
@ -79,52 +79,49 @@ libswscale-dev libfreerdp-dev libpango1.0-dev libssh2-1-dev libtelnet-dev libvnc
|
|||||||
libvorbis-dev libwebp-dev mysql-server mysql-client mysql-common mysql-utilities ${TOMCAT} freerdp ghostscript wget dpkg-dev
|
libvorbis-dev libwebp-dev mysql-server mysql-client mysql-common mysql-utilities ${TOMCAT} freerdp ghostscript wget dpkg-dev
|
||||||
|
|
||||||
# If apt fails to run completely the rest of this isn't going to work...
|
# If apt fails to run completely the rest of this isn't going to work...
|
||||||
if [ $? != 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "apt failed to install all required dependencies"
|
echo "apt failed to install all required dependencies"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set SERVER to be the preferred download server from the Apache CDN
|
# Set SERVER to be the preferred download server from the Apache CDN
|
||||||
SERVER="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${VERSION}"
|
SERVER="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${GUACVERSION}"
|
||||||
|
|
||||||
# Quick Fix SERVER
|
|
||||||
VERSION=$GUACVERSION
|
|
||||||
|
|
||||||
# Download Guacamole Server
|
# Download Guacamole Server
|
||||||
wget -O guacamole-server-${VERSION}.tar.gz ${SERVER}/source/guacamole-server-${VERSION}.tar.gz
|
wget -O guacamole-server-${GUACVERSION}.tar.gz ${SERVER}/source/guacamole-server-${GUACVERSION}.tar.gz
|
||||||
if [ ! -f ./guacamole-server-${VERSION}.tar.gz ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to download guacamole-server-${VERSION}.tar.gz"
|
echo "Failed to download guacamole-server-${GUACVERSION}.tar.gz"
|
||||||
echo "${SERVER}/source/guacamole-server-${VERSION}.tar.gz"
|
echo "${SERVER}/source/guacamole-server-${GUACVERSION}.tar.gz"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Download Guacamole Client
|
# Download Guacamole Client
|
||||||
wget -O guacamole-${VERSION}.war ${SERVER}/binary/guacamole-${VERSION}.war
|
wget -O guacamole-${GUACVERSION}.war ${SERVER}/binary/guacamole-${GUACVERSION}.war
|
||||||
if [ ! -f ./guacamole-${VERSION}.war ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to download guacamole-${VERSION}.war"
|
echo "Failed to download guacamole-${GUACVERSION}.war"
|
||||||
echo "${SERVER}/binary/guacamole-${VERSION}.war"
|
echo "${SERVER}/binary/guacamole-${GUACVERSION}.war"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Download Guacamole authentication extensions
|
# Download Guacamole authentication extensions
|
||||||
wget -O guacamole-auth-jdbc-${VERSION}.tar.gz ${SERVER}/binary/guacamole-auth-jdbc-${VERSION}.tar.gz
|
wget -O guacamole-auth-jdbc-${GUACVERSION}.tar.gz ${SERVER}/binary/guacamole-auth-jdbc-${GUACVERSION}.tar.gz
|
||||||
if [ ! -f ./guacamole-auth-jdbc-${VERSION}.tar.gz ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to download guacamole-auth-jdbc-${VERSION}.tar.gz"
|
echo "Failed to download guacamole-auth-jdbc-${GUACVERSION}.tar.gz"
|
||||||
echo "${SERVER}/binary/guacamole-auth-jdbc-${VERSION}.tar.gz"
|
echo "${SERVER}/binary/guacamole-auth-jdbc-${GUACVERSION}.tar.gz"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Download MySQL Connector-J
|
# Download MySQL Connector-J
|
||||||
wget -O mysql-connector-java-${MCJVERSION}.tar.gz https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-${MCJVERSION}.tar.gz
|
wget -O mysql-connector-java-${MCJVERSION}.tar.gz https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-${MCJVERSION}.tar.gz
|
||||||
if [ ! -f ./mysql-connector-java-${MCJVERSION}.tar.gz ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to download mysql-connector-java-${MCJVERSION}.tar.gz"
|
echo "Failed to download mysql-connector-java-${MCJVERSION}.tar.gz"
|
||||||
echo "https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-${MCJVERSION}.tar.gz"
|
echo "https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-${MCJVERSION}.tar.gz"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Extract Guacamole files
|
# Extract Guacamole files
|
||||||
tar -xzf guacamole-server-${VERSION}.tar.gz
|
tar -xzf guacamole-server-${GUACVERSION}.tar.gz
|
||||||
tar -xzf guacamole-auth-jdbc-${VERSION}.tar.gz
|
tar -xzf guacamole-auth-jdbc-${GUACVERSION}.tar.gz
|
||||||
tar -xzf mysql-connector-java-${MCJVERSION}.tar.gz
|
tar -xzf mysql-connector-java-${MCJVERSION}.tar.gz
|
||||||
|
|
||||||
# Make directories
|
# Make directories
|
||||||
@ -132,7 +129,7 @@ mkdir -p /etc/guacamole/lib
|
|||||||
mkdir -p /etc/guacamole/extensions
|
mkdir -p /etc/guacamole/extensions
|
||||||
|
|
||||||
# Install guacd
|
# Install guacd
|
||||||
cd guacamole-server-${VERSION}
|
cd guacamole-server-${GUACVERSION}
|
||||||
./configure --with-init-dir=/etc/init.d
|
./configure --with-init-dir=/etc/init.d
|
||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
@ -144,11 +141,11 @@ cd ..
|
|||||||
BUILD_FOLDER=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE)
|
BUILD_FOLDER=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE)
|
||||||
|
|
||||||
# Move files to correct locations
|
# Move files to correct locations
|
||||||
mv guacamole-${VERSION}.war /etc/guacamole/guacamole.war
|
mv guacamole-${GUACVERSION}.war /etc/guacamole/guacamole.war
|
||||||
ln -s /etc/guacamole/guacamole.war /var/lib/${TOMCAT}/webapps/
|
ln -s /etc/guacamole/guacamole.war /var/lib/${TOMCAT}/webapps/
|
||||||
ln -s /usr/local/lib/freerdp/guac*.so /usr/lib/${BUILD_FOLDER}/freerdp/
|
ln -s /usr/local/lib/freerdp/guac*.so /usr/lib/${BUILD_FOLDER}/freerdp/
|
||||||
cp mysql-connector-java-${MCJVERSION}/mysql-connector-java-${MCJVERSION}-bin.jar /etc/guacamole/lib/
|
cp mysql-connector-java-${MCJVERSION}/mysql-connector-java-${MCJVERSION}-bin.jar /etc/guacamole/lib/
|
||||||
cp guacamole-auth-jdbc-${VERSION}/mysql/guacamole-auth-jdbc-mysql-${VERSION}.jar /etc/guacamole/extensions/
|
cp guacamole-auth-jdbc-${GUACVERSION}/mysql/guacamole-auth-jdbc-mysql-${GUACVERSION}.jar /etc/guacamole/extensions/
|
||||||
|
|
||||||
# Configure guacamole.properties
|
# Configure guacamole.properties
|
||||||
echo "mysql-hostname: localhost" >> /etc/guacamole/guacamole.properties
|
echo "mysql-hostname: localhost" >> /etc/guacamole/guacamole.properties
|
||||||
@ -173,7 +170,7 @@ flush privileges;"
|
|||||||
echo $SQLCODE | mysql -u root -p$mysqlrootpassword
|
echo $SQLCODE | mysql -u root -p$mysqlrootpassword
|
||||||
|
|
||||||
# Add Guacamole schema to newly created database
|
# Add Guacamole schema to newly created database
|
||||||
cat guacamole-auth-jdbc-${VERSION}/mysql/schema/*.sql | mysql -u root -p$mysqlrootpassword guacamole_db
|
cat guacamole-auth-jdbc-${GUACVERSION}/mysql/schema/*.sql | mysql -u root -p$mysqlrootpassword guacamole_db
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
rm -rf guacamole-*
|
rm -rf guacamole-*
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Try to get database from /etc/guacamole/guacamole.properties
|
||||||
|
DATABASE=$(grep -oP 'mysql-database:\K.*' /etc/guacamole/guacamole.properties | awk '{print $1}')
|
||||||
|
|
||||||
# Get MySQL root password
|
# Get MySQL root password
|
||||||
echo
|
echo
|
||||||
while true
|
while true
|
||||||
@ -7,13 +10,13 @@ do
|
|||||||
read -s -p "Enter MySQL ROOT Password: " mysqlrootpassword
|
read -s -p "Enter MySQL ROOT Password: " mysqlrootpassword
|
||||||
export MYSQL_PWD=${mysqlrootpassword}
|
export MYSQL_PWD=${mysqlrootpassword}
|
||||||
echo
|
echo
|
||||||
mysql -u root guacamole_db -e"quit" && break
|
mysql -u root ${DATABASE} -e"quit" && break
|
||||||
echo
|
echo
|
||||||
done
|
done
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# Version Numbers of Guacamole and MySQL Connector/J to download
|
# Version Numbers of Guacamole and MySQL Connector/J to download
|
||||||
VERSION="0.9.14"
|
GUACVERSION="0.9.14"
|
||||||
MCJVERSION="5.1.45"
|
MCJVERSION="5.1.45"
|
||||||
|
|
||||||
# Get Tomcat Version
|
# Get Tomcat Version
|
||||||
@ -23,46 +26,46 @@ TOMCAT=$(ls /etc/ | grep tomcat)
|
|||||||
OLDVERSION=$(grep -oP 'Guacamole.API_VERSION = "\K[0-9\.]+' /var/lib/${TOMCAT}/webapps/guacamole/guacamole-common-js/modules/Version.js)
|
OLDVERSION=$(grep -oP 'Guacamole.API_VERSION = "\K[0-9\.]+' /var/lib/${TOMCAT}/webapps/guacamole/guacamole-common-js/modules/Version.js)
|
||||||
|
|
||||||
# Set SERVER to be the preferred download server from the Apache CDN
|
# Set SERVER to be the preferred download server from the Apache CDN
|
||||||
SERVER="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${VERSION}"
|
SERVER="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${GUACVERSION}"
|
||||||
|
|
||||||
# Stop tomcat
|
# Stop tomcat
|
||||||
service ${TOMCAT} stop
|
service ${TOMCAT} stop
|
||||||
|
|
||||||
# Download Guacamole server
|
# Download Guacamole server
|
||||||
wget -O guacamole-server-${VERSION}.tar.gz ${SERVER}/source/guacamole-server-${VERSION}.tar.gz
|
wget -O guacamole-server-${GUACVERSION}.tar.gz ${SERVER}/source/guacamole-server-${GUACVERSION}.tar.gz
|
||||||
if [ ! -f ./guacamole-server-${VERSION}.tar.gz ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to download guacamole-server-${VERSION}.tar.gz"
|
echo "Failed to download guacamole-server-${GUACVERSION}.tar.gz"
|
||||||
echo "${SERVER}/source/guacamole-server-${VERSION}.tar.gz"
|
echo "${SERVER}/source/guacamole-server-${GUACVERSION}.tar.gz"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Download Guacamole client
|
# Download Guacamole client
|
||||||
wget -O guacamole-${VERSION}.war ${SERVER}/binary/guacamole-${VERSION}.war
|
wget -O guacamole-${GUACVERSION}.war ${SERVER}/binary/guacamole-${GUACVERSION}.war
|
||||||
if [ ! -f ./guacamole-${VERSION}.war ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to download guacamole-${VERSION}.war"
|
echo "Failed to download guacamole-${GUACVERSION}.war"
|
||||||
echo "${SERVER}/binary/guacamole-${VERSION}.war"
|
echo "${SERVER}/binary/guacamole-${GUACVERSION}.war"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Download SQL components
|
# Download SQL components
|
||||||
wget -O guacamole-auth-jdbc-${VERSION}.tar.gz ${SERVER}/binary/guacamole-auth-jdbc-${VERSION}.tar.gz
|
wget -O guacamole-auth-jdbc-${GUACVERSION}.tar.gz ${SERVER}/binary/guacamole-auth-jdbc-${GUACVERSION}.tar.gz
|
||||||
if [ ! -f ./guacamole-auth-jdbc-${VERSION}.tar.gz ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to download guacamole-auth-jdbc-${VERSION}.tar.gz"
|
echo "Failed to download guacamole-auth-jdbc-${GUACVERSION}.tar.gz"
|
||||||
echo "${SERVER}/binary/guacamole-auth-jdbc-${VERSION}.tar.gz"
|
echo "${SERVER}/binary/guacamole-auth-jdbc-${GUACVERSION}.tar.gz"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Download the MySQL Connector/J
|
# Download the MySQL Connector/J
|
||||||
wget -O mysql-connector-java-${MCJVERSION}.tar.gz https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-${MCJVERSION}.tar.gz
|
wget -O mysql-connector-java-${MCJVERSION}.tar.gz https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-${MCJVERSION}.tar.gz
|
||||||
if [ ! -f ./mysql-connector-java-${MCJVERSION}.tar.gz ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to download mysql-connector-java-${MCJVERSION}.tar.gz"
|
echo "Failed to download mysql-connector-java-${MCJVERSION}.tar.gz"
|
||||||
echo "https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-${MCJVERSION}.tar.gz"
|
echo "https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-${MCJVERSION}.tar.gz"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Upgrade Guacamole Server
|
# Upgrade Guacamole Server
|
||||||
tar -xzf guacamole-server-${VERSION}.tar.gz
|
tar -xzf guacamole-server-${GUACVERSION}.tar.gz
|
||||||
cd guacamole-server-${VERSION}
|
cd guacamole-server-${GUACVERSION}
|
||||||
./configure --with-init-dir=/etc/init.d
|
./configure --with-init-dir=/etc/init.d
|
||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
@ -71,17 +74,17 @@ systemctl enable guacd
|
|||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
# Upgrade Guacamole Client
|
# Upgrade Guacamole Client
|
||||||
mv guacamole-${VERSION}.war /etc/guacamole/guacamole.war
|
mv guacamole-${GUACVERSION}.war /etc/guacamole/guacamole.war
|
||||||
|
|
||||||
# Upgrade SQL Components
|
# Upgrade SQL Components
|
||||||
tar -xzf guacamole-auth-jdbc-${VERSION}.tar.gz
|
tar -xzf guacamole-auth-jdbc-${GUACVERSION}.tar.gz
|
||||||
cp guacamole-auth-jdbc-${VERSION}/mysql/guacamole-auth-jdbc-mysql-${VERSION}.jar /etc/guacamole/extensions/
|
cp guacamole-auth-jdbc-${GUACVERSION}/mysql/guacamole-auth-jdbc-mysql-${GUACVERSION}.jar /etc/guacamole/extensions/
|
||||||
tar -xzf 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/
|
cp mysql-connector-java-${MCJVERSION}/mysql-connector-java-${MCJVERSION}-bin.jar /etc/guacamole/lib/
|
||||||
rm -rf mysql-connector-java-${MCJVERSION}*
|
rm -rf mysql-connector-java-${MCJVERSION}*
|
||||||
|
|
||||||
# Get list of SQL Upgrade Files
|
# Get list of SQL Upgrade Files
|
||||||
UPGRADEFILES=($(ls -1 guacamole-auth-jdbc-${VERSION}/mysql/schema/upgrade/ | sort -V))
|
UPGRADEFILES=($(ls -1 guacamole-auth-jdbc-${GUACVERSION}/mysql/schema/upgrade/ | sort -V))
|
||||||
|
|
||||||
# Compare SQL Upgrage Files against old version, apply upgrades as needed
|
# Compare SQL Upgrage Files against old version, apply upgrades as needed
|
||||||
for FILE in ${UPGRADEFILES[@]}
|
for FILE in ${UPGRADEFILES[@]}
|
||||||
@ -89,7 +92,7 @@ do
|
|||||||
FILEVERSION=$(echo ${FILE} | grep -oP 'upgrade-pre-\K[0-9\.]+(?=\.)')
|
FILEVERSION=$(echo ${FILE} | grep -oP 'upgrade-pre-\K[0-9\.]+(?=\.)')
|
||||||
if [[ $(echo -e "${FILEVERSION}\n${OLDVERSION}" | sort -V | head -n1) == ${OLDVERSION} && ${FILEVERSION} != ${OLDVERSION} ]]
|
if [[ $(echo -e "${FILEVERSION}\n${OLDVERSION}" | sort -V | head -n1) == ${OLDVERSION} && ${FILEVERSION} != ${OLDVERSION} ]]
|
||||||
then
|
then
|
||||||
mysql -u root guacamole_db < guacamole-auth-jdbc-${VERSION}/mysql/schema/upgrade/${FILE}
|
mysql -u root ${DATABASE} < guacamole-auth-jdbc-${GUACVERSION}/mysql/schema/upgrade/${FILE}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user