style(fmt): Reformat shell script
This commit is contained in:
@@ -391,6 +391,7 @@ fi
|
||||
|
||||
### initial log entries
|
||||
{
|
||||
|
||||
printf "%s[%s] -- Cloudflare DDNS update-script: starting --%s\n" "$ok" "$(stamp)" "$norm"
|
||||
printf "Parameters:\n"
|
||||
printf "script path: %s\n" "$scriptPath/$scriptName"
|
||||
@@ -428,7 +429,9 @@ fi
|
||||
record="${dnsRecordsToUpdate%%${dnsSeparator}*}"
|
||||
dnsRecordsToUpdate="${dnsRecordsToUpdate#*${dnsSeparator}}"
|
||||
|
||||
if [ -z "$record" ]; then continue; fi
|
||||
if [ -z "$record" ]; then
|
||||
continue
|
||||
fi
|
||||
printf "updating record: %s\n" "$record"
|
||||
done
|
||||
|
||||
@@ -472,13 +475,17 @@ while [ -n "$dnsRecordsToUpdate" ] && [ "$dnsRecordsToUpdate" != "$dnsSeparator"
|
||||
record="${dnsRecordsToUpdate%%${dnsSeparator}*}"
|
||||
dnsRecordsToUpdate="${dnsRecordsToUpdate#*${dnsSeparator}}"
|
||||
|
||||
if [ -z "$record" ]; then continue; fi
|
||||
if [ -z "$record" ]; then
|
||||
continue
|
||||
fi
|
||||
writeLog process "Processing ${record}"
|
||||
|
||||
# exit if curl/network error
|
||||
if ! cfLookup="$(curl -s -X GET "https://api.cloudflare.com/client/v4/zones/${cfZoneId}/dns_records?name=${record}&type=${recordType}" \
|
||||
if ! cfLookup="$(
|
||||
curl -s -X GET "https://api.cloudflare.com/client/v4/zones/${cfZoneId}/dns_records?name=${record}&type=${recordType}" \
|
||||
-H "Authorization: Bearer ${cfKey}" \
|
||||
-H "Content-Type: application/json")"; then
|
||||
-H "Content-Type: application/json"
|
||||
)"; then
|
||||
writeLog process-error
|
||||
exitError 3
|
||||
fi
|
||||
@@ -519,10 +526,12 @@ while [ -n "$dnsRecordsToUpdate" ] && [ "$dnsRecordsToUpdate" != "$dnsSeparator"
|
||||
updateJSON="$(jq -n --arg key0 content --arg value0 "${ipAddress}" '{($key0):$value0}')"
|
||||
|
||||
# exit if curl/network error
|
||||
if ! cfResult="$(curl -s -X PATCH "https://api.cloudflare.com/client/v4/zones/${cfZoneId}/dns_records/${objectId}" \
|
||||
if ! cfResult="$(
|
||||
curl -s -X PATCH "https://api.cloudflare.com/client/v4/zones/${cfZoneId}/dns_records/${objectId}" \
|
||||
-H "Authorization: Bearer ${cfKey}" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data "${updateJSON}")"; then
|
||||
--data "${updateJSON}"
|
||||
)"; then
|
||||
writeLog process-error
|
||||
exitError 3
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user