fix: Ignore empty MAC address

This commit is contained in:
Kroese 2024-04-13 23:30:28 +02:00 committed by GitHub
parent c86348c599
commit 8f337c8eb8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -251,9 +251,8 @@ getInfo() {
if [ -z "$MAC" ]; then if [ -z "$MAC" ]; then
local file="$STORAGE/$PROCESS.mac" local file="$STORAGE/$PROCESS.mac"
if [ -f "$file" ]; then [ -f "$file" ] && MAC=$(<"$file")
MAC=$(<"$file") if [ -z "$MAC" ]; then
else
# Generate MAC address based on Docker container ID in hostname # Generate MAC address based on Docker container ID in hostname
MAC=$(echo "$HOST" | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/') MAC=$(echo "$HOST" | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/')
echo "${MAC^^}" > "$file" echo "${MAC^^}" > "$file"