Unverified Commit 58969280 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

feat: Persistant MAC address (#646)

parent 86525449
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -212,8 +212,14 @@ getInfo() {
  fi

  if [ -z "$VM_NET_MAC" ]; then
    local file="$STORAGE/dsm.mac"
    if [ -f "$file" ]; then
      VM_NET_MAC=$(<"$file")
    else
      # Generate MAC address based on Docker container ID in hostname
      VM_NET_MAC=$(echo "$HOST" | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:11:32:\3:\4:\5/')
      echo "${VM_NET_MAC^^}" > "$file"
    fi
  fi

  VM_NET_MAC="${VM_NET_MAC^^}"