. entfernt und debug modus hinzugefügt

This commit is contained in:
Czechman 2023-01-11 22:46:06 +01:00
parent cebd24cdd6
commit b4230fca45
1 changed files with 18 additions and 4 deletions

View File

@ -35,7 +35,7 @@ set -e
case "$1" in case "$1" in
"present") "present")
echo "Present" echo "Present"
full_domain=${$2%"."} full_domain=${2%"."}
domain=$(echo $full_domain | rev | cut -d . -f -3 | rev) domain=$(echo $full_domain | rev | cut -d . -f -3 | rev)
praefix=${full_domain%"$domain"} praefix=${full_domain%"$domain"}
praefix=${praefix%"."} praefix=${praefix%"."}
@ -44,11 +44,11 @@ case "$1" in
praefix_pl="praefix=$praefix" praefix_pl="praefix=$praefix"
type_pl="type=TXT" type_pl="type=TXT"
content_pl="content=$3" content_pl="content=$3"
echo "fd= $full_domain, domain= $domain, praefix=$praefix, content=$content_pl " echo "fd=$full_domain, domain=$domain, praefix=$praefix, $content_pl"
curl -s -X POST -d "$domain_pl" -d "$praefix_pl" -d "$type_pl" -d "$content_pl" -H "$auth_h" https://ipv64.net/api curl -s -X POST -d "$domain_pl" -d "$praefix_pl" -d "$type_pl" -d "$content_pl" -H "$auth_h" https://ipv64.net/api
;; ;;
"cleanup") "cleanup")
full_domain=$2 full_domain=${2%"."}
domain=$(echo $full_domain | rev | cut -d . -f -3 | rev) domain=$(echo $full_domain | rev | cut -d . -f -3 | rev)
praefix=${full_domain%"$domain"} praefix=${full_domain%"$domain"}
praefix=${praefix%"."} praefix=${praefix%"."}
@ -57,9 +57,23 @@ case "$1" in
praefix_pl="praefix=$praefix" praefix_pl="praefix=$praefix"
type_pl="type=TXT" type_pl="type=TXT"
content_pl="content=$3" content_pl="content=$3"
echo "fd= $full_domain, domain= $domain, praefix=$praefix" echo "fd=$full_domain, domain= $domain, praefix=$praefix, $content_pl"
curl -s -X DELETE -d "$domain_pl" -d "$praefix_pl" -d "$type_pl" -d "$content_pl" -H "$auth_h" https://ipv64.net/api curl -s -X DELETE -d "$domain_pl" -d "$praefix_pl" -d "$type_pl" -d "$content_pl" -H "$auth_h" https://ipv64.net/api
;; ;;
"debug")
echo "Debug"
full_domain=${2%"."}
domain=$(echo $full_domain | rev | cut -d . -f -3 | rev)
praefix=${full_domain%"$domain"}
praefix=${praefix%"."}
auth_h="Authorization: Bearer $apitoken"
domain_pl="add_record=$domain"
praefix_pl="praefix=$praefix"
type_pl="type=TXT"
content_pl="content=$3"
echo "fd=$full_domain, domain=$domain, praefix=$praefix, $content_pl $auth_h"
curl -s -X POST -d "$domain_pl" -d "$praefix_pl" -d "$type_pl" -d "$content_pl" -H "$auth_h" https://ipv64.net/api
;;
*) *)
echo "OOPS" echo "OOPS"
;; ;;