From 8acac5aa713a271edb23d88ef19140b3a39e969f Mon Sep 17 00:00:00 2001 From: Dominyk Tiller Date: Fri, 30 Oct 2015 18:42:19 +0000 Subject: [PATCH] doctor: unify chown messages Closes Homebrew/homebrew#45398. --- Library/Homebrew/cmd/doctor.rb | 43 ++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 6423abe0b4..90d718ba81 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -408,11 +408,12 @@ class Checks return if cant_read.empty? inject_file_list cant_read.sort, <<-EOS.undent - Some directories in #{target} aren't writable. - This can happen if you "sudo make install" software that isn't managed - by Homebrew. If a brew tries to add locale information to one of these - directories, then the install will fail during the link step. - You should probably `chown` them: + Some directories in #{target} aren't writable. + This can happen if you "sudo make install" software that isn't managed + by Homebrew. If a brew tries to add locale information to one of these + directories, then the install will fail during the link step. + + You should probably `sudo chown -R $(whoami)` them: EOS end @@ -427,7 +428,10 @@ class Checks def check_access_homebrew_repository unless HOMEBREW_REPOSITORY.writable_real? then <<-EOS.undent The #{HOMEBREW_REPOSITORY} is not writable. - You should probably `chown` #{HOMEBREW_REPOSITORY} + + You should probably change the ownership and permissions of #{HOMEBREW_REPOSITORY} + back to your user account. + sudo chown -R $(whoami) #{HOMEBREW_REPOSITORY} EOS end end @@ -467,7 +471,9 @@ class Checks by Homebrew. If a formula tries to write a file to this directory, the install will fail during the link step. - You should probably `chown` #{dir} + You should probably change the ownership and permissions of #{dir} + back to your user account. + sudo chown -R $(whoami) #{dir} EOS end end @@ -481,7 +487,9 @@ class Checks by Homebrew. If you install a formula with Python modules, the install will fail during the link step. - You should probably `chown` #{Language::Python.homebrew_site_packages} + You should probably change the ownership and permissions of #{Language::Python.homebrew_site_packages} + back to your user account. + sudo chown -R $(whoami) #{Language::Python.homebrew_site_packages} EOS end end @@ -491,7 +499,10 @@ class Checks <<-EOS.undent #{HOMEBREW_LOGS} isn't writable. Homebrew writes debugging logs to this location. - You should probably `chown` #{HOMEBREW_LOGS} + + You should probably change the ownership and permissions of #{HOMEBREW_LOGS} + back to your user account. + sudo chown -R $(whoami) #{HOMEBREW_LOGS} EOS end end @@ -502,7 +513,10 @@ class Checks #{HOMEBREW_CACHE} isn't writable. This can happen if you run `brew install` or `brew fetch` as another user. Homebrew caches downloaded files to this location. - You should probably `chown` #{HOMEBREW_CACHE} + + You should probably change the ownership and permissions of #{HOMEBREW_CACHE} + back to your user account. + sudo chown -R $(whoami) #{HOMEBREW_CACHE} EOS end end @@ -511,7 +525,10 @@ class Checks if HOMEBREW_CELLAR.exist? && !HOMEBREW_CELLAR.writable_real? <<-EOS.undent #{HOMEBREW_CELLAR} isn't writable. - You should `chown` #{HOMEBREW_CELLAR} + + You should probably change the ownership and permissions of #{HOMEBREW_CELLAR} + back to your user account. + sudo chown -R $(whoami) #{HOMEBREW_CELLAR} EOS end end @@ -521,7 +538,9 @@ class Checks if opt.exist? && !opt.writable_real? <<-EOS.undent #{opt} isn't writable. - You should `chown` #{opt} + You should probably change the ownership and permissions of #{opt} + back to your user account. + sudo chown -R $(whoami) #{opt} EOS end end