wagon/back/lib/ns_update_del

27 lines
738 B
Bash
Executable File

#!/bin/bash
# FILE: wgapi:back/lib/ns/update/del
# DESCRIPTION: Use nsupdate to delete host RRs
# USAGE: del domain ipv4 ipv6
# ERRORS:
# 3: Bad usage
# 4: Config not found
# 5: nsupdate failed
CONFIG_FILE='/etc/wgapi/config'
if ! [ ${#} -eq 3 ]; then
printf 'ERROR! Invalid number of arguments to %s: %s\n' "${0}" "${*}" >&2
exit 3
fi; if ! [ -f "${CONFIG_FILE}" ]; then
printf 'ERROR! %s couldnt find %s\n' "${0}" "${CONFIG_FILE}" >&2
exit 4
fi
source "${CONFIG_FILE}"
"${LIB_DIR}/ns_update_send" "update delete ${1}. A
update delete ${1}. AAAA
update delete *.${1}. CNAME
send
update delete $("${LIB_DIR}/ns_update_rev_ipv4" "${2}") PTR
send
update delete $("${LIB_DIR}/ns_update_rev_ipv6" "${3}") PTR" || exit 5