aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharlie Sharpsteen2012-09-24 16:29:29 -0500
committerCharlie Sharpsteen2012-09-24 16:29:29 -0500
commit96905ebc241d13b01a32f861eeb24a36e8303fe0 (patch)
treeb758407ff7cd834173fbc063611af57ac4c8020f
parent94dbaf00d104cd462a98da1efa22a8bc936efa6c (diff)
downloadhomebrew-96905ebc241d13b01a32f861eeb24a36e8303fe0.tar.bz2
Abort if the HOMEBREW_PREFIX is not searchable
Without executable permissions on the prefix directory, permissions tests such as `File.writable?` will fail and `File.chdir` will die with a strange error. Fixes #14996.
-rw-r--r--install8
1 files changed, 8 insertions, 0 deletions
diff --git a/install b/install
index 56d05b7a8..e9d7fca77 100644
--- a/install
+++ b/install
@@ -89,6 +89,14 @@ It appears Homebrew is already installed. If your intent is to reinstall you
should do the following before running this installer again:
rm -rf #{HOMEBREW_PREFIX}/Cellar #{HOMEBREW_PREFIX}/.git && brew cleanup
EOABORT
+# Tests will fail if the prefix exists, but we don't have execution
+# permissions. Abort in this case.
+abort <<-EOABORT if File.directory? HOMEBREW_PREFIX and not File.executable? HOMEBREW_PREFIX
+The Homeprew prefix, #{HOMEBREW_PREFIX}, exists but is not searchable. If this is
+not intentional, please restore the default permissions and try running the
+installer again:
+ sudo chmod 755 #{HOMEBREW_PREFIX}
+EOABORT
ohai "This script will install:"
puts "#{HOMEBREW_PREFIX}/bin/brew"