fix: Ignore empty MAC address (#36)
This commit is contained in:
parent
ab565cec32
commit
3448634874
2 changed files with 5 additions and 3 deletions
|
@ -6,7 +6,10 @@
|
||||||
.gitmodules
|
.gitmodules
|
||||||
Dockerfile
|
Dockerfile
|
||||||
Dockerfile.archive
|
Dockerfile.archive
|
||||||
|
compose.yml
|
||||||
|
compose.yaml
|
||||||
docker-compose.yml
|
docker-compose.yml
|
||||||
|
docker-compose.yaml
|
||||||
|
|
||||||
*.md
|
*.md
|
||||||
|
|
||||||
|
|
|
@ -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"
|
||||||
|
|
Loading…
Reference in a new issue