simplify enumeration loops for dns & ca

This commit is contained in:
Marc Beninca 2024-08-07 12:31:06 +02:00
parent 0387195fa8
commit c7617ec6c6
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

14
spcd.sh
View file

@ -528,14 +528,13 @@ spcd_set_https_verification_off() {
spcd_set_dns_resolving() {
spcd_step "Set DNS resolving"
spcd_sdr__index=1
while true; do
spcd_sdr__index=$((spcd_sdr__index + 1))
eval "spcd_sdr__value=\"\${SPCD_DNS_${spcd_sdr__index}}\""
while [ -n "${spcd_sdr__value}" ]; do
[ -n "${spcd_sdr__value}" ] || break
spcd_sdr__text="${spcd_sdr__text}\
nameserver ${spcd_sdr__value}
"
spcd_sdr__index=$((spcd_sdr__index + 1))
eval "spcd_sdr__value=\"\${SPCD_DNS_${spcd_sdr__index}}\""
done
spcd_write "${SPCD_DNS_FILE}" "${spcd_sdr__text}"
}
@ -558,15 +557,14 @@ spcd_install_ca_certificates() {
spcd_write_ca_certificates() {
spcd_step "Write CA certificates"
spcd_mkdir "${SPCD_CA_ROOT}"
spcd_wcc__index=1
while true; do
spcd_wcc__index=$((spcd_wcc__index + 1))
eval "spcd_wcc__text=\"\${SPCD_CA_${spcd_wcc__index}}\""
while [ -n "${spcd_wcc__text}" ]; do
[ -n "${spcd_wcc__text}" ] || break
spcd_wcc__path="${SPCD_CA_ROOT}/${spcd_wcc__index}.crt"
spcd_split
spcd_write "${spcd_wcc__path}" "${spcd_wcc__text}"
spcd_openssl "${spcd_wcc__path}"
spcd_wcc__index=$((spcd_wcc__index + 1))
eval "spcd_wcc__text=\"\${SPCD_CA_${spcd_wcc__index}}\""
done
}