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>
This commit is contained in:
		
							parent
							
								
									271023c5e1
								
							
						
					
					
						commit
						b1811f2ef3
					
				@ -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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user