Check that HOMEBREW_TEMP permits executing programs

This commit is contained in:
Shaun Jackman 2018-08-14 11:51:18 -07:00
parent 3e890c11ad
commit 4adbfa3fcf

View File

@ -17,6 +17,23 @@ module Homebrew
EOS
end
def check_tmpdir_executable
f = Tempfile.new(%w[homebrew_check_tmpdir_executable .sh], HOMEBREW_TEMP)
f.write "#!/bin/sh\n"
f.chmod 0700
f.close
return if system f.path
<<~EOS.undent
The directory #{HOMEBREW_TEMP} does not permit executing
programs. It is likely mounted as "noexec". Please set HOMEBREW_TEMP
in your #{shell_profile} to a different directory, for example:
export HOMEBREW_TEMP=~/tmp
echo 'export HOMEBREW_TEMP=~/tmp' >> #{shell_profile}
EOS
ensure
f.unlink
end
def check_xdg_data_dirs
return if ENV["XDG_DATA_DIRS"].to_s.empty?
return if ENV["XDG_DATA_DIRS"].split("/").include?(HOMEBREW_PREFIX/"share")