1
0
Fork 0
mirror of https://github.com/tunix/digitalocean-dyndns synced 2024-12-22 12:59:52 +00:00

Compare commits

...

3 commits

Author SHA1 Message Date
Alper Kanat
7b38d97e38
Merge pull request #18 from ifrido/feature/wildcard-records
disable filename expansion during evalutation of the NAME env variable
2021-03-17 10:18:41 +03:00
Alper Kanat
c807533d14
Update dyndns.sh 2021-03-17 10:17:29 +03:00
ifrido
aa32217f37 disable filename expansion during evalutation of the NAME env variable 2021-03-06 21:56:19 +01:00

View file

@ -36,10 +36,16 @@ while ( true ); do
echo "Found IP address $ip" echo "Found IP address $ip"
if [[ -n $ip ]]; then if [[ -n $ip ]]; then
# disable glob expansion
set -f
for sub in ${NAME//;/ }; do for sub in ${NAME//;/ }; do
record_id=$(echo $domain_records| jq ".domain_records[] | select(.type == \"A\" and .name == \"$sub\") | .id") record_id=$(echo $domain_records| jq ".domain_records[] | select(.type == \"A\" and .name == \"$sub\") | .id")
record_data=$(echo $domain_records| jq -r ".domain_records[] | select(.type == \"A\" and .name == \"$sub\") | .data") record_data=$(echo $domain_records| jq -r ".domain_records[] | select(.type == \"A\" and .name == \"$sub\") | .data")
# re-enable glob expansion
set +f
test -z $record_id && echo "No record found with '$sub' domain name!" && continue test -z $record_id && echo "No record found with '$sub' domain name!" && continue
if [[ "$ip" != "$record_data" ]]; then if [[ "$ip" != "$record_data" ]]; then