feat: Persistant MAC address (#30)
This commit is contained in:
parent
8c6e9d3d7b
commit
74674eab18
1 changed files with 8 additions and 2 deletions
|
@ -239,8 +239,14 @@ getInfo() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$MAC" ]; then
|
if [ -z "$MAC" ]; then
|
||||||
# Generate MAC address based on Docker container ID in hostname
|
local file="$STORAGE/$PROCESS.mac"
|
||||||
MAC=$(echo "$HOST" | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/')
|
if [ -f "$file" ]; then
|
||||||
|
MAC=$(<"$file")
|
||||||
|
else
|
||||||
|
# Generate MAC address based on Docker container ID in hostname
|
||||||
|
MAC=$(echo "$HOST" | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/')
|
||||||
|
echo "${MAC^^}" > "$file"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VM_NET_MAC="${MAC^^}"
|
VM_NET_MAC="${MAC^^}"
|
||||||
|
|
Loading…
Reference in a new issue