From b495a4efce5b620b41c5c8463ed45860cef8daea Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Wed, 13 Jun 2018 18:00:42 -0300 Subject: Enhance net_dns behavior --- kvmx-create | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'kvmx-create') diff --git a/kvmx-create b/kvmx-create index a908663..56b08b6 100755 --- a/kvmx-create +++ b/kvmx-create @@ -364,10 +364,7 @@ EOF # Second stage procedure function __kvmx_create_custom_second_stage { - if [ ! -z "$net_ip" ] && [ ! -z "$net_mask" ] && [ ! -z "$net_gateway" ] && [ -z "$net_dns" ]; then - # DNS config - echo "nameserver $net_dns" > $WORK/etc/resolv.conf - + if [ ! -z "$net_ip" ] && [ ! -z "$net_mask" ] && [ ! -z "$net_gateway" ]; then # Networking: eth0 cat <<-EOF | $SUDO tee $WORK/etc/network/interfaces.d/eth0 > /dev/null auto eth0 @@ -403,6 +400,15 @@ iface ens3 inet dhcp EOF fi + # DNS config + if [ ! -z "$net_dns" ]; then + if [ "$net_dns" == "host" ]; then + cp /etc/resolv.conf $WORK/etc/resolv.conf + else + echo "nameserver $net_dns" > $WORK/etc/resolv.conf + fi + fi + # Locale $APT_INSTALL locales echo "LANG=$LANG" | $SUDO tee $WORK/etc/default/locale > /dev/null -- cgit v1.2.3