Skip to content
Snippets Groups Projects
Commit b1811f2e authored by Martin Afanasjew's avatar Martin Afanasjew
Browse files

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: default avatarMartin Afanasjew <martin@afanasjew.de>
parent 271023c5
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment