mirror of
https://github.com/MysticRyuujin/guac-install.git
synced 2023-10-10 13:36:56 +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:
parent
a3375c6805
commit
9a6da88418
32
README.md
32
README.md
@ -5,20 +5,30 @@ Run script, enter MySQL Root Password and Guacamole User password. Guacamole Use
|
||||
|
||||
The script attempts to install tomcat8 if the available version is 8.5.x or newer, if tomcat8 is only 8.0.x it will fall back to tomcat7. If you want to manually specify a tomcat version there's a commented out line you can modify at line #73. Have at it.
|
||||
|
||||
How to Run:
|
||||
## How to Run:
|
||||
|
||||
Download file directly from here:
|
||||
### Download file directly from here:
|
||||
|
||||
<code>wget https://raw.githubusercontent.com/MysticRyuujin/guac-install/master/guac-install.sh</code>
|
||||
|
||||
Make it executable:
|
||||
### Make it executable:
|
||||
|
||||
<code>chmod +x guac-install.sh</code>
|
||||
|
||||
Run it as root:
|
||||
### Run it as root:
|
||||
|
||||
Interactive (asks for passwords):
|
||||
|
||||
<code>./guac-install.sh</code>
|
||||
|
||||
Non-Interactive (passwords provided via cli):
|
||||
|
||||
<code>./guac-install.sh --mysqlpwd password --guacpwd password</code>
|
||||
|
||||
OR
|
||||
|
||||
<code>./guac-install.sh -m password -g password</code>
|
||||
|
||||
Once installation is done you can access guacamole by browsing to: http://<host_or_ip>:8080/guacamole/
|
||||
The default credentials are guacadmin as both username and password. Please change them or disable guacadmin after install!
|
||||
|
||||
@ -27,16 +37,22 @@ Script for upgrading currently installed Guacamole instance (previously installe
|
||||
|
||||
If looks for the tomcat folder in /etc/ (E.G. `/etc/tomcat7` or `/etc/tomcat8`) hopefully that works to identify the correct tomcat version/path :smile: I'm open to suggestions/pull requests for a cleaner method.
|
||||
|
||||
How to Run:
|
||||
## How to Run:
|
||||
|
||||
Download file directly from here:
|
||||
### Download file directly from here:
|
||||
|
||||
<code>wget https://raw.githubusercontent.com/MysticRyuujin/guac-install/master/guac-upgrade.sh</code>
|
||||
|
||||
Make it executable:
|
||||
### Make it executable:
|
||||
|
||||
<code>chmod +x guac-upgrade.sh</code>
|
||||
|
||||
Run it as root:
|
||||
### Run it as root:
|
||||
|
||||
Interactive (asks for passwords):
|
||||
|
||||
<code>./guac-upgrade.sh</code>
|
||||
|
||||
Non-Interactive (password provided via cli):
|
||||
|
||||
<code>./guac-upgrade.sh --mysqlpwd password</code>
|
||||
|
@ -6,30 +6,50 @@ GUACVERSION="0.9.14"
|
||||
# Update apt so we can search apt-cache for newest tomcat version supported
|
||||
apt update
|
||||
|
||||
# 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
|
||||
|
||||
debconf-set-selections <<< "mysql-server mysql-server/root_password password $mysqlrootpassword"
|
||||
debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $mysqlrootpassword"
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user