aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2012-02-10 23:40:21 -0600
committerJack Nagel2012-02-10 23:53:12 -0600
commitcdd52e28f16069259e106719baaf972b2d1b70fa (patch)
tree74406028faf2e9b47515e364cfd8896daf1a34d4 /Library
parentc1fecab3651c876a88d5971bc2ed31fe30bd66cd (diff)
downloadbrew-cdd52e28f16069259e106719baaf972b2d1b70fa.tar.bz2
Remove LinkedKegs entry if we're writing the same one
If a keg has been uninstalled via `rm -rf <keg>`, and a user tries to reinstall it without `brew unlink`ing it first, it will fail to link as the LinkedKegs entry still exists. This isn't desirable, and the user should be able to reinstall the same formula on top of the old, dead symlinks without problems, so let's just remove the LinkedKegs entry if it matches the one we are installing anyway. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/install.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index 4a20dc7cb..caefbcb40 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -104,6 +104,7 @@ module Homebrew extend self
fi = FormulaInstaller.new(f)
fi.install
fi.caveats
+ f.linked_keg.unlink if f.linked_keg.directory? and f.linked_keg.realpath == f.prefix
fi.finish
rescue FormulaAlreadyInstalledError => e
opoo e.message