Skip to content

Commit

Permalink
os/mac/diagnostic: fix OpenCore check
Browse files Browse the repository at this point in the history
Fixes #18763.
  • Loading branch information
ZhongRuoyu committed Nov 13, 2024
1 parent b421c2f commit 854fc16
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Library/Homebrew/extend/os/mac/diagnostic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,16 @@ def check_for_unsupported_macos
end

def check_for_opencore
has_opencore =
File.exist?("/Library/PrivilegedHelperTools/com.dortania.opencore-legacy-patcher.privileged-helper")
has_opencore ||= File.exist?("/Library/Application Support/Dortania/OpenCore-Patcher.app")
has_opencore ||= MacOS.pkgutil_info("com.dortania.opencore-legacy-patcher").present?
return unless has_opencore
return if ::Hardware::CPU.physical_cpu_arm64?

# https://dortania.github.io/OpenCore-Legacy-Patcher/UPDATE.html#checking-oclp-and-opencore-versions
begin
opencore_version = Utils.safe_popen_read("/usr/sbin/nvram",

Check warning on line 136 in Library/Homebrew/extend/os/mac/diagnostic.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/extend/os/mac/diagnostic.rb#L136

Added line #L136 was not covered by tests
"4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:opencore-version")
return if opencore_version.blank?
rescue ErrorDuringExecution
return

Check warning on line 140 in Library/Homebrew/extend/os/mac/diagnostic.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/extend/os/mac/diagnostic.rb#L140

Added line #L140 was not covered by tests
end

<<~EOS
You have installed macOS using OpenCore Legacy Patcher.
Expand Down

0 comments on commit 854fc16

Please sign in to comment.