net_opts="tap,ifname=$tap,script=no,downscript=no,vlan=0,name=hostnet0 -device virtio-net-pci,vlan=0,id=net0,mac=$mac_address,bus=pci.0"
fi
+ if [ ! -z "$net_dns" ] && [ "$net_dns" != "host" ]; then
+ net_opts="$net_opts,dns=$net_dns"
+ fi
+
if [ -z "$spice" ] || [ "$spice" == "1" ]; then
spice_opts="-spice port=$PORT,addr=127.0.0.1,disable-ticketing,streaming-video=off,jpeg-wan-compression=never,playback-compression=off,zlib-glz-wan-compression=never,image-compression=off"
spice_opts="$spice_opts -device virtio-serial-pci"
# 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
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
#net="tap"
net="user"
+# DNS config
+#net_dns="192.168.1.1"
+#net_dns="host" # copy /etc/resolv.conf from host when creating the box
+
# Networking: tap config only
# This setting is used during virtual machine bootstrapping by kvmx-create.
#net_ip="10.1.1.2"
#net_mask="255.255.255.0"
#net_gateway="10.1.1.1"
-#net_dns="192.168.1.1"
# Set this is you want to be able to share a single folder between host and guest.
# Needs ssh_support set to "y" and a workable SSH connection to the guest.