From 1218e622b2b38a8121647eff98c2888193850145 Mon Sep 17 00:00:00 2001 From: Lee Porte Date: Tue, 1 Jul 2025 21:34:54 +0100 Subject: [PATCH] Add in some conditional command excecution Adding in a variable test and an if else statement to preserve existing logic in case there is another reason for it --- upgrade-guacamole.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/upgrade-guacamole.sh b/upgrade-guacamole.sh index ee01bfd..2bb06ac 100644 --- a/upgrade-guacamole.sh +++ b/upgrade-guacamole.sh @@ -231,7 +231,11 @@ if [[ "${INSTALL_MYSQL}" = true ]]; then FILEVERSION=$(echo ${FILE} | grep -oP 'upgrade-pre-\K[0-9\.]+(?=\.)') if [[ $(echo -e "${FILEVERSION}\n${OLD_GUAC_VERSION}" | sort -V | head -n1) == ${OLD_GUAC_VERSION} && ${FILEVERSION} != ${OLD_GUAC_VERSION} ]]; then echo "Patching ${GUAC_DB} with ${FILE}" - mysql -u root -p${MYSQL_ROOT_PWD} -D ${GUAC_DB} -h ${MYSQL_HOST} -P ${MYSQL_PORT} >${INSTALL_LOG} + if [[ ! -z "$MYSQL_ROOT_PWD" ]]; then + mysql -u root -p${MYSQL_ROOT_PWD} -D ${GUAC_DB} -h ${MYSQL_HOST} -P ${MYSQL_PORT} >${INSTALL_LOG} + else + mysql -u root -D ${GUAC_DB} -h ${MYSQL_HOST} -P ${MYSQL_PORT} >${INSTALL_LOG} + fi fi done if [[ $? -ne 0 ]]; then