From f89d0f36f14ab9a8609fb7d214657d12404ec9a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20unbrot=20P=C3=A4tzold?= Date: Thu, 30 Apr 2026 14:55:33 +0200 Subject: [PATCH] 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 --- config/setup_system.conf.dist | 4 +++- system_setup/install.sh | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/config/setup_system.conf.dist b/config/setup_system.conf.dist index 8cc8490..613032d 100644 --- a/config/setup_system.conf.dist +++ b/config/setup_system.conf.dist @@ -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 ) diff --git a/system_setup/install.sh b/system_setup/install.sh index 4f68c3d..e31581e 100755 --- a/system_setup/install.sh +++ b/system_setup/install.sh @@ -497,6 +497,15 @@ mount -o "$MOUNT_OPTS" "$OEMDRV_DEV" "$MOUNT_POINT" || die "mount failed." info "Cloning $REPO_URL into $MOUNT_POINT..." cd "$MOUNT_POINT" || die "Cannot cd to $MOUNT_POINT." git clone --progress --depth 1 "$REPO_URL" . || die "git clone failed." + +# Write hardware UUID to a user-readable per-machine file +mkdir -p "${MOUNT_POINT}/config.d" +dmidecode -t system | grep -i 'UUID' \ + | sed 's/UUID: //' | tr '[:upper:]' '[:lower:]' \ + | sed 's/[^0-9a-z]*//g' | xargs | tail -c 13 \ + > "${MOUNT_POINT}/config.d/machine_uuid.sys" +chmod 0444 "${MOUNT_POINT}/config.d/machine_uuid.sys" + chmod o=rwX . -R # to make changes to the configuration possible after install # ── Done ──────────────────────────────────────────────────────────────────────