Allow setting super user in stanza config

This commit is contained in:
2025-12-02 14:55:36 +09:00
parent 6efe39d8ad
commit 3a7251d84e
3 changed files with 23 additions and 1 deletions

View File

@@ -185,6 +185,8 @@ while read -r stanza; do
stanza_repo=$(echo "${stanza}" | awk -F':' '{print (NF>1) ? $2 : ""}');
# if we have a config
stanza_config=$(echo "${stanza}" | awk -F':' '{print (NF>1) ? $3 : ""}');
# for possible override super user
stanza_super_user=$(echo "${stanza}" | awk -F':' '{print (NF>3) ? $4 : ""}');
# override stanza check
if [ -n "${OVERRIDE_STANZA}" ]; then
# skip if not matching name
@@ -198,6 +200,7 @@ while read -r stanza; do
fi;
# set repo from override
stanza_repo="${OVERRIDE_STANZA_REPO}";
# config
OVERRIDE_STANZA_CONFIG=$(echo "${OVERRIDE_STANZA}" | awk -F':' '{print (NF>2) ? $3 : ""}');
# if we have a config set in the stanza config, but none in the override, use the one from the stanza config
if [ -z "${OVERRIDE_STANZA_CONFIG}" ] && [ -n "${stanza_config}" ]; then
@@ -205,6 +208,17 @@ while read -r stanza; do
else
stanza_config="${OVERRIDE_STANZA_CONFIG}";
fi;
# super user
OVERRIDE_STANZA_SUPER_USER=$(echo "${OVERRIDE_STANZA}" | awk -F':' '{print (NF>3) ? $4 : ""}');
if [ -z "${OVERRIDE_STANZA_SUPER_USER}" ] && [ -n "${stanza_super_user}" ]; then
OVERRIDE_STANZA_SUPER_USER="${stanza_super_user}";
else
stanza_super_user="${OVERRIDE_STANZA_SUPER_USER}";
fi;
fi;
# set override sudo user
if [ -n "${stanza_super_user}" ]; then
sudo_user="${stanza_super_user}";
fi;
# build the call command
CALL=(