Ability to specify nameservers

This commit is contained in:
Bob Mottram 2015-01-31 11:11:07 +00:00
parent 793fb46915
commit 6ad7653ce7
2 changed files with 16 additions and 2 deletions

Binary file not shown.

View File

@ -36,6 +36,10 @@ ROUTER_IP_ADDRESS="192.168.1.254"
# The fixed IP address of the Beaglebone Black on your local network
BBB_FIXED_IP_ADDRESS="192.168.1.55"
# DNS
NAMESERVER1='213.73.91.35'
NAMESERVER2='85.214.20.141'
MICROSD_MOUNT_POINT="/media/$USER"
DEBIAN_FILE_NAME="debian-jessie-console-armhf-2014-08-13"
@ -108,6 +112,16 @@ case $key in
shift
MICROSD_MOUNT_POINT="$1"
;;
# nameserver 1
--ns1)
shift
NAMESERVER1="$1"
;;
# nameserver 2
--ns2)
shift
NAMESERVER2="$1"
;;
*)
# unknown option
;;
@ -206,8 +220,8 @@ $SUDO sed -i '/iface eth0 inet static/a\ netmask 255.255.255.0' $MICROSD_MOUN
$SUDO sed -i "/iface eth0 inet static/a\ address $BBB_FIXED_IP_ADDRESS" $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
$SUDO sed -i '/iface usb0 inet static/,/ gateway 192.168.7.1/ s/^/#/' $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
$SUDO sed -i 's/nameserver.*/nameserver 213.73.91.35/g' $MICROSD_MOUNT_POINT/$ROOTFS/etc/resolv.conf
$SUDO sed -i '/nameserver 213.73.91.35/a\nameserver 85.214.20.141' $MICROSD_MOUNT_POINT/$ROOTFS/etc/resolv.conf
$SUDO sed -i "s/nameserver.*/nameserver $NAMESERVER1/g" $MICROSD_MOUNT_POINT/$ROOTFS/etc/resolv.conf
$SUDO sed -i "/nameserver $NAMESERVER1/a\nameserver $NAMESERVER2" $MICROSD_MOUNT_POINT/$ROOTFS/etc/resolv.conf
# change the motd to show further install instructions
echo 'Become the root user by typing:' > $MICROSD_MOUNT_POINT/$ROOTFS/etc/motd