make HOSTNAE readonly only after value is set

This commit is contained in:
Andreas Schneider 2021-11-22 18:27:28 +01:00 • committed by GitHub
parent 146f329c24
commit 75bda45809
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -284,9 +284,10 @@ LOG_DIR="$(printf '%s' "${LOG_DIR}" | awk '{gsub(/\/+$/, ""); printf $1}')"
readonly LOG_DIR
# System information
readonly HOSTNAME="$(hostname)"
HOSTNAME="$(hostname)"
# Try command hostnamectl if HOSTNAME is unset or empty
[ -z HOSTNAME ] && readonly HOSTNAME="$(hostnamectl --static)"
[ -z HOSTNAME ] && HOSTNAME="$(hostnamectl --static)"
readonly HOSTNAME
readonly OS_FLAVOR="$(uname)"
# SMART static information