1
0
mirror of https://git.koehlerweb.org/frodovdr/guac-install synced 2025-07-03 15:53:33 +02:00

Add Non-Interactive Option (#37)

Thanks to @bigredthelogger for providing the initial code

* Add Non-Interactive Option to Installer

* Update README for Non-Interactive Options

* Add Non-Interactive Option to Upgrade
This commit is contained in:
Chase Wright
2018-03-09 15:51:48 -06:00
committed by GitHub
parent a3375c6805
commit 9a6da88418
3 changed files with 94 additions and 41 deletions

View File

@ -1,23 +1,40 @@
#!/bin/bash
# Version Numbers of Guacamole to download
GUACVERSION="0.9.14"
# Try to get database from /etc/guacamole/guacamole.properties
DATABASE=$(grep -oP 'mysql-database:\K.*' /etc/guacamole/guacamole.properties | awk '{print $1}')
MYSQL_SERVER=$(grep -oP 'mysql-hostname:\K.*' /etc/guacamole/guacamole.properties | awk '{print $1}')
# Get MySQL root password
echo
while true
do
read -s -p "Enter MySQL ROOT Password: " mysqlrootpassword
export MYSQL_PWD=${mysqlrootpassword}
echo
mysql -u root -h ${MYSQL_SERVER} ${DATABASE} -e"quit" && break
echo
# Get script arguments for non-interactive mode
while [ "$1" != "" ]; do
case $1 in
-m | --mysqlpwd )
shift
mysqlpwd="$1"
;;
esac
shift
done
echo
# Version Numbers of Guacamole to download
GUACVERSION="0.9.14"
# Get MySQL root password
if [ -n "$mysqlpwd" ]; then
mysqlrootpassword=$mysqlpwd
export MYSQL_PWD=${mysqlrootpassword}
mysql -u root -h ${MYSQL_SERVER} ${DATABASE} -e"quit" || exit
else
echo
while true
do
read -s -p "Enter MySQL ROOT Password: " mysqlrootpassword
export MYSQL_PWD=${mysqlrootpassword}
echo
mysql -u root -h ${MYSQL_SERVER} ${DATABASE} -e"quit" && break
echo
done
echo
fi
# Get Tomcat Version
TOMCAT=$(ls /etc/ | grep tomcat)