Allow DNS nameservers to be configured

This commit is contained in:
Bob Mottram 2015-01-31 11:19:24 +00:00
parent 6ad7653ce7
commit 9787e95171
2 changed files with 26 additions and 4 deletions

Binary file not shown.

View File

@ -81,6 +81,10 @@ LOCAL_NETWORK_STATIC_IP_ADDRESS="192.168.1.60"
# IP address of the router (gateway)
ROUTER_IP_ADDRESS="192.168.1.254"
# DNS
NAMESERVER1='213.73.91.35'
NAMESERVER2='85.214.20.141'
# whether to route outgoing traffic through Tor
ROUTE_THROUGH_TOR="no"
@ -375,6 +379,8 @@ function show_help {
echo ' --cjdns Enable CJDNS'
echo ' --vpass VoIP server password'
echo ' --vport VoIP server port'
echo ' --ns1 First DNS nameserver'
echo ' --ns2 Second DNS nameserver'
echo ''
echo 'system types'
echo '------------'
@ -1047,6 +1053,16 @@ case $key in
shift
VOIP_PORT=$1
;;
# DNS Nameserver 1
--ns1)
shift
NAMESERVER1=$1
;;
# DNS Nameserver 2
--ns2)
shift
NAMESERVER2=$1
;;
*)
# unknown option
;;
@ -1099,9 +1115,15 @@ function read_configuration {
fi
if [ -f $CONFIGURATION_FILE ]; then
if grep -q "NAMESERVER1" $CONFIGURATION_FILE; then
NAMESERVER1=$(grep "NAMESERVER1" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "NAMESERVER2" $CONFIGURATION_FILE; then
NAMESERVER2=$(grep "NAMESERVER2" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "DEBIAN_REPO" $CONFIGURATION_FILE; then
DEBIAN_REPO=$(grep "DEBIAN_REPO" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
CHECK_MESSAGE="Check your internet connection, /etc/network/interfaces and /etc/resolv.conf, then delete $COMPLETION_FILE, run 'rm -fR /var/lib/apt/lists/* && apt-get update --fix-missing' and run this script again. If hash sum mismatches persist then try setting $DEBIAN_REPO to a different mirror and also change /etc/apt/sources.list."
CHECK_MESSAGE="Check your internet connection, /etc/network/interfaces and /etc/resolv.conf, then delete $COMPLETION_FILE, run 'rm -fR /var/lib/apt/lists/* && apt-get update --fix-missing' and run this script again. If hash sum mismatches persist then try setting $DEBIAN_REPO to a different mirror and also change /etc/apt/sources.list."
fi
if grep -q "VOIP_PORT" $CONFIGURATION_FILE; then
VOIP_PORT=$(grep "VOIP_PORT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
@ -1386,7 +1408,7 @@ function install_not_on_BBB {
echo " address $LOCAL_NETWORK_STATIC_IP_ADDRESS" >> /etc/network/interfaces
echo ' netmask 255.255.255.0' >> /etc/network/interfaces
echo " gateway $ROUTER_IP_ADDRESS" >> /etc/network/interfaces
echo ' dns-nameservers 213.73.91.35 85.214.20.141' >> /etc/network/interfaces
echo " dns-nameservers $NAMESERVER1 $NAMESERVER2" >> /etc/network/interfaces
echo '# Example to keep MAC address between reboots' >> /etc/network/interfaces
echo '#hwaddress ether DE:AD:BE:EF:CA:FE' >> /etc/network/interfaces
echo '' >> /etc/network/interfaces
@ -4645,8 +4667,8 @@ function configure_dns {
fi
echo 'domain localdomain' > /etc/resolv.conf
echo 'search localdomain' >> /etc/resolv.conf
echo 'nameserver 213.73.91.35' >> /etc/resolv.conf
echo 'nameserver 85.214.20.141' >> /etc/resolv.conf
echo "nameserver $NAMESERVER1" >> /etc/resolv.conf
echo "nameserver $NAMESERVER2" >> /etc/resolv.conf
echo 'configure_dns' >> $COMPLETION_FILE
}