From b1811f2ef3255dab74a0ee42447a5a747b37753d Mon Sep 17 00:00:00 2001 From: Martin Afanasjew <martin@afanasjew.de> Date: Wed, 29 Jun 2016 14:16:39 +0200 Subject: [PATCH] analytics: make Linux UUID generation more robust Not every Linux system has a pre-installed `uuidgen` command (Debian has a package `uuid-runtime` but doesn't install it by default). In contrast, `/proc/sys/kernel/random/uuid` is always available on a modern Linux system and produces type/version 4 UUIDs, just like `uuidgen`. Closes #416. Signed-off-by: Martin Afanasjew <martin@afanasjew.de> --- Library/Homebrew/utils/analytics.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/utils/analytics.sh b/Library/Homebrew/utils/analytics.sh index f0ec2c46e2..d4a64e52f2 100644 --- a/Library/Homebrew/utils/analytics.sh +++ b/Library/Homebrew/utils/analytics.sh @@ -35,7 +35,12 @@ setup-analytics() { HOMEBREW_ANALYTICS_USER_UUID="$(git config --file="$git_config_file" --get homebrew.analyticsuuid)" if [[ -z "$HOMEBREW_ANALYTICS_USER_UUID" ]] then - HOMEBREW_ANALYTICS_USER_UUID="$(uuidgen)" + if [[ -n "$HOMEBREW_LINUX" ]] + then + HOMEBREW_ANALYTICS_USER_UUID="$(tr a-f A-F < /proc/sys/kernel/random/uuid)" + else + HOMEBREW_ANALYTICS_USER_UUID="$(uuidgen)" + fi if [[ -z "$HOMEBREW_ANALYTICS_USER_UUID" ]] then -- GitLab