From 5d9418091dd6180dd2010a05ad096fe1a7e408ae Mon Sep 17 00:00:00 2001 From: Jordan Jethwa Date: Mon, 9 Jan 2023 15:54:46 +0100 Subject: [PATCH] only set values if RUNDECK_STORAGE_PASSWORD set --- content/opt/run | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/content/opt/run b/content/opt/run index 53ca5ef..6f53b4c 100644 --- a/content/opt/run +++ b/content/opt/run @@ -67,7 +67,6 @@ if [ ! -f "${initfile}" ]; then RUNDECK_PASSWORD=${RUNDECK_PASSWORD:-$(pwgen -s 15 1)} DATABASE_ADMIN_PASSWORD=${DATABASE_ADMIN_PASSWORD:-${RUNDECK_PASSWORD}} DATABASE_ADMIN_USER=${DATABASE_ADMIN_USER:-rundeck} - RUNDECK_STORAGE_PASSWORD=${RUNDECK_STORAGE_PASSWORD:-$(pwgen -s 15 1)} RUNDECK_STORAGE_PROVIDER=${RUNDECK_STORAGE_PROVIDER:-"db"} NO_LOCAL_MYSQL=${NO_LOCAL_MYSQL:-"false"} SKIP_DATABASE_SETUP=${SKIP_DATABASE_SETUP:-"false"} @@ -303,15 +302,17 @@ if [ ! -f "${initfile}" ]; then else echo "rundeck.config.storage.converter.1.path=/" >> /etc/rundeck/rundeck-config.properties fi - if grep -q rundeck.storage.converter.1.config.password /etc/rundeck/rundeck-config.properties ; then - sed -i 's/rundeck\.storage\.converter\.1\.config\.password.*$/rundeck\.storage\.converter\.1\.config\.password='${RUNDECK_STORAGE_PASSWORD}'/g' /etc/rundeck/rundeck-config.properties - else - echo "rundeck.storage.converter.1.config.password=${RUNDECK_STORAGE_PASSWORD}" >> /etc/rundeck/rundeck-config.properties - fi - if grep -q rundeck.config.storage.converter.1.config.password /etc/rundeck/rundeck-config.properties ; then - sed -i 's/rundeck\.config\.storage\.converter\.1\.config\.password.*$/rundeck\.config\.storage\.converter\.1\.config\.password='${RUNDECK_STORAGE_PASSWORD}'/g' /etc/rundeck/rundeck-config.properties - else - echo "rundeck.config.storage.converter.1.config.password=${RUNDECK_STORAGE_PASSWORD}" >> /etc/rundeck/rundeck-config.properties + if ! [ -z "${RUNDECK_STORAGE_PASSWORD}" ]; then + if grep -q rundeck.storage.converter.1.config.password /etc/rundeck/rundeck-config.properties ; then + sed -i 's/rundeck\.storage\.converter\.1\.config\.password.*$/rundeck\.storage\.converter\.1\.config\.password='${RUNDECK_STORAGE_PASSWORD}'/g' /etc/rundeck/rundeck-config.properties + else + echo "rundeck.storage.converter.1.config.password=${RUNDECK_STORAGE_PASSWORD}" >> /etc/rundeck/rundeck-config.properties + fi + if grep -q rundeck.config.storage.converter.1.config.password /etc/rundeck/rundeck-config.properties ; then + sed -i 's/rundeck\.config\.storage\.converter\.1\.config\.password.*$/rundeck\.config\.storage\.converter\.1\.config\.password='${RUNDECK_STORAGE_PASSWORD}'/g' /etc/rundeck/rundeck-config.properties + else + echo "rundeck.config.storage.converter.1.config.password=${RUNDECK_STORAGE_PASSWORD}" >> /etc/rundeck/rundeck-config.properties + fi fi fi