aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Howell2011-08-17 12:30:21 +0100
committerMax Howell2011-08-17 12:30:21 +0100
commitdf113d3ce620963f8b821944f18c9f529ff10239 (patch)
treec7252a8ffd1b193d5496f1088fef7a2cc4cf3b28
parent32c746ef450d075b537cbd34c2623de4f6f0bdcc (diff)
downloadbrew-df113d3ce620963f8b821944f18c9f529ff10239.tar.bz2
Only error out for `sudo brew install`
Note this only happens if Homebrew is *not* installed sudo. Which is most of the time true. Fixes Homebrew/homebrew#6899
-rw-r--r--Library/Homebrew/cmd/install.rb6
-rwxr-xr-xbin/brew5
2 files changed, 6 insertions, 5 deletions
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index e31b1b35e..b7f9e7cae 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -9,6 +9,12 @@ module Homebrew extend self
raise "No available formula for #{name}\n#{msg}" if msg
end unless ARGV.force?
+ if Process.uid.zero? and not File.stat(HOMEBREW_BREW_FILE).uid.zero?
+ # note we only abort if Homebrew is *not* installed as sudo and the user
+ # calls brew as root. The fix is to chown brew to root.
+ abort "Cowardly refusing to `sudo brew install'"
+ end
+
install_formulae ARGV.formulae
end
diff --git a/bin/brew b/bin/brew
index 4d6014c85..5fe19cc89 100755
--- a/bin/brew
+++ b/bin/brew
@@ -26,11 +26,6 @@ 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* installed as 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}"