Update setup-powerdns.sh

This commit is contained in:
2019-03-30 16:44:32 -05:00
parent 7401405ba4
commit e51fda6bd1

View File

@@ -1,37 +1,72 @@
#!/bin/bash
clear
#Version : 4.1
#Check if all arguments have been specified
if [ $# -lt 6 ] ; then
echo "You must specify all six arguments."
exit 1
source /dev/stdin <<< "$(curl -sL http://scity.xyz/colorsinc)"
source /dev/stdin <<< "$(curl -sL http://scity.xyz/defaultinc)"
echo
while [ $# -gt 0 ]; do
case "$1" in
-mysql-username) user=${2};;
-mysql-password) pass=${2};;
-masterns-ip) primarynsip=${2};;
-slavens-ip) slaveip=${2};;
-slavens-rootpass) slavepass=${2};;
-h | -help | --help)
echo ""
width=33
printf "%-${width}s- %s\n" " -site {FQDN address(,es)}" "(new site and aliases, comma separated)"
printf "%-${width}s- %s\n" " -ssl {yes or no}" "(defaults to yes)"
printf "%-${width}s- %s\n" " -type {'local' or 'proxy'}" "(defaults to local)"
printf "%-${width}s- %s\n" " -port {host port}" "(proxy backend host)"
printf "%-${width}s- %s\n" " -host {IP or FQDN}" "(proxy backend port)"
printf "%-${width}s- %s\n" " -scheme {http or https}" "(proxy backend scheme)"
exit 1;;
esac
shift
done
if [ -z ${NEW_SITE+x} ]; then
echo -e -n "${idsCL[LightCyan]}MySQL Username: ${idsCL[Default]}"
read user
showdivide=yes
fi
if [ -z ${CREATE_SSL+x} ]; then
echo -e -n "${idsCL[LightCyan]}MySQL Password: ${idsCL[Default]}"
read pass
showdivide=yes
fi
if [ -z ${SITE_TYPE+x} ]; then
echo -e -n "${idsCL[LightCyan]}Master NS IP: ${idsCL[Default]}"
read primarynsip
showdivide=yes
fi
if [ -z ${NEW_SITE+x} ]; then
echo -e -n "${idsCL[LightCyan]}Slave NS IP: ${idsCL[Default]}"
read slaveip
showdivide=yes
fi
if [ -z ${NEW_SITE+x} ]; then
echo -e -n "${idsCL[LightCyan]}Slave NS Root Password: ${idsCL[Default]}"
read slavepass
showdivide=yes
fi
if [ "${showdivide}" = "yes" ]; then DIVIDER; fi
echo ""
width=14
printf "%-${width}s: %s\n" "MySQL Username" "${user}"
printf "%-${width}s: %s\n" "MySQL Password" "${pass}"
printf "%-${width}s: %s\n" "Master NS IP" "${primarynsip}"
printf "%-${width}s: %s\n" "Slave NS IP" "${slaveip}"
printf "%-${width}s: %s\n" "Slave NS Root Password" "${slavepass}"
echo -e -n "${idsCL[LightRed]}Is this information correct? [Y/n]${idsCL[Default]} "
read response
if [[ $response =~ ^[Yy]$ ]] || [ "${response}" = "" ]; then
echo
fi
# Parse command line options.
for i in $*
do
case $i in
--mysql-username=*)
user=`echo ${i#*=}`
;;
--mysql-password=*)
pass=`echo ${i#*=}`
;;
--masterns-ip=*)
primarynsip=`echo ${i#*=}`
;;
--slavens-ip=*)
slaveip=`echo ${i#*=}`
;;
--slavens-rootpass=*)
slavepass=`echo ${i#*=}`
;;
esac
done
if [ ! -n "$user" ]; then
echo "Please enter the --mysql-username parameter"
exit 1