36 lines
813 B
Bash
36 lines
813 B
Bash
|
#!/bin/bash
|
||
|
#
|
||
|
# vdns-stack
|
||
|
# https://git.stack-source.com/msb/vdns-stack
|
||
|
# Copyright (c) 2024 Matthew Saunders Brown <matthewsaundersbrown@gmail.com>
|
||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||
|
|
||
|
# load include file
|
||
|
source $(dirname $0)/vdns.sh
|
||
|
|
||
|
help()
|
||
|
{
|
||
|
echo "Add new zone to DNS"
|
||
|
echo ""
|
||
|
echo "usage: $thisfilename -z <zone> [-h]"
|
||
|
echo ""
|
||
|
echo " -h Print this help."
|
||
|
echo " -z <zone> Zone (domain name) to add."
|
||
|
}
|
||
|
|
||
|
vdns:getoptions "$@"
|
||
|
|
||
|
# check for zone
|
||
|
if [[ -z $zone ]]; then
|
||
|
echo "zone is required"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
zone_exists=$(/usr/local/sbin/pdns-zone-ext.sh -z $zone)
|
||
|
if [[ $zone_exists = "true" ]]; then
|
||
|
echo Zone $zone already exists.
|
||
|
exit 1
|
||
|
else
|
||
|
/usr/local/sbin/pdns-zone-add.sh -z $zone -w hostname=$hostname/$zone
|
||
|
fi
|