diff options
author | Emmanuel Vasilakis <mrzammler@mm.st> | 2023-07-24 21:00:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-24 19:00:26 +0100 |
commit | d759ebbb7f65b84eb9874e86985bffac349e7f4b (patch) | |
tree | e442a13f06b999867b75a3927d392ccd2f8a2e77 /packaging | |
parent | 7a0841f7a3f509daad4418fd19a0ab154c7a2f65 (diff) |
Add a machine distinct id to analytics (#15485)
* add a system distinct id to analytics
Diffstat (limited to 'packaging')
-rwxr-xr-x | packaging/installer/kickstart.sh | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/packaging/installer/kickstart.sh b/packaging/installer/kickstart.sh index 8ddcd86e07..ed448f7da2 100755 --- a/packaging/installer/kickstart.sh +++ b/packaging/installer/kickstart.sh @@ -257,14 +257,16 @@ telemetry_event() { TOTAL_RAM="$((TOTAL_RAM * 1024))" fi + MD5_PATH="$(exec <&- 2>&-; which md5sum || command -v md5sum || type md5sum)" + if [ "${KERNEL_NAME}" = Darwin ] && command -v ioreg >/dev/null 2>&1; then DISTINCT_ID="macos-$(ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { split($0, line, "\""); printf("%s\n", line[4]); }')" - elif [ -f /etc/machine-id ]; then - DISTINCT_ID="machine-$(cat /etc/machine-id)" - elif [ -f /var/db/dbus/machine-id ]; then - DISTINCT_ID="dbus-$(cat /var/db/dbus/machine-id)" - elif [ -f /var/lib/dbus/machine-id ]; then - DISTINCT_ID="dbus-$(cat /var/lib/dbus/machine-id)" + elif [ -f /etc/machine-id ] && [ -n "$MD5_PATH" ]; then + DISTINCT_ID="machine-$($MD5_PATH < /etc/machine-id | cut -f1 -d" ")" + elif [ -f /var/db/dbus/machine-id ] && [ -n "$MD5_PATH" ]; then + DISTINCT_ID="dbus-$($MD5_PATH < /var/db/dbus/machine-id | cut -f1 -d" ")" + elif [ -f /var/lib/dbus/machine-id ] && [ -n "$MD5_PATH" ]; then + DISTINCT_ID="dbus-$($MD5_PATH < /var/lib/dbus/machine-id | cut -f1 -d" ")" elif command -v uuidgen > /dev/null 2>&1; then DISTINCT_ID="uuid-$(uuidgen | tr '[:upper:]' '[:lower:]')" else @@ -300,7 +302,8 @@ telemetry_event() { "system_kernel_name": "${KERNEL_NAME}", "system_kernel_version": "$(uname -r)", "system_architecture": "$(uname -m)", - "system_total_ram": "${TOTAL_RAM:-unknown}" + "system_total_ram": "${TOTAL_RAM:-unknown}", + "system_distinct_id": "${DISTINCT_ID}" } } EOF |