Commit d8513945 authored by Kroese's avatar Kroese
Browse files

Allow MAC configuration through file

parent 1514b2dd
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -2,8 +2,8 @@
set -eu

: ${VM_NET_TAP:=''}
: ${VM_NET_MAC:=''}
: ${VM_NET_IP:='20.20.20.21'}
: ${VM_NET_MAC:='00:11:32:2C:A7:85'}

: ${DNSMASQ:='/usr/sbin/dnsmasq'}
: ${DNSMASQ_OPTS:=''}
@@ -61,6 +61,16 @@ if [ ! -c /dev/net/tun ]; then
fi

[ ! -c /dev/net/tun ] && echo "Error: TUN network interface not available..." && exit 85
[ ! -d "$IMG" ] && echo "Storage folder (${IMG}) not found!" && exit 86

#If environment variabele not set fall back to file
if [ -z "$VM_NET_MAC" ]; then
  FILE="${IMG}/guest.mac"
  if [ ! -f "$FILE" ]; then
    echo "00:11:32:2C:A7:85" > "$FILE"
  fi
  VM_NET_MAC=$(cat "${FILE}")
fi

update-alternatives --set iptables /usr/sbin/iptables-legacy > /dev/null
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy > /dev/null