mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-17 13:22:54 +10:00
Fix variable naming for kernel versions
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
A python program for building and booting [OpenCore](https://github.com/acidanthera/OpenCorePkg) on legacy Macs, see [Supported SMBIOS](https://dortania.github.io/OpenCore-Legacy-Patcher/MODELS.html) on whether your model is supported. Designed around Big Sur support, however can be used on older OSes.
|
||||
|
||||
* Application supports running on macOS Mavericks (10.9) and newer
|
||||
* Supports macOS Lion (10.7) and newer if [python 3.6 or higher](https://www.python.org/downloads/) is manually installed, simply run the `OpenCore-Patcher.command` located in the repo
|
||||
|
||||
Supported features:
|
||||
|
||||
|
||||
@@ -59,6 +59,21 @@ class Constants:
|
||||
self.secure_status = True
|
||||
self.detected_os = 0
|
||||
|
||||
# OS Versions
|
||||
self.tiger = 8
|
||||
self.leopard = 9
|
||||
self.snow_leopard = 10
|
||||
self.lion = 11
|
||||
self.mountain_lion = 12
|
||||
self.mavericks = 13
|
||||
self.yosemite = 14
|
||||
self.el_capitan = 15
|
||||
self.sierra = 16
|
||||
self.high_sierra = 17
|
||||
self.mojave = 18
|
||||
self.catalina = 19
|
||||
self.big_sur = 20
|
||||
|
||||
# Payload Location
|
||||
# OpenCore
|
||||
@property
|
||||
|
||||
@@ -233,8 +233,8 @@ class PatchSysVolume:
|
||||
print("Root Patching not required for this machine!")
|
||||
elif self.model not in ModelArray.SupportedSMBIOS:
|
||||
print("Cannot run on this machine, model is unsupported!")
|
||||
elif self.constants.detected_os < 20:
|
||||
print(f"Cannot run on this OS! Kernel detected: {self.constants.detected_os}")
|
||||
elif self.constants.detected_os < self.constants.big_sur:
|
||||
print(f"Cannot run on this OS, requires macOS 11!")
|
||||
else:
|
||||
self.check_status()
|
||||
utilities.cls()
|
||||
@@ -262,8 +262,8 @@ class PatchSysVolume:
|
||||
def start_unpatch(self):
|
||||
if self.constants.custom_model is not None:
|
||||
print("Unpatching must be done on target machine!")
|
||||
elif self.constants.detected_os < 20:
|
||||
print(f"Cannot run on this OS! Kernel detected: {self.constants.detected_os}")
|
||||
elif self.constants.detected_os < self.constants.big_sur:
|
||||
print(f"Cannot run on this OS, requires macOS 11!")
|
||||
else:
|
||||
self.check_status()
|
||||
utilities.cls()
|
||||
|
||||
@@ -96,12 +96,12 @@ class BuildOpenCore:
|
||||
|
||||
# WiFi patches
|
||||
# TODO: -a is not supported in Lion and older, need to add proper fix
|
||||
try:
|
||||
if self.constants.detected_os > self.constants.lion:
|
||||
wifi_devices = plistlib.loads(subprocess.run("ioreg -c IOPCIDevice -r -d2 -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
|
||||
wifi_devices = [i for i in wifi_devices if i["vendor-id"] == binascii.unhexlify("E4140000") and i["class-code"] == binascii.unhexlify("00800200")]
|
||||
except ValueError:
|
||||
else:
|
||||
wifi_devices = ""
|
||||
print("- Couldn't run Wifi hardware detection")
|
||||
print("- Can't run Wifi hardware detection on Snow Leopard and older")
|
||||
if self.constants.wifi_build is True:
|
||||
print("- Skipping Wifi patches on request")
|
||||
elif not self.constants.custom_model and wifi_devices and self.hexswap(binascii.hexlify(wifi_devices[0]["device-id"]).decode()[:4]) in ModelArray.nativeWifi:
|
||||
@@ -497,7 +497,7 @@ Please build OpenCore first!"""
|
||||
print("\nDisk picker is loading...")
|
||||
|
||||
all_disks = {}
|
||||
# TODO: AllDisksAndPartitions is not supported in Mountain Lion(?) and older
|
||||
# TODO: AllDisksAndPartitions is not supported in Snow Leopard and older
|
||||
try:
|
||||
# High Sierra and newer
|
||||
disks = plistlib.loads(subprocess.run("diskutil list -plist physical".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
|
||||
@@ -568,7 +568,7 @@ Please build OpenCore first!"""
|
||||
" without altering line endings",
|
||||
]
|
||||
|
||||
if self.constants.detected_os > 14: # Yosemite's kernel
|
||||
if self.constants.detected_os > self.constants.yosemite:
|
||||
result = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
else:
|
||||
result = subprocess.run(f"diskutil mount {disk_identifier}s{response}".split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
||||
Reference in New Issue
Block a user