os/mac/diagnostic: improve OpenCore check

This is based on [1].

[1]: https://github.com/Homebrew/brew/pull/18765#issuecomment-2474056438
This commit is contained in:
Ruoyu Zhong 2024-11-14 00:55:49 +08:00
parent 5a2c264d19
commit d0418add45
No known key found for this signature in database

View File

@ -130,13 +130,14 @@ module OS
def check_for_opencore def check_for_opencore
return if ::Hardware::CPU.physical_cpu_arm64? return if ::Hardware::CPU.physical_cpu_arm64?
return if ENV["CI"]
# https://dortania.github.io/OpenCore-Legacy-Patcher/UPDATE.html#checking-oclp-and-opencore-versions # https://dortania.github.io/OpenCore-Legacy-Patcher/UPDATE.html#checking-oclp-and-opencore-versions
begin begin
opencore_version = Utils.safe_popen_read("/usr/sbin/nvram", opencore_version = Utils.safe_popen_read("/usr/sbin/nvram",
"4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:opencore-version").split[1] "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:opencore-version").split[1]
return if opencore_version.blank? oclp_version = Utils.safe_popen_read("/usr/sbin/nvram",
"4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:oclp-version").split[1]
return if opencore_version.blank? || oclp_version.blank?
rescue ErrorDuringExecution rescue ErrorDuringExecution
return return
end end