Update update-dns.sh

This commit is contained in:
2024-03-09 15:29:52 -06:00
parent 9732758922
commit f10b7eefdc

View File

@@ -1,43 +1,45 @@
#!/bin/bash
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
echo "HERE: ${1}"
if [ -f /etc/netplan/eth0.yaml ]; then
cat /etc/netplan/eth0.yaml
else
cat /etc/network/interfaces
fi
echo
read -n 1 -p "Do you wish to continue changing the DNS? (Y/n) " choice
case "$choice" in
[Nn])
echo -e "${Green}The DNS servers have NOT been updated${Color_Off}"
exit 0
;;
* ) if [ -f /etc/netplan/eth0.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
/usr/sbin/netplan apply
cat /etc/netplan/eth0.yaml
else
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/service networking restart
cat /etc/network/interfaces
fi
echo -e "${Green}The DNS servers have been updated${Color_Off}"
;;
esac
# 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 [ -f /etc/netplan/eth0.yaml ]; then
# cat /etc/netplan/eth0.yaml
# else
# cat /etc/network/interfaces
# fi
# echo
#
# read -n 1 -p "Do you wish to continue changing the DNS? (Y/n) " choice
# case "$choice" in
# [Nn])
# echo -e "${Green}The DNS servers have NOT been updated${Color_Off}"
# exit 0
# ;;
#
# * ) if [ -f /etc/netplan/eth0.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
#
# /usr/sbin/netplan apply
#
# cat /etc/netplan/eth0.yaml
# else
# 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/service networking restart
#
# cat /etc/network/interfaces
# fi
# echo -e "${Green}The DNS servers have been updated${Color_Off}"
# ;;
# esac
echo