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
commitb609f698397d86ada5c02d8bda6aa677cf493578 (patch)
treeb0566d446f4cfe074b514998b20beaeac8bd613e /Library
parent17743d34a34310a58754109b01820fad3f40b9ed (diff)
downloadhomebrew-b609f698397d86ada5c02d8bda6aa677cf493578.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