diff options
| author | Max Howell | 2011-07-29 16:39:32 +0100 | 
|---|---|---|
| committer | Max Howell | 2011-07-30 11:03:34 +0100 | 
| commit | 7030b51e7c767d6654552359bcfebfd5237be0b8 (patch) | |
| tree | 5d3a30a3e9bbebd6a6321dbfcf978162a75dddad | |
| parent | e38b28668c1a911522cbbede516155d06b6cc488 (diff) | |
| download | homebrew-7030b51e7c767d6654552359bcfebfd5237be0b8.tar.bz2 | |
If brew is installed non-root refuse to `sudo brew`
Rationale: people break their installs by mixing sudo and non-sudo usage. They are used to having to `sudo port install` and shit like that, so I understand why the mixing happens.
| -rwxr-xr-x | bin/brew | 5 | 
1 files changed, 5 insertions, 0 deletions
| @@ -26,6 +26,11 @@ when '-v'    end  end +if Process.uid.zero? and not File.stat(HOMEBREW_BREW_FILE).uid.zero? +  # note we only abort if Homebrew is *not* uninstalled sudo and the user +  # calls brew as root. The fix is to chown brew to root. +  abort "Cowardly refusing to `sudo brew'" +end  case HOMEBREW_PREFIX.to_s when '/', '/usr'    # it may work, but I only see pain this route and don't want to support it    abort "Cowardly refusing to continue at this prefix: #{HOMEBREW_PREFIX}" | 
