brew doctor - also check permisisons on share

This commit is contained in:
Adam Vandenberg 2011-03-28 11:48:45 -07:00
parent 89720e1d20
commit 3fcacb041d

View File

@ -170,58 +170,46 @@ def check_access_share_man
__check_subdir_access 'share/man' __check_subdir_access 'share/man'
end end
def check_access_pkgconfig def __check_folder_access base, msg
# If PREFIX/lib/pkgconfig already exists, "sudo make install" of folder = HOMEBREW_PREFIX+base
# non-brew installed software may cause installation failures. return unless folder.exist?
pkgconfig = HOMEBREW_PREFIX+'lib/pkgconfig'
return unless pkgconfig.exist?
unless pkgconfig.writable? unless folder.writable?
puts <<-EOS.undent puts <<-EOS.undent
#{pkgconfig} isn't writable. #{folder} isn't writable.
This can happen if you "sudo make install" software that isn't managed This can happen if you "sudo make install" software that isn't managed
by Homebrew. If a brew tries to write a .pc file to this folder, the by Homebrew.
install will fail during the link step.
You should probably `chown` #{pkgconfig} #{msg}
You should probably `chown` #{folder}
EOS EOS
end end
end end
def check_access_pkgconfig
__check_folder_access 'lib/pkgconfig',
'If a brew tries to write a .pc file to this folder, the install will\n'+
'fail during the link step.'
end
def check_access_include def check_access_include
# Installing MySQL manually (for instance) can chown include to root. __check_folder_access 'include',
include_folder = HOMEBREW_PREFIX+'include' 'If a brew tries to write a header file to this folder, the install will\n'+
return unless include_folder.exist? 'fail during the link step.'
unless include_folder.writable?
puts <<-EOS.undent
#{include_folder} isn't writable.
This can happen if you "sudo make install" software that isn't managed
by Homebrew. If a brew tries to write a header file to this folder, the
install will fail during the link step.
You should probably `chown` #{include_folder}
EOS
end
end end
def check_access_etc def check_access_etc
etc_folder = HOMEBREW_PREFIX+'etc' __check_folder_access 'etc',
return unless etc_folder.exist? 'If a brew tries to write a file to this folder, the install will\n'+
'fail during the link step.'
end
unless etc_folder.writable? def check_access_share
puts <<-EOS.undent __check_folder_access 'share',
#{etc_folder} isn't writable. 'If a brew tries to write a file to this folder, the install will\n'+
This can happen if you "sudo make install" software that isn't managed 'fail during the link step.'
by Homebrew. If a brew tries to write a file to this folder, the install
will fail during the link step.
You should probably `chown` #{etc_folder}
EOS
end
end end
def check_usr_bin_ruby def check_usr_bin_ruby
@ -598,10 +586,11 @@ module Homebrew extend self
check_for_other_package_managers check_for_other_package_managers
check_for_x11 check_for_x11
check_for_nonstandard_x11 check_for_nonstandard_x11
check_access_share_locale
check_access_share_man
check_access_include check_access_include
check_access_etc check_access_etc
check_access_share
check_access_share_locale
check_access_share_man
check_user_path check_user_path
check_which_pkg_config check_which_pkg_config
check_pkg_config_paths check_pkg_config_paths