From a0122d5ea32ec84922df7110296496272010c378 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 3 Sep 2024 18:19:26 +0200 Subject: [PATCH] factorize/dns --- readme.md | 1 - spcd/bootstrap.sh | 37 ++++++++++++++++--------------------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/readme.md b/readme.md index ce580ee..8d54773 100644 --- a/readme.md +++ b/readme.md @@ -230,7 +230,6 @@ Handle project workflows in a unified way: * available * effective * factorize - * dns * locales * handle errors * packages diff --git a/spcd/bootstrap.sh b/spcd/bootstrap.sh index 2d17ee3..03374b9 100644 --- a/spcd/bootstrap.sh +++ b/spcd/bootstrap.sh @@ -224,32 +224,27 @@ spcd_ca() { } spcd_dns() { - local index name value - case "${1}" in - "list") - while true; do - index=$((index + 1)) - name="SPCD_DNS_${index}" - eval "value=\"\${${name}}\"" - [ -n "${value}" ] || break + local index name text value + while true; do + index=$((index + 1)) + name="SPCD_DNS_${index}" + eval "value=\"\${${name}}\"" + [ -n "${value}" ] || break + case "${1}" in + "list") spcd_os_printenv "${name}" - done - ;; - "write") - local text - while true; do - index=$((index + 1)) - name="SPCD_DNS_${index}" - eval "value=\"\${${name}}\"" - [ -n "${value}" ] || break + ;; + "write") text="${text}\ nameserver ${value} " - done + ;; + *) ;; + esac + done + if [ "${1}" = "write" ]; then spcd_os_write "/etc/resolv.conf" "${text}" - ;; - *) ;; - esac + fi } # ╭───────────┬───────╮