1
0
mirror of https://github.com/MysticRyuujin/guac-install.git synced 2023-10-10 13:36:56 +02:00

Fix gcc-7 & Update Docker (#38)

* Force guacd compile with gcc-6 to resolve gcc-7 compile issues

* Update docker version
This commit is contained in:
Chase Wright 2018-03-12 16:44:55 -05:00 committed by GitHub
parent 9a6da88418
commit baac552de0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 127 additions and 66 deletions

View File

@ -1,12 +1,31 @@
#!/bin/bash #!/bin/bash
# WORKING ON UBUNTU 16.04 LTS
VERSION="0.9.14" # Version numbers of Guacamole and MySQL Connector/J to download
GUACVERSION="0.9.14"
# Get script arguments for non-interactive mode
while [ "$1" != "" ]; do
case $1 in
-m | --mysqlpwd )
shift
mysqlpwd="$1"
;;
-g | --guacpwd )
shift
guacpwd="$1"
;;
esac
shift
done
# Get MySQL root password and Guacamole User password # Get MySQL root password and Guacamole User password
echo if [ -n "$mysqlpwd" ] && [ -n "$guacpwd" ]; then
while true mysqlrootpassword=$mysqlpwd
do guacdbuserpassword=$guacpwd
else
echo
while true
do
read -s -p "Enter a MySQL ROOT Password: " mysqlrootpassword read -s -p "Enter a MySQL ROOT Password: " mysqlrootpassword
echo echo
read -s -p "Confirm MySQL ROOT Password: " password2 read -s -p "Confirm MySQL ROOT Password: " password2
@ -14,10 +33,10 @@ do
[ "$mysqlrootpassword" = "$password2" ] && break [ "$mysqlrootpassword" = "$password2" ] && break
echo "Passwords don't match. Please try again." echo "Passwords don't match. Please try again."
echo echo
done done
echo echo
while true while true
do do
read -s -p "Enter a Guacamole User Database Password: " guacdbuserpassword read -s -p "Enter a Guacamole User Database Password: " guacdbuserpassword
echo echo
read -s -p "Confirm Guacamole User Database Password: " password2 read -s -p "Confirm Guacamole User Database Password: " password2
@ -25,19 +44,26 @@ do
[ "$guacdbuserpassword" = "$password2" ] && break [ "$guacdbuserpassword" = "$password2" ] && break
echo "Passwords don't match. Please try again." echo "Passwords don't match. Please try again."
echo echo
done done
echo echo
fi
#Install Stuff #Install Stuff
apt update apt-get update
apt -y install docker.io mysql-client wget apt-get -y install docker.io mysql-client wget
# Get perfered download server # Set SERVER to be the preferred download server from the Apache CDN
SERVER="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${VERSION}-incubating" SERVER="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${GUACVERSION}"
# Download the Guacamole auth files for MySQL # Download Guacamole authentication extensions
wget -O guacamole-auth-jdbc-${VERSION}-incubating.tar.gz ${SERVER}/binary/guacamole-auth-jdbc-${VERSION}-incubating.tar.gz wget -O guacamole-auth-jdbc-${GUACVERSION}.tar.gz ${SERVER}/binary/guacamole-auth-jdbc-${GUACVERSION}.tar.gz
tar -xzf guacamole-auth-jdbc-${VERSION}-incubating.tar.gz if [ $? -ne 0 ]; then
echo "Failed to download guacamole-auth-jdbc-${GUACVERSION}.tar.gz"
echo "${SERVER}/binary/guacamole-auth-jdbc-${GUACVERSION}.tar.gz"
exit
fi
tar -xzf guacamole-auth-jdbc-${GUACVERSION}.tar.gz
# Start MySQL # Start MySQL
docker run --restart=always --detach --name=mysql --env="MYSQL_ROOT_PASSWORD=$mysqlrootpassword" --publish 3306:3306 mysql docker run --restart=always --detach --name=mysql --env="MYSQL_ROOT_PASSWORD=$mysqlrootpassword" --publish 3306:3306 mysql
@ -57,9 +83,9 @@ flush privileges;"
# Execute SQL Code # Execute SQL Code
echo $SQLCODE | mysql -h 127.0.0.1 -P 3306 -u root -p$mysqlrootpassword echo $SQLCODE | mysql -h 127.0.0.1 -P 3306 -u root -p$mysqlrootpassword
cat guacamole-auth-jdbc-${VERSION}-incubating/mysql/schema/*.sql | mysql -u root -p$mysqlrootpassword -h 127.0.0.1 -P 3306 guacamole_db cat guacamole-auth-jdbc-${GUACVERSION}/mysql/schema/*.sql | mysql -u root -p$mysqlrootpassword -h 127.0.0.1 -P 3306 guacamole_db
docker run --restart=always --name guacd -d guacamole/guacd docker run --restart=always --name guacd -d guacamole/guacd
docker run --restart=always --name guacamole --link mysql:mysql --link guacd:guacd -e MYSQL_HOSTNAME=127.0.0.1 -e MYSQL_DATABASE=guacamole_db -e MYSQL_USER=guacamole_user -e MYSQL_PASSWORD=$guacdbuserpassword --detach -p 8080:8080 guacamole/guacamole docker run --restart=always --name guacamole --link mysql:mysql --link guacd:guacd -e MYSQL_HOSTNAME=127.0.0.1 -e MYSQL_DATABASE=guacamole_db -e MYSQL_USER=guacamole_user -e MYSQL_PASSWORD=$guacdbuserpassword --detach -p 8080:8080 guacamole/guacamole
rm -rf guacamole-auth-jdbc-${VERSION}-incubating* rm -rf guacamole-auth-jdbc-${GUACVERSION}*

View File

@ -1,23 +1,30 @@
#!/bin/bash #!/bin/bash
VERSION="0.9.14" GUACVERSION="0.9.14"
# Ubuntu and Debian have different names of the libjpeg-turbo library for some reason... # Ubuntu and Debian have different names of the libjpeg-turbo library for some reason...
source /etc/lsb-release source /etc/os-release
if [[ "${NAME}" == "Ubuntu" ]]
if [ $DISTRIB_ID == "Ubuntu" ]
then then
JPEGTURBO="libjpeg-turbo8-dev" JPEGTURBO="libjpeg-turbo8-dev"
else if [[ "${VERSION_ID}" == "16.04" ]]
JPEGTURBO="libjpeg62-turbo-dev" then
fi
# Ubuntu 16.10 has a different name for libpng12-dev for some reason...
if [ $DISTRIB_RELEASE == "16.10" ]
then
LIBPNG="libpng-dev"
else
LIBPNG="libpng12-dev" LIBPNG="libpng12-dev"
else
LIBPNG="libpng-dev"
fi
elif [[ "${NAME}" == *"Debian"* ]]
then
JPEGTURBO="libjpeg62-turbo-dev"
if [[ "${PRETTY_NAME}" == *"stretch"* ]]
then
LIBPNG="libpng-dev"
else
LIBPNG="libpng12-dev"
fi
else
echo "Unsupported Distro - Ubuntu or Debian Only"
exit
fi fi
# Install Server Features # Install Server Features
@ -33,28 +40,39 @@ then
exit exit
fi fi
# Set SERVER to be the preferred download server from the Apache CDN # Hack for gcc7
SERVER="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${VERSION}-incubating" if [[ $(gcc --version | head -n1 | grep -oP '\)\K.*' | awk '{print $1}' | grep "^7" | wc -l) -gt 0 ]]
then
apt-get -y install gcc-6
if [ $? -ne 0 ]
then
echo "apt-get failed to install gcc-6"
exit
fi
fi
# Download Guacamole Files # Set SERVER to be the preferred download server from the Apache CDN
wget -O guacamole-server-${VERSION}-incubating.tar.gz ${SERVER}/source/guacamole-server-${VERSION}-incubating.tar.gz SERVER="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${GUACVERSION}"
if [ ! -f ./guacamole-server-${VERSION}-incubating.tar.gz ]; then
echo "Failed to download guacamole-server-${VERSION}-incubating.tar.gz" # Download Guacamole Server
echo "${SERVER}/source/guacamole-server-${VERSION}-incubating.tar.gz" wget -O guacamole-server-${GUACVERSION}.tar.gz ${SERVER}/source/guacamole-server-${GUACVERSION}.tar.gz
if [ $? -ne 0 ]; then
echo "Failed to download guacamole-server-${GUACVERSION}.tar.gz"
echo "${SERVER}/source/guacamole-server-${GUACVERSION}.tar.gz"
exit exit
fi fi
# Extract Guacamole Files # Extract Guacamole Files
tar -xzf guacamole-server-${VERSION}-incubating.tar.gz tar -xzf guacamole-server-${GUACVERSION}.tar.gz
# Make Directories # Make Directories
mkdir /etc/guacamole mkdir /etc/guacamole
# Install guacd # Install guacd
cd guacamole-server-${VERSION}-incubating cd guacamole-server-${GUACVERSION}
./configure --with-init-dir=/etc/init.d CC="gcc-6" ./configure --with-init-dir=/etc/init.d
make CC="gcc-6" make
make install CC="gcc-6" make install
ldconfig ldconfig
cd .. cd ..

View File

@ -4,7 +4,7 @@
GUACVERSION="0.9.14" GUACVERSION="0.9.14"
# Update apt so we can search apt-cache for newest tomcat version supported # Update apt so we can search apt-cache for newest tomcat version supported
apt update apt-get update
# Get script arguments for non-interactive mode # Get script arguments for non-interactive mode
while [ "$1" != "" ]; do while [ "$1" != "" ]; do
@ -93,17 +93,28 @@ fi
#TOMCAT="" #TOMCAT=""
# Install features # Install features
apt -y install build-essential libcairo2-dev ${JPEGTURBO} ${LIBPNG} libossp-uuid-dev libavcodec-dev libavutil-dev \ apt-get -y install build-essential libcairo2-dev ${JPEGTURBO} ${LIBPNG} libossp-uuid-dev libavcodec-dev libavutil-dev \
libswscale-dev libfreerdp-dev libpango1.0-dev libssh2-1-dev libtelnet-dev libvncserver-dev libpulse-dev libssl-dev \ libswscale-dev libfreerdp-dev libpango1.0-dev libssh2-1-dev libtelnet-dev libvncserver-dev libpulse-dev libssl-dev \
libvorbis-dev libwebp-dev mysql-server mysql-client mysql-common mysql-utilities libmysql-java ${TOMCAT} freerdp-x11 \ libvorbis-dev libwebp-dev mysql-server mysql-client mysql-common mysql-utilities libmysql-java ${TOMCAT} freerdp-x11 \
ghostscript wget dpkg-dev 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 [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "apt failed to install all required dependencies" echo "apt-get failed to install all required dependencies"
exit exit
fi fi
# Hack for gcc7
if [[ $(gcc --version | head -n1 | grep -oP '\)\K.*' | awk '{print $1}' | grep "^7" | wc -l) -gt 0 ]]
then
apt-get -y install gcc-6
if [ $? -ne 0 ]
then
echo "apt-get failed to install gcc-6"
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/${GUACVERSION}" SERVER="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${GUACVERSION}"
@ -139,11 +150,11 @@ tar -xzf guacamole-auth-jdbc-${GUACVERSION}.tar.gz
mkdir -p /etc/guacamole/lib mkdir -p /etc/guacamole/lib
mkdir -p /etc/guacamole/extensions mkdir -p /etc/guacamole/extensions
# Install guacd # Install guacd # Hack for gcc7 #
cd guacamole-server-${GUACVERSION} cd guacamole-server-${GUACVERSION}
./configure --with-init-dir=/etc/init.d CC="gcc-6" ./configure --with-init-dir=/etc/init.d
make CC="gcc-6" make
make install CC="gcc-6" make install
ldconfig ldconfig
systemctl enable guacd systemctl enable guacd
cd .. cd ..

View File

@ -72,12 +72,18 @@ if [ $? -ne 0 ]; then
exit exit
fi fi
# Hack for gcc7
if [[ $(gcc --version | head -n1 | grep -oP '\)\K.*' | awk '{print $1}' | grep "^7" | wc -l) -gt 0 ]]
then
apt-get -y install gcc-6
fi
# Upgrade Guacamole Server # Upgrade Guacamole Server
tar -xzf guacamole-server-${GUACVERSION}.tar.gz tar -xzf guacamole-server-${GUACVERSION}.tar.gz
cd guacamole-server-${GUACVERSION} cd guacamole-server-${GUACVERSION}
./configure --with-init-dir=/etc/init.d CC="gcc-6" ./configure --with-init-dir=/etc/init.d
make CC="gcc-6" make
make install CC="gcc-6" make install
ldconfig ldconfig
systemctl enable guacd systemctl enable guacd
cd .. cd ..