dns/write

This commit is contained in:
Marc Beninca 2024-09-01 19:27:43 +02:00
parent ab655c52d9
commit 31e2875965
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -199,6 +199,26 @@ _spcd_txt_pick() {
# │ functions │ # │ 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 │ # │ functions │ error │
# ╰───────────┴───────╯ # ╰───────────┴───────╯
@ -896,16 +916,7 @@ spcd_query_package() {
spcd_step__dns() { spcd_step__dns() {
spcd_step "DNS" spcd_step "DNS"
local index value text spcd_dns "write"
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}"
} }
# ╭──────┬──────────╮ # ╭──────┬──────────╮