2 # Thanks goes to Alex Griffin who provided this script.
4 .
/usr
/share
/libubox
/jshn.sh
8 local __ENDPOINT
="https://api.gandi.net/v5/livedns"
11 [ -z "$username" ] && write_log
14 "Service section not configured correctly! Missing subdomain as 'username'"
12 [ -z "$password" ] && write_log
14 "Service section not configured correctly! Missing API Key as 'password'"
14 [ $use_ipv6 -ne 0 ] && __RRTYPE
="AAAA" || __RRTYPE
="A"
16 # Construct JSON payload
18 json_add_int rrset_ttl
"$__TTL"
19 json_add_array rrset_values
20 json_add_string
"" "$__IP"
23 __STATUS
=$
(curl
-s -X PUT
"$__ENDPOINT/domains/$domain/records/$username/$__RRTYPE" \
24 -H "Authorization: Apikey $password" \
25 -H "Content-Type: application/json" \
27 -w "%{http_code}\n" -o $DATFILE 2>$ERRFILE)
30 write_log
14 "Curl failed: $(cat $ERRFILE)"
32 elif [ -z $__STATUS ] ||
[ $__STATUS != 201 ]; then
33 write_log
14 "LiveDNS failed: $__STATUS \ngandi.net answered: $(cat $DATFILE)"
37 write_log
7 "gandi.net answered: $(cat $DATFILE)"