diff options
| author | Martin Afanasjew | 2016-06-29 14:16:39 +0200 |
|---|---|---|
| committer | Martin Afanasjew | 2016-06-29 21:07:25 +0200 |
| commit | b1811f2ef3255dab74a0ee42447a5a747b37753d (patch) | |
| tree | f00abbdd810d438ecd439df7e9f61b3cf056b675 /Library/Homebrew/utils | |
| parent | 271023c5e11ec5fc8be39a2161c43b2ffd034ce6 (diff) | |
| download | brew-b1811f2ef3255dab74a0ee42447a5a747b37753d.tar.bz2 | |
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>
Diffstat (limited to 'Library/Homebrew/utils')
| -rw-r--r-- | Library/Homebrew/utils/analytics.sh | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Library/Homebrew/utils/analytics.sh b/Library/Homebrew/utils/analytics.sh index f0ec2c46e..d4a64e52f 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 |
