Write DMI UUID to machine_uuid.sys for user-accessible machine ID

install.sh writes the last 12 chars of the DMI system UUID to
config.d/machine_uuid.sys (0444) after git clone, so non-root scripts
can derive the hardware-bound hostname without needing dmidecode.

conf.dist reads machine_uuid.sys first; falls back to dmidecode (root)
or hostname -s (user) if the file is absent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-30 14:55:33 +02:00
parent bcbcc3392d
commit f89d0f36f1
2 changed files with 12 additions and 1 deletions
+3 -1
View File
@@ -16,7 +16,9 @@ export UPGRADEBRANCH="main"
export CLIENTADMINGROUP="clientadmins"
# Method to determine Unique Hostname / FQDN of the Client. May be replaced by your needs
if [ "$EUID" -eq 0 ]; then
if [ -r /opt/sys_config/config.d/machine_uuid.sys ]; then
export HOSTNM="pc-$( cat /opt/sys_config/config.d/machine_uuid.sys )"
elif [ "$EUID" -eq 0 ]; then
export HOSTNM="pc-$( dmidecode -t system | grep -i 'UUID' | sed 's/UUID: //' | tr '[:upper:]' '[:lower:]' | sed 's/[^0-9a-z]*//g' | xargs|tail -c 13)"
else
export HOSTNM=$( hostname -s )