2018-06-05 23:19:18 -04:00
|
|
|
require "diagnostic"
|
|
|
|
require "fileutils"
|
|
|
|
require "hardware"
|
|
|
|
require "development_tools"
|
|
|
|
|
|
|
|
module Homebrew
|
|
|
|
module Install
|
|
|
|
module_function
|
|
|
|
|
|
|
|
def check_ppc
|
|
|
|
case Hardware::CPU.type
|
|
|
|
when :ppc
|
|
|
|
abort <<~EOS
|
|
|
|
Sorry, Homebrew does not support your computer's CPU architecture.
|
|
|
|
For PPC support, see: https://github.com/mistydemeo/tigerbrew
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-09-06 18:38:43 +01:00
|
|
|
def attempt_directory_creation
|
|
|
|
Keg::MUST_BE_WRITABLE_DIRECTORIES.each do |dir|
|
|
|
|
begin
|
|
|
|
FileUtils.mkdir_p(dir) unless dir.exist?
|
|
|
|
rescue
|
|
|
|
nil
|
|
|
|
end
|
2018-06-05 23:19:18 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-09-06 18:38:43 +01:00
|
|
|
def perform_development_tools_checks
|
|
|
|
fatal_checks(:fatal_development_tools_checks)
|
|
|
|
end
|
|
|
|
|
|
|
|
def perform_preinstall_checks
|
|
|
|
check_ppc
|
|
|
|
attempt_directory_creation
|
|
|
|
fatal_checks(:fatal_install_checks)
|
|
|
|
end
|
|
|
|
|
|
|
|
def fatal_checks(type)
|
|
|
|
@checks ||= Diagnostic::Checks.new
|
2018-07-02 10:25:04 +01:00
|
|
|
failed = false
|
2018-09-06 18:38:43 +01:00
|
|
|
@checks.public_send(type).each do |check|
|
|
|
|
out = @checks.public_send(check)
|
2018-06-05 23:19:18 -04:00
|
|
|
next if out.nil?
|
2018-07-02 10:25:04 +01:00
|
|
|
failed ||= true
|
2018-06-05 23:19:18 -04:00
|
|
|
ofail out
|
|
|
|
end
|
2018-07-02 10:25:04 +01:00
|
|
|
exit 1 if failed
|
2018-06-05 23:19:18 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|