From b414222048b67e1e6c3ba2d21367d9e63d02fb31 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 6 Aug 2024 12:53:23 +0200 Subject: [PATCH] enumerate name servers --- readme.md | 5 ++--- spcd.sh | 12 +++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/readme.md b/readme.md index 0a33a01..30b7aa9 100644 --- a/readme.md +++ b/readme.md @@ -44,8 +44,8 @@ from various contexts of CA, CI and OCI / OS. | SPCD_BRANCH_RELEASE | Release deployment branch | main | | SPCD_BRANCH_STAGING | Staging deployment branch | dev | | SPCD_BRANCH_FEATURE | Feature deployment branch | f | -| SPCD_CA_n | Numbered CA certificate | | -| SPCD_DNS | Space separated servers | 9.9.9.9 | +| SPCD_CA_n | Numbered CA certificates | | +| SPCD_DNS_n | Numbered name servers | 9.9.9.9 | | SPCD_GIT_MAIN | Main Git repository | spcd | | SPCD_GIT_ROOT | Root Git repository | rwx | | SPCD_SSH_HOSTS | domain.tld ssh-type pub | | @@ -83,7 +83,6 @@ from various contexts of CA, CI and OCI / OS. * define templates * actions * includes -* enumerate name servers * handle python virtual environment * install venv if necessary * upgrade pip diff --git a/spcd.sh b/spcd.sh index 32be9e9..6af63bf 100644 --- a/spcd.sh +++ b/spcd.sh @@ -4,9 +4,7 @@ [ -n "${SPCD_BRANCH_RELEASE}" ] || SPCD_BRANCH_RELEASE="main" [ -n "${SPCD_BRANCH_STAGING}" ] || SPCD_BRANCH_STAGING="dev" [ -n "${SPCD_BRANCH_FEATURE}" ] || SPCD_BRANCH_FEATURE="f" -[ -n "${SPCD_DNS}" ] || SPCD_DNS="\ -9.9.9.9 \ -" +[ -n "${SPCD_DNS_1}" ] || SPCD_DNS_1="9.9.9.9" [ -n "${SPCD_GIT_MAIN}" ] || SPCD_GIT_MAIN="spcd" [ -n "${SPCD_GIT_ROOT}" ] || SPCD_GIT_ROOT="rwx" @@ -529,10 +527,14 @@ spcd_set_https_verification_off() { spcd_set_dns_resolving() { spcd_step "Set DNS resolving" - for spcd_sdr__server in ${SPCD_DNS}; do + spcd_sdr__index=1 + eval "spcd_sdr__value=\"\${SPCD_DNS_${spcd_sdr__index}}\"" + while [ -n "${spcd_sdr__value}" ]; do spcd_sdr__text="${spcd_sdr__text}\ -nameserver ${spcd_sdr__server} +nameserver ${spcd_sdr__value} " + spcd_sdr__index=$((spcd_sdr__index + 1)) + eval "spcd_sdr__value=\"\${SPCD_DNS_${spcd_sdr__index}}\"" done spcd_write "${SPCD_DNS_FILE}" "${spcd_sdr__text}" }