Skip to content
Snippets Groups Projects
Commit d25767b3 authored by Jack Nagel's avatar Jack Nagel
Browse files

doctor: consolidate directory access checks

Also include a writability check for lib.

Closes Homebrew/homebrew#18571.
parent 873226e7
No related branches found
No related tags found
No related merge requests found
...@@ -307,6 +307,14 @@ def __check_subdir_access base ...@@ -307,6 +307,14 @@ def __check_subdir_access base
end end
end end
def check_access_share_locale
__check_subdir_access 'share/locale'
end
def check_access_share_man
__check_subdir_access 'share/man'
end
def check_access_usr_local def check_access_usr_local
return unless HOMEBREW_PREFIX.to_s == '/usr/local' return unless HOMEBREW_PREFIX.to_s == '/usr/local'
...@@ -322,51 +330,21 @@ def check_access_usr_local ...@@ -322,51 +330,21 @@ def check_access_usr_local
end end
end end
def check_access_share_locale %w{include etc lib lib/pkgconfig share}.each do |d|
__check_subdir_access 'share/locale' class_eval <<-EOS, __FILE__, __LINE__ + 1
end def check_access_#{d.sub("/", "_")}
if (dir = HOMEBREW_PREFIX+'#{d}').exist? && !dir.writable_real?
def check_access_share_man <<-EOF.undent
__check_subdir_access 'share/man' \#{dir} isn't writable.
end This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a brew tries to write a file to this directory, the
def __check_folder_access base, msg install will fail during the link step.
folder = HOMEBREW_PREFIX+base
if folder.exist? and not folder.writable_real? You should probably `chown` \#{dir}
<<-EOS.undent EOF
#{folder} isn't writable. end
This can happen if you "sudo make install" software that isn't managed end
by Homebrew.
#{msg}
You should probably `chown` #{folder}
EOS EOS
end
end
def check_access_pkgconfig
__check_folder_access 'lib/pkgconfig',
'If a brew tries to write a .pc file to this directory, the install will\n'+
'fail during the link step.'
end
def check_access_include
__check_folder_access 'include',
'If a brew tries to write a header file to this directory, the install will\n'+
'fail during the link step.'
end
def check_access_etc
__check_folder_access 'etc',
'If a brew tries to write a file to this directory, the install will\n'+
'fail during the link step.'
end
def check_access_share
__check_folder_access 'share',
'If a brew tries to write a file to this directory, the install will\n'+
'fail during the link step.'
end end
def check_access_logs def check_access_logs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment