diff --git a/spcd/bootstrap.sh b/spcd/bootstrap.sh index 1d0592e..8df7a3b 100644 --- a/spcd/bootstrap.sh +++ b/spcd/bootstrap.sh @@ -199,6 +199,26 @@ _spcd_txt_pick() { # │ functions │ # ╰───────────╯ +spcd_dns() { + local index name value + case "${1}" in + "write") + local text + while true; do + index=$((index + 1)) + name="SPCD_DNS_${index}" + eval "value=\"\${name}\"" + [ -n "${value}" ] || break + text="${text}\ +nameserver ${value} +" + done + spcd_os_write "/etc/resolv.conf" "${text}" + ;; + *) ;; + esac +} + # ╭───────────┬───────╮ # │ functions │ error │ # ╰───────────┴───────╯ @@ -896,16 +916,7 @@ spcd_query_package() { spcd_step__dns() { spcd_step "DNS" - local index value text - while true; do - index=$((index + 1)) - eval "value=\"\${SPCD_DNS_${index}}\"" - [ -n "${value}" ] || break - text="${text}\ -nameserver ${value} -" - done - spcd_os_write "/etc/resolv.conf" "${text}" + spcd_dns "write" } # ╭──────┬──────────╮