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,43 +1,69 @@
#!/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
echo
while true
do
read -s -p "Enter a MySQL ROOT Password: " mysqlrootpassword
if [ -n "$mysqlpwd" ] && [ -n "$guacpwd" ]; then
mysqlrootpassword=$mysqlpwd
guacdbuserpassword=$guacpwd
else
echo
while true
do
read -s -p "Enter a MySQL ROOT Password: " mysqlrootpassword
echo
read -s -p "Confirm MySQL ROOT Password: " password2
echo
[ "$mysqlrootpassword" = "$password2" ] && break
echo "Passwords don't match. Please try again."
echo
done
echo
read -s -p "Confirm MySQL ROOT Password: " password2
while true
do
read -s -p "Enter a Guacamole User Database Password: " guacdbuserpassword
echo
read -s -p "Confirm Guacamole User Database Password: " password2
echo
[ "$guacdbuserpassword" = "$password2" ] && break
echo "Passwords don't match. Please try again."
echo
done
echo
[ "$mysqlrootpassword" = "$password2" ] && break
echo "Passwords don't match. Please try again."
echo
done
echo
while true
do
read -s -p "Enter a Guacamole User Database Password: " guacdbuserpassword
echo
read -s -p "Confirm Guacamole User Database Password: " password2
echo
[ "$guacdbuserpassword" = "$password2" ] && break
echo "Passwords don't match. Please try again."
echo
done
echo
fi
#Install Stuff
apt update
apt -y install docker.io mysql-client wget
apt-get update
apt-get -y install docker.io mysql-client wget
# Get perfered download server
SERVER="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${VERSION}-incubating"
# Set SERVER to be the preferred download server from the Apache CDN
SERVER="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${GUACVERSION}"
# Download the Guacamole auth files for MySQL
wget -O guacamole-auth-jdbc-${VERSION}-incubating.tar.gz ${SERVER}/binary/guacamole-auth-jdbc-${VERSION}-incubating.tar.gz
tar -xzf guacamole-auth-jdbc-${VERSION}-incubating.tar.gz
# Download Guacamole authentication extensions
wget -O guacamole-auth-jdbc-${GUACVERSION}.tar.gz ${SERVER}/binary/guacamole-auth-jdbc-${GUACVERSION}.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
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
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 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
VERSION="0.9.14"
GUACVERSION="0.9.14"
# Ubuntu and Debian have different names of the libjpeg-turbo library for some reason...
source /etc/lsb-release
if [ $DISTRIB_ID == "Ubuntu" ]
source /etc/os-release
if [[ "${NAME}" == "Ubuntu" ]]
then
JPEGTURBO="libjpeg-turbo8-dev"
else
JPEGTURBO="libjpeg62-turbo-dev"
fi
# Ubuntu 16.10 has a different name for libpng12-dev for some reason...
if [ $DISTRIB_RELEASE == "16.10" ]
if [[ "${VERSION_ID}" == "16.04" ]]
then
LIBPNG="libpng12-dev"
else
LIBPNG="libpng-dev"
fi
elif [[ "${NAME}" == *"Debian"* ]]
then
LIBPNG="libpng-dev"
JPEGTURBO="libjpeg62-turbo-dev"
if [[ "${PRETTY_NAME}" == *"stretch"* ]]
then
LIBPNG="libpng-dev"
else
LIBPNG="libpng12-dev"
fi
else
LIBPNG="libpng12-dev"
echo "Unsupported Distro - Ubuntu or Debian Only"
exit
fi
# Install Server Features
@ -33,28 +40,39 @@ then
exit
fi
# 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"
# 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
# Download Guacamole Files
wget -O guacamole-server-${VERSION}-incubating.tar.gz ${SERVER}/source/guacamole-server-${VERSION}-incubating.tar.gz
if [ ! -f ./guacamole-server-${VERSION}-incubating.tar.gz ]; then
echo "Failed to download guacamole-server-${VERSION}-incubating.tar.gz"
echo "${SERVER}/source/guacamole-server-${VERSION}-incubating.tar.gz"
# Set SERVER to be the preferred download server from the Apache CDN
SERVER="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${GUACVERSION}"
# Download Guacamole Server
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
fi
# Extract Guacamole Files
tar -xzf guacamole-server-${VERSION}-incubating.tar.gz
tar -xzf guacamole-server-${GUACVERSION}.tar.gz
# Make Directories
mkdir /etc/guacamole
# Install guacd
cd guacamole-server-${VERSION}-incubating
./configure --with-init-dir=/etc/init.d
make
make install
cd guacamole-server-${GUACVERSION}
CC="gcc-6" ./configure --with-init-dir=/etc/init.d
CC="gcc-6" make
CC="gcc-6" make install
ldconfig
cd ..

View File

@ -4,7 +4,7 @@
GUACVERSION="0.9.14"
# 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
while [ "$1" != "" ]; do
@ -93,17 +93,28 @@ fi
#TOMCAT=""
# 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 \
libvorbis-dev libwebp-dev mysql-server mysql-client mysql-common mysql-utilities libmysql-java ${TOMCAT} freerdp-x11 \
ghostscript wget dpkg-dev
# If apt fails to run completely the rest of this isn't going to work...
if [ $? -ne 0 ]; then
echo "apt failed to install all required dependencies"
echo "apt-get failed to install all required dependencies"
exit
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
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/extensions
# Install guacd
# Install guacd # Hack for gcc7 #
cd guacamole-server-${GUACVERSION}
./configure --with-init-dir=/etc/init.d
make
make install
CC="gcc-6" ./configure --with-init-dir=/etc/init.d
CC="gcc-6" make
CC="gcc-6" make install
ldconfig
systemctl enable guacd
cd ..

View File

@ -72,12 +72,18 @@ if [ $? -ne 0 ]; then
exit
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
tar -xzf guacamole-server-${GUACVERSION}.tar.gz
cd guacamole-server-${GUACVERSION}
./configure --with-init-dir=/etc/init.d
make
make install
CC="gcc-6" ./configure --with-init-dir=/etc/init.d
CC="gcc-6" make
CC="gcc-6" make install
ldconfig
systemctl enable guacd
cd ..