setup-analytics: Handle missing /proc/.../uuid

This commit is contained in:
Shaun Jackman 2017-11-22 10:58:00 -08:00
parent 1ff628e20f
commit 5920c0b2ae

View File

@ -35,12 +35,12 @@ setup-analytics() {
HOMEBREW_ANALYTICS_USER_UUID="$(git config --file="$git_config_file" --get homebrew.analyticsuuid 2>/dev/null)" HOMEBREW_ANALYTICS_USER_UUID="$(git config --file="$git_config_file" --get homebrew.analyticsuuid 2>/dev/null)"
if [[ -z "$HOMEBREW_ANALYTICS_USER_UUID" ]] if [[ -z "$HOMEBREW_ANALYTICS_USER_UUID" ]]
then then
if [[ -n "$HOMEBREW_LINUX" ]] if [[ -x /usr/bin/uuidgen ]]
then
HOMEBREW_ANALYTICS_USER_UUID="$(tr a-f A-F </proc/sys/kernel/random/uuid)"
elif [[ -n "$HOMEBREW_MACOS" ]]
then then
HOMEBREW_ANALYTICS_USER_UUID="$(/usr/bin/uuidgen)" HOMEBREW_ANALYTICS_USER_UUID="$(/usr/bin/uuidgen)"
elif [[ -r /proc/sys/kernel/random/uuid ]]
then
HOMEBREW_ANALYTICS_USER_UUID="$(tr a-f A-F </proc/sys/kernel/random/uuid)"
else else
HOMEBREW_ANALYTICS_USER_UUID="$(uuidgen)" HOMEBREW_ANALYTICS_USER_UUID="$(uuidgen)"
fi fi