Update update-dns.sh

This commit is contained in:
2024-03-09 15:36:45 -06:00
parent f10b7eefdc
commit b28a16c803

View File

@@ -1,45 +1,60 @@
#!/bin/bash #!/bin/bash
echo "HERE: ${1}" if [ -d /opt/idssys/defaults ]; then
source /opt/idssys/defaults/colors.inc
source /opt/idssys/defaults/default.inc
else
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
fi
# if [ -d /opt/idssys/defaults ]; then if [ -f /etc/netplan/eth0.yaml ]; then
# source /opt/idssys/defaults/colors.inc cat /etc/netplan/eth0.yaml
# source /opt/idssys/defaults/default.inc netfile=/etc/netplan/eth0.yaml
# else elif [ -f /etc/netplan/network.yaml ]; then
# source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)" cat /etc/netplan/network.yaml
# source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)" netfile=/etc/netplan/network.yaml
# fi elif [ -f /etc/network/interfaces ]; then
# cat /etc/network/interfaces
# if [ -f /etc/netplan/eth0.yaml ]; then netfile=/etc/network/interfaces
# cat /etc/netplan/eth0.yaml else
# else echo -e "No network configs found\n"
# cat /etc/network/interfaces exit 1
# fi fi
# echo echo
#
# read -n 1 -p "Do you wish to continue changing the DNS? (Y/n) " choice read -n 1 -p "Do you wish to continue changing the DNS? (Y/n) " choice
# case "$choice" in case "$choice" in
# [Nn]) [Nn])
# echo -e "${Green}The DNS servers have NOT been updated${Color_Off}" echo -e "${Green}The DNS servers have NOT been updated${Color_Off}"
# exit 0 exit 0
# ;; ;;
#
# * ) if [ -f /etc/netplan/eth0.yaml ]; then * ) if [ -f /etc/netplan/eth0.yaml ] || [ -f /etc/netplan/network.yaml ]; then
# sed -i 's/10.10.10.10,10.10.10.11/10.10.10.10,10.10.10.11,10.2.1.2/g' /etc/netplan/eth0.yaml if [ "${1}" = "offsite" ]; then
# sed -i 's/10.10.10.10,10.10.10.11/10.2.1.5,10.2.1.6,10.10.10.5/g' ${netfile}
# /usr/sbin/netplan apply sed -i 's/127.0.0.1,10.10.10.10/10.2.1.5,10.2.1.6,10.10.10.5/g' ${netfile}
# else
# cat /etc/netplan/eth0.yaml sed -i 's/10.10.10.10,10.10.10.11/10.10.10.10,10.10.10.11,10.2.1.2/g' ${netfile}
# else fi
# sed -i 's/10.10.10.10 10.10.10.11/10.10.10.10 10.10.10.11 10.2.1.2/g' /etc/network/interfaces
# /usr/sbin/netplan apply
# /usr/sbin/service networking restart
# cat ${netfile}
# cat /etc/network/interfaces else
# fi if [ "${1}" = "offsite" ]; then
# echo -e "${Green}The DNS servers have been updated${Color_Off}" sed -i 's/10.10.10.10 10.10.10.11/10.10.10.10 10.10.10.11 10.2.1.2/g' ${netfile}
# ;; else
# esac sed -i 's/10.10.10.10 10.10.10.11/10.10.10.10 10.10.10.11 10.2.1.2/g' ${netfile}
fi
/usr/sbin/service networking restart
cat ${netfile}
fi
echo -e "${Green}The DNS servers have been updated${Color_Off}"
;;
esac
echo echo