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
* effective
* factorize
* dns
* locales
* handle errors
* packages

View file

@ -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
}
# ╭───────────┬───────╮