installer.py: Download SUCatalog into memory

Skips writing to disk
This commit is contained in:
Mykola Grymalyuk
2022-04-06 13:42:39 -06:00
parent 3a9d97131d
commit 5d193192ef
6 changed files with 23 additions and 13 deletions

View File

@@ -11,9 +11,13 @@
- Resolve Electron Crashing with SIP lowered on 12.3 - Resolve Electron Crashing with SIP lowered on 12.3
- Adds `ipc_control_port_options=0` boot argument - Adds `ipc_control_port_options=0` boot argument
- Unknown whether this is a "bug" or intentional from Apple, affects native Macs with SIP disabled - Unknown whether this is a "bug" or intentional from Apple, affects native Macs with SIP disabled
- Resolve Catalyst crashing after 1200 seconds on non-Metal - Resolved non-Metal issues:
- Catalyst crashing after 1200 seconds on non-Metal
- Automatic Light/Darkmode (credit @moosethegoose2213)
- Increment Binaries: - Increment Binaries:
- PatcherSupportPkg 0.3.6 - release - PatcherSupportPkg 0.3.6 - release
- Speed up loading available remote macOS Installers from Apple
- Skips writing catalogs to disk, loads into memory directly
## 0.4.3 ## 0.4.3
- Increment Binaries: - Increment Binaries:

View File

@@ -105,6 +105,7 @@ class Constants:
self.launcher_binary = None # Determine launch binary (ie. Python vs PyInstaller) self.launcher_binary = None # Determine launch binary (ie. Python vs PyInstaller)
self.launcher_script = None # Determine launch file (if run via Python) self.launcher_script = None # Determine launch file (if run via Python)
self.ignore_updates = False # Ignore OCLP updates self.ignore_updates = False # Ignore OCLP updates
self.wxpython_variant = False # Determine if using wxPython variant
## Hardware ## Hardware
self.computer: device_probe.Computer = None # type: ignore self.computer: device_probe.Computer = None # type: ignore

View File

@@ -2,6 +2,7 @@
from pathlib import Path from pathlib import Path
import plistlib import plistlib
import subprocess import subprocess
import requests
from resources import utilities from resources import utilities
def list_local_macOS_installers(): def list_local_macOS_installers():
@@ -109,16 +110,17 @@ def install_macOS_installer(download_path):
def list_downloadable_macOS_installers(download_path, catalog): def list_downloadable_macOS_installers(download_path, catalog):
available_apps = {} available_apps = {}
if catalog == "DeveloperSeed": if catalog == "DeveloperSeed":
link = "https://swscan.apple.com/content/catalogs/others/index-12seed-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz" link = "https://swscan.apple.com/content/catalogs/others/index-12seed-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog"
elif catalog == "PublicSeed": elif catalog == "PublicSeed":
link = "https://swscan.apple.com/content/catalogs/others/index-12beta-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz" link = "https://swscan.apple.com/content/catalogs/others/index-12beta-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog"
else: else:
link = "https://swscan.apple.com/content/catalogs/others/index-12customerseed-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz" link = "https://swscan.apple.com/content/catalogs/others/index-12customerseed-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog"
# Download and unzip the catalog if utilities.verify_network_connection(link) is True:
if utilities.download_file(link, (Path(download_path) / Path("seed.sucatalog.gz"))): try:
subprocess.run(["gunzip", "-d", "-f", Path(download_path) / Path("seed.sucatalog.gz")]) catalog_plist = plistlib.loads(requests.get(link).content)
catalog_plist = plistlib.load((Path(download_path) / Path("seed.sucatalog")).open("rb")) except plistlib.InvalidFileException:
return available_apps
for item in catalog_plist["Products"]: for item in catalog_plist["Products"]:
try: try:
@@ -129,8 +131,10 @@ def list_downloadable_macOS_installers(download_path, catalog):
for bm_package in catalog_plist["Products"][item]["Packages"]: for bm_package in catalog_plist["Products"][item]["Packages"]:
if "Info.plist" in bm_package["URL"] and "InstallInfo.plist" not in bm_package["URL"]: if "Info.plist" in bm_package["URL"] and "InstallInfo.plist" not in bm_package["URL"]:
utilities.download_file(bm_package["URL"], (Path(download_path) / Path("Info.plist"))) try:
build_plist = plistlib.load((Path(download_path) / Path("Info.plist")).open("rb")) build_plist = plistlib.loads(requests.get(bm_package["URL"]).content)
except plistlib.InvalidFileException:
continue
version = build_plist["MobileAssetProperties"]["OSVersion"] version = build_plist["MobileAssetProperties"]["OSVersion"]
build = build_plist["MobileAssetProperties"]["Build"] build = build_plist["MobileAssetProperties"]["Build"]
try: try:

View File

@@ -13,6 +13,8 @@ class OpenCoreLegacyPatcher:
def __init__(self, launch_gui=False): def __init__(self, launch_gui=False):
print("- Loading...") print("- Loading...")
self.constants = constants.Constants() self.constants = constants.Constants()
if launch_gui is True:
self.constants.wxpython_variant = True
self.generate_base_data() self.generate_base_data()
if utilities.check_cli_args() is None: if utilities.check_cli_args() is None:
if launch_gui is True: if launch_gui is True:

View File

@@ -247,8 +247,7 @@ class PatchSysVolume:
if result.returncode != 0 or (self.constants.detected_os < os_data.os_data.catalina and "KernelCache ID" not in result.stdout.decode()): if result.returncode != 0 or (self.constants.detected_os < os_data.os_data.catalina and "KernelCache ID" not in result.stdout.decode()):
self.success_status = False self.success_status = False
print("- Unable to build new kernel cache") print("- Unable to build new kernel cache")
print("\nPlease report this to Github") print("\nReason for Patch Failure:")
print("Reason for Patch Failure:")
print(result.stdout.decode()) print(result.stdout.decode())
print("") print("")
print("\nPlease reboot the machine to avoid potential issues rerunning the patcher") print("\nPlease reboot the machine to avoid potential issues rerunning the patcher")

View File

@@ -44,7 +44,7 @@ class check_binary_updates:
return False return False
def determine_local_build_type(self): def determine_local_build_type(self):
if self.constants.gui_mode is True: if self.constants.wxpython_variant is True:
return "GUI" return "GUI"
else: else:
return "TUI" return "TUI"