rework thisfilename, add parent option, in advance of vpanel scripts
This commit is contained in:
parent
b7cd35384c
commit
45d0a9ed5c
|
@ -10,8 +10,6 @@ source $(dirname $0)/pdns.sh
|
|||
|
||||
help()
|
||||
{
|
||||
thisfilename=$(basename -- "$0")
|
||||
echo "$thisfilename"
|
||||
echo "Set/update PTR Record."
|
||||
echo ""
|
||||
echo "usage: $thisfilename -i <ip> [-r <record>] [-l <ttl>] [-s <status>] [-c <comment>] [-a <account>] [-h]"
|
||||
|
|
|
@ -10,8 +10,6 @@ source $(dirname $0)/pdns.sh
|
|||
|
||||
help()
|
||||
{
|
||||
thisfilename=$(basename -- "$0")
|
||||
echo "$thisfilename"
|
||||
echo "Delete Resource Record set in zone."
|
||||
echo ""
|
||||
echo "usage: $thisfilename -z <zone> -n <name> -t <type> [-h]"
|
||||
|
|
|
@ -10,8 +10,6 @@ source $(dirname $0)/pdns.sh
|
|||
|
||||
help()
|
||||
{
|
||||
thisfilename=$(basename -- "$0")
|
||||
echo "$thisfilename"
|
||||
echo "Replace Resource Record set in zone."
|
||||
echo ""
|
||||
echo "usage: $thisfilename -z <zone> -n <name> -t <type> -r <record> [-l <ttl>] [-s <status>] [-c <comment>] [-a <account>] [-h]"
|
||||
|
|
|
@ -10,8 +10,6 @@ source $(dirname $0)/pdns.sh
|
|||
|
||||
help()
|
||||
{
|
||||
thisfilename=$(basename -- "$0")
|
||||
echo "$thisfilename"
|
||||
echo "Search data in Zones, Comments and RRSets."
|
||||
echo ""
|
||||
echo "usage: $thisfilename -q <query> [-e <max>] [-o <object>] [-c] [-h]"
|
||||
|
@ -52,10 +50,8 @@ if [[ $zone_status = 200 ]]; then
|
|||
# column output
|
||||
dasel -r json -w csv -f $tmpfile|sed -e 's/"""/"/g'|column -t -s ','
|
||||
fi
|
||||
elif [[ $zone_status = 404 ]]; then
|
||||
echo 404 Not Found, $zone does not exist
|
||||
else
|
||||
echo Unexecpted http response checking for existence of zone $zone: $zone_status
|
||||
echo Unexecpted http response seraching for $query: $zone_status
|
||||
fi
|
||||
|
||||
rm $tmpfile
|
||||
|
|
|
@ -10,8 +10,6 @@ source $(dirname $0)/pdns.sh
|
|||
|
||||
help()
|
||||
{
|
||||
thisfilename=$(basename -- "$0")
|
||||
echo "$thisfilename"
|
||||
echo "Add new zone to DNS"
|
||||
echo ""
|
||||
echo "usage: $thisfilename -z <zone> [-m <master>] [-t <type>] [-a <account>] [-w <comment>] [-b] [-h]"
|
||||
|
|
|
@ -10,8 +10,6 @@ source $(dirname $0)/pdns.sh
|
|||
|
||||
help()
|
||||
{
|
||||
thisfilename=$(basename -- "$0")
|
||||
echo "$thisfilename"
|
||||
echo "Delete a zone and all of it's records."
|
||||
echo ""
|
||||
echo "usage: $thisfilename -z <zone> [-x] [-h]"
|
||||
|
|
|
@ -10,8 +10,6 @@ source $(dirname $0)/pdns.sh
|
|||
|
||||
help()
|
||||
{
|
||||
thisfilename=$(basename -- "$0")
|
||||
echo "$thisfilename"
|
||||
echo "Export full DNS zone in AXFR format."
|
||||
echo ""
|
||||
echo "usage: $thisfilename -z <zone> [-h]"
|
||||
|
|
|
@ -10,8 +10,6 @@ source $(dirname $0)/pdns.sh
|
|||
|
||||
help()
|
||||
{
|
||||
thisfilename=$(basename -- "$0")
|
||||
echo "$thisfilename"
|
||||
echo "Check if Zone is extant (exits)."
|
||||
echo ""
|
||||
echo "usage: $thisfilename -z <zone> [-h]"
|
||||
|
|
|
@ -10,8 +10,6 @@ source $(dirname $0)/pdns.sh
|
|||
|
||||
help()
|
||||
{
|
||||
thisfilename=$(basename -- "$0")
|
||||
echo "$thisfilename"
|
||||
echo "Replace Resource Record set in zone."
|
||||
echo ""
|
||||
echo "usage: $thisfilename -z <zone> -n <name> -t <type> -r <record> [-l <ttl>] [-s <status>] [-c <comment>] [-a <account>] [-h]"
|
||||
|
|
15
bin/pdns.sh
15
bin/pdns.sh
|
@ -30,6 +30,10 @@ fi
|
|||
# Defaults to IP of server script is run from
|
||||
[[ -z $default_ip ]] && default_ip=$(hostname --ip-address)
|
||||
|
||||
# Hostname of this server.
|
||||
# Should normally just use the server configured hostname.
|
||||
[[ -z $hostname ]] && hostname=$(hostname --fqdn)
|
||||
|
||||
# Array of allowed Resource Record Types
|
||||
[[ -z $rr_types ]] && declare -a rr_types=(A AAAA CNAME MX NS PTR SRV TXT)
|
||||
|
||||
|
@ -141,9 +145,15 @@ function pdns::yesno() {
|
|||
|
||||
function pdns:getoptions () {
|
||||
local OPTIND
|
||||
while getopts "ha:bcd:e:i:l:m:n:o:q:r:s:t:w:xz:" opt ; do
|
||||
while getopts "ha:bcd:e:i:l:m:n:o:p:q:r:s:t:w:xz:" opt ; do
|
||||
case "${opt}" in
|
||||
h ) # display help and exit
|
||||
# set thisfilename=$(basename -- "$0")
|
||||
if [[ -n $parent ]]; then
|
||||
thisfilename=$parent
|
||||
else
|
||||
thisfilename=$(basename -- "$0")
|
||||
fi
|
||||
help
|
||||
exit
|
||||
;;
|
||||
|
@ -189,6 +199,9 @@ function pdns:getoptions () {
|
|||
o ) # object_type - Type of data to search for, one of 'all', 'zone', 'record', 'comment'
|
||||
object=${OPTARG,,}
|
||||
;;
|
||||
p ) # parent - name of parent script ("hidden" option used by vdns-* scripts)
|
||||
parent=${OPTARG,,}
|
||||
;;
|
||||
q ) # query - The string to search for
|
||||
query=${OPTARG}
|
||||
;;
|
||||
|
|
Loading…
Reference in New Issue
Block a user