mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-11 16:27:19 +10:00
Add patching utility for internal developers
This commit is contained in:
BIN
DortaniaInternalResources.dmg
Normal file
BIN
DortaniaInternalResources.dmg
Normal file
Binary file not shown.
@@ -1,15 +1,23 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
import sys, os, time, subprocess
|
||||
import sys, os, time, subprocess, pathlib
|
||||
sys.path.append(os.path.abspath(os.getcwd()))
|
||||
from resources import constants
|
||||
block_cipher = None
|
||||
|
||||
datas = [
|
||||
('payloads.dmg', '.'),
|
||||
('Universal-Binaries.dmg', '.'),
|
||||
|
||||
]
|
||||
if pathlib.Path("DortaniaInternalResources.dmg").exists():
|
||||
datas.append(('DortaniaInternalResources.dmg', '.'))
|
||||
|
||||
|
||||
a = Analysis(['OpenCore-Patcher-GUI.command'],
|
||||
pathex=[],
|
||||
binaries=[],
|
||||
datas=[('payloads.dmg', '.'), ('Universal-Binaries.dmg', '.')],
|
||||
datas=datas,
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
|
||||
@@ -1006,7 +1006,7 @@ class SystemPatchDictionary():
|
||||
"OS Minor": 99
|
||||
},
|
||||
},
|
||||
"Install Reference": {
|
||||
"Install": {
|
||||
"/System/Library/Extensions": {
|
||||
"IOGPUFamily.kext": "13.5 Beta 2",
|
||||
"IOSurface.kext": "13.5 Beta 2",
|
||||
@@ -1031,7 +1031,7 @@ class SystemPatchDictionary():
|
||||
"OS Minor": 99
|
||||
},
|
||||
},
|
||||
"Install Reference": {
|
||||
"Install": {
|
||||
"/System/Library/Extensions": {
|
||||
"IOAcceleratorFamily2.kext": "13.5 Beta 2",
|
||||
},
|
||||
@@ -1139,8 +1139,8 @@ class SystemPatchDictionary():
|
||||
"CoreWiFi.framework": "12.6.2",
|
||||
"IO80211.framework": "12.6.2",
|
||||
# TODO: When PatchSupportPkg has published binaries, remove comment
|
||||
# **({ "CoreAnalytics.framework": "13.5 Beta 2"} if self.os_major >= os_data.os_data.sonoma else {}),
|
||||
# **({ "WiFiAnalytics.framework": "13.5 Beta 2"} if self.os_major >= os_data.os_data.sonoma else {}),
|
||||
**({ "CoreAnalytics.framework": "13.5 Beta 2"} if self.os_major >= os_data.os_data.sonoma else {}),
|
||||
**({ "WiFiAnalytics.framework": "13.5 Beta 2"} if self.os_major >= os_data.os_data.sonoma else {}),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1158,7 +1158,7 @@ class SystemPatchDictionary():
|
||||
"OS Minor": 99
|
||||
},
|
||||
},
|
||||
"Install Reference": {
|
||||
"Install": {
|
||||
"/usr/libexec": {
|
||||
"airportd": "13.5 Beta 2",
|
||||
"wifianalyticsd": "13.5 Beta 2",
|
||||
|
||||
@@ -229,6 +229,7 @@ class Constants:
|
||||
os_data.os_data.big_sur,
|
||||
os_data.os_data.monterey,
|
||||
os_data.os_data.ventura,
|
||||
os_data.os_data.sonoma,
|
||||
]
|
||||
|
||||
# Payload Location
|
||||
@@ -242,6 +243,9 @@ class Constants:
|
||||
def payload_local_binaries_root_path_dmg(self):
|
||||
return self.original_path / Path("Universal-Binaries.dmg")
|
||||
|
||||
@property
|
||||
def overlay_psp_path_dmg(self):
|
||||
return self.original_path / Path("DortaniaInternalResources.dmg")
|
||||
|
||||
# OpenCore
|
||||
@property
|
||||
|
||||
@@ -71,7 +71,7 @@ class RoutePayloadDiskImage:
|
||||
dmg_info = plistlib.loads(dmg_info.stdout)
|
||||
|
||||
|
||||
for variant in ["Universal-Binaries.dmg", "payloads.dmg"]:
|
||||
for variant in ["Universal-Binaries.dmg", "payloads.dmg", "DortaniaInternal.dmg"]:
|
||||
for image in dmg_info["images"]:
|
||||
if image["image-path"].endswith(variant):
|
||||
if unmount_all_active is False:
|
||||
|
||||
@@ -32,11 +32,13 @@
|
||||
# This is because Apple removed on-disk binaries (ref: https://github.com/dortania/OpenCore-Legacy-Patcher/issues/998)
|
||||
# 'sudo ditto /Library/Developer/KDKs/<KDK Version>/System /System/Volumes/Update/mnt1/System'
|
||||
|
||||
import logging
|
||||
import plistlib
|
||||
import subprocess
|
||||
import applescript
|
||||
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
import logging
|
||||
|
||||
from resources import constants, utilities, kdk_handler
|
||||
from resources.sys_patch import sys_patch_detect, sys_patch_auto, sys_patch_helpers, sys_patch_generate
|
||||
@@ -863,6 +865,75 @@ class PatchSysVolume:
|
||||
return False
|
||||
|
||||
logging.info("- Mounted Universal-Binaries.dmg")
|
||||
if Path(self.constants.overlay_psp_path_dmg).exists() and Path("~/.dortania_developer").expanduser().exists():
|
||||
icon_path = str(self.constants.app_icon_path).replace("/", ":")[1:]
|
||||
msg = "Welcome to the DortaniaInternal Program, please provided the decryption key to access internal resources. Press cancel to skip."
|
||||
password = Path("~/.dortania_developer_key").expanduser().read_text().strip() if Path("~/.dortania_developer_key").expanduser().exists() else ""
|
||||
for i in range(3):
|
||||
try:
|
||||
if password == "":
|
||||
password = applescript.AppleScript(
|
||||
f"""
|
||||
set theResult to display dialog "{msg}" default answer "" with hidden answer with title "OpenCore Legacy Patcher" with icon file "{icon_path}"
|
||||
|
||||
return the text returned of theResult
|
||||
"""
|
||||
).run()
|
||||
|
||||
result = subprocess.run(
|
||||
[
|
||||
"hdiutil", "attach", "-noverify", f"{self.constants.overlay_psp_path_dmg}",
|
||||
"-mountpoint", Path(self.constants.payload_path / Path("DortaniaInternal")),
|
||||
"-nobrowse",
|
||||
"-passphrase", password
|
||||
],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT
|
||||
)
|
||||
if result.returncode == 0:
|
||||
logging.info("- Mounted DortaniaInternal resources")
|
||||
result = subprocess.run(
|
||||
[
|
||||
"ditto", f"{self.constants.payload_path / Path('DortaniaInternal')}", f"{self.constants.payload_path / Path('Universal-Binaries')}"
|
||||
],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT
|
||||
)
|
||||
if result.returncode == 0:
|
||||
return True
|
||||
|
||||
logging.info("- Failed to merge DortaniaInternal resources")
|
||||
logging.info(f"Output: {result.stdout.decode()}")
|
||||
logging.info(f"Return Code: {result.returncode}")
|
||||
return False
|
||||
|
||||
logging.info("- Failed to mount DortaniaInternal resources")
|
||||
logging.info(f"Output: {result.stdout.decode()}")
|
||||
logging.info(f"Return Code: {result.returncode}")
|
||||
|
||||
if "Authentication error" not in result.stdout.decode():
|
||||
try:
|
||||
# Display that the disk image might be corrupted
|
||||
applescript.AppleScript(
|
||||
f"""
|
||||
display dialog "Failed to mount DortaniaInternal resources, please file an internal radar:\n\n{result.stdout.decode()}" with title "OpenCore Legacy Patcher" with icon file "{icon_path}"
|
||||
"""
|
||||
).run()
|
||||
return False
|
||||
except Exception as e:
|
||||
pass
|
||||
break
|
||||
msg = f"Decryption failed, please try again. {2 - i} attempts remaining. "
|
||||
password = ""
|
||||
|
||||
if i == 2:
|
||||
applescript.AppleScript(
|
||||
f"""
|
||||
display dialog "Failed to mount DortaniaInternal resources, too many incorrect passwords. If this continues with the correct decryption key, please file an internal radar." with title "OpenCore Legacy Patcher" with icon file "{icon_path}"
|
||||
"""
|
||||
).run()
|
||||
return False
|
||||
except Exception as e:
|
||||
break
|
||||
|
||||
return True
|
||||
|
||||
logging.info("- PatcherSupportPkg resources missing, Patcher likely corrupted!!!")
|
||||
|
||||
@@ -84,7 +84,6 @@ class AutomaticSysPatch:
|
||||
if patches[patch] is True and not patch.startswith("Settings") and not patch.startswith("Validation"):
|
||||
patch_string += f"- {patch}\n"
|
||||
|
||||
logging.info("- No new binaries found on Github, proceeding with patching")
|
||||
logging.info("- No new binaries found on Github, proceeding with patching")
|
||||
if self.constants.launcher_script is None:
|
||||
args_string = f"'{self.constants.launcher_binary}' --gui_patch"
|
||||
|
||||
@@ -543,13 +543,13 @@ class DetectRootPatch:
|
||||
# Due to extracted frameworks for IO80211.framework and co, check library validation
|
||||
self.amfi_must_disable = True
|
||||
|
||||
# if (
|
||||
# isinstance(self.constants.computer.wifi, device_probe.Broadcom)
|
||||
# and self.constants.computer.wifi.chipset in [device_probe.Broadcom.Chipsets.AirPortBrcm4360, device_probe.Broadcom.Chipsets.AirportBrcmNIC]):
|
||||
# if self.constants.detected_os > os_data.os_data.ventura:
|
||||
# self.modern_wifi = True
|
||||
# self.amfi_must_disable = True
|
||||
# self.requires_root_kc = True
|
||||
if (
|
||||
isinstance(self.constants.computer.wifi, device_probe.Broadcom)
|
||||
and self.constants.computer.wifi.chipset in [device_probe.Broadcom.Chipsets.AirPortBrcm4360, device_probe.Broadcom.Chipsets.AirportBrcmNIC]):
|
||||
if self.constants.detected_os > os_data.os_data.ventura:
|
||||
self.modern_wifi = True
|
||||
self.amfi_must_disable = True
|
||||
self.requires_root_kc = True
|
||||
|
||||
# if self.model in ["MacBookPro5,1", "MacBookPro5,2", "MacBookPro5,3", "MacBookPro8,2", "MacBookPro8,3"]:
|
||||
if self.model in ["MacBookPro8,2", "MacBookPro8,3"]:
|
||||
|
||||
Reference in New Issue
Block a user