aboutsummaryrefslogtreecommitdiff
path: root/kvmx-create
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-06-13 18:00:42 -0300
committerSilvio Rhatto <rhatto@riseup.net>2018-06-13 18:00:42 -0300
commitb495a4efce5b620b41c5c8463ed45860cef8daea (patch)
tree97818bc506f4fd05f6c3053413c4863d3cace670 /kvmx-create
parent85e1c1e9ca1acb346a4dd7b0d542467a5c57a9f3 (diff)
downloadkvmx-b495a4efce5b620b41c5c8463ed45860cef8daea.tar.gz
kvmx-b495a4efce5b620b41c5c8463ed45860cef8daea.tar.bz2
Enhance net_dns behavior
Diffstat (limited to 'kvmx-create')
-rwxr-xr-xkvmx-create14
1 files changed, 10 insertions, 4 deletions
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