aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorMax Howell2011-08-24 11:30:32 +0100
committerMax Howell2011-08-24 22:30:44 +0100
commit13918ff6d9e093e4ec7e8eac36d5076f3c41eb03 (patch)
tree853b2908375ee27de8430e098225b3cf6572972b /Library/Homebrew/cmd
parent1f95b07ba585c662cc885cd78c0044f484bcb97c (diff)
downloadbrew-13918ff6d9e093e4ec7e8eac36d5076f3c41eb03.tar.bz2
Record which keg is linked
Will be useful for a variety of reasons, but for now, I'm just using it to ensure install won't install again if something is already installed (use brew upgrade instead). But means that brew switch and that can work properly etc.
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/install.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index 4b2711994..07942f64e 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?
+ ARGV.formulae.each do |f|
+ if File.directory? HOMEBREW_REPOSITORY/"Library/LinkedKegs/#{f.name}"
+ raise "#{f} already installed\nTry: brew upgrade #{f}"
+ 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.