simplify enumeration loops for dns & ca
This commit is contained in:
parent
0387195fa8
commit
c7617ec6c6
1 changed files with 8 additions and 10 deletions
14
spcd.sh
14
spcd.sh
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue