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.
|
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>
|
<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>
|
<code>chmod +x guac-install.sh</code>
|
||||||
|
|
||||||
Run it as root:
|
### Run it as root:
|
||||||
|
|
||||||
|
Interactive (asks for passwords):
|
||||||
|
|
||||||
<code>./guac-install.sh</code>
|
<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/
|
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!
|
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.
|
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>
|
<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>
|
<code>chmod +x guac-upgrade.sh</code>
|
||||||
|
|
||||||
Run it as root:
|
### Run it as root:
|
||||||
|
|
||||||
|
Interactive (asks for passwords):
|
||||||
|
|
||||||
<code>./guac-upgrade.sh</code>
|
<code>./guac-upgrade.sh</code>
|
||||||
|
|
||||||
|
Non-Interactive (password provided via cli):
|
||||||
|
|
||||||
|
<code>./guac-upgrade.sh --mysqlpwd password</code>
|
||||||
|
@ -6,10 +6,29 @@ 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 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
|
# 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
|
||||||
@ -17,10 +36,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
|
||||||
@ -28,8 +47,9 @@ 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
|
||||||
|
|
||||||
debconf-set-selections <<< "mysql-server mysql-server/root_password password $mysqlrootpassword"
|
debconf-set-selections <<< "mysql-server mysql-server/root_password password $mysqlrootpassword"
|
||||||
debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $mysqlrootpassword"
|
debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $mysqlrootpassword"
|
||||||
|
@ -1,23 +1,40 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Version Numbers of Guacamole to download
|
||||||
|
GUACVERSION="0.9.14"
|
||||||
|
|
||||||
# Try to get database from /etc/guacamole/guacamole.properties
|
# Try to get database from /etc/guacamole/guacamole.properties
|
||||||
DATABASE=$(grep -oP 'mysql-database:\K.*' /etc/guacamole/guacamole.properties | awk '{print $1}')
|
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}')
|
MYSQL_SERVER=$(grep -oP 'mysql-hostname:\K.*' /etc/guacamole/guacamole.properties | awk '{print $1}')
|
||||||
|
|
||||||
|
# Get script arguments for non-interactive mode
|
||||||
|
while [ "$1" != "" ]; do
|
||||||
|
case $1 in
|
||||||
|
-m | --mysqlpwd )
|
||||||
|
shift
|
||||||
|
mysqlpwd="$1"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
# Get MySQL root password
|
# Get MySQL root password
|
||||||
echo
|
if [ -n "$mysqlpwd" ]; then
|
||||||
while true
|
mysqlrootpassword=$mysqlpwd
|
||||||
do
|
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
|
read -s -p "Enter MySQL ROOT Password: " mysqlrootpassword
|
||||||
export MYSQL_PWD=${mysqlrootpassword}
|
export MYSQL_PWD=${mysqlrootpassword}
|
||||||
echo
|
echo
|
||||||
mysql -u root -h ${MYSQL_SERVER} ${DATABASE} -e"quit" && break
|
mysql -u root -h ${MYSQL_SERVER} ${DATABASE} -e"quit" && break
|
||||||
echo
|
echo
|
||||||
done
|
done
|
||||||
echo
|
echo
|
||||||
|
fi
|
||||||
# Version Numbers of Guacamole to download
|
|
||||||
GUACVERSION="0.9.14"
|
|
||||||
|
|
||||||
# Get Tomcat Version
|
# Get Tomcat Version
|
||||||
TOMCAT=$(ls /etc/ | grep tomcat)
|
TOMCAT=$(ls /etc/ | grep tomcat)
|
||||||
|
Loading…
Reference in New Issue
Block a user