factorize/dns

This commit is contained in:
Marc Beninca 2024-09-03 18:19:26 +02:00
parent 095b343fde
commit a0122d5ea3
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
2 changed files with 16 additions and 22 deletions

View file

@ -230,7 +230,6 @@ Handle project workflows in a unified way:
* available * available
* effective * effective
* factorize * factorize
* dns
* locales * locales
* handle errors * handle errors
* packages * packages

View file

@ -224,32 +224,27 @@ spcd_ca() {
} }
spcd_dns() { spcd_dns() {
local index name value local index name text value
case "${1}" in while true; do
"list") index=$((index + 1))
while true; do name="SPCD_DNS_${index}"
index=$((index + 1)) eval "value=\"\${${name}}\""
name="SPCD_DNS_${index}" [ -n "${value}" ] || break
eval "value=\"\${${name}}\"" case "${1}" in
[ -n "${value}" ] || break "list")
spcd_os_printenv "${name}" spcd_os_printenv "${name}"
done ;;
;; "write")
"write")
local text
while true; do
index=$((index + 1))
name="SPCD_DNS_${index}"
eval "value=\"\${${name}}\""
[ -n "${value}" ] || break
text="${text}\ text="${text}\
nameserver ${value} nameserver ${value}
" "
done ;;
*) ;;
esac
done
if [ "${1}" = "write" ]; then
spcd_os_write "/etc/resolv.conf" "${text}" spcd_os_write "/etc/resolv.conf" "${text}"
;; fi
*) ;;
esac
} }
# ╭───────────┬───────╮ # ╭───────────┬───────╮