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
- Adds `ipc_control_port_options=0` boot argument
- 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:
- 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
- Increment Binaries:

View File

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

View File

@@ -2,6 +2,7 @@
from pathlib import Path
import plistlib
import subprocess
import requests
from resources import utilities
def list_local_macOS_installers():
@@ -109,16 +110,17 @@ def install_macOS_installer(download_path):
def list_downloadable_macOS_installers(download_path, catalog):
available_apps = {}
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":
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:
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.download_file(link, (Path(download_path) / Path("seed.sucatalog.gz"))):
subprocess.run(["gunzip", "-d", "-f", Path(download_path) / Path("seed.sucatalog.gz")])
catalog_plist = plistlib.load((Path(download_path) / Path("seed.sucatalog")).open("rb"))
if utilities.verify_network_connection(link) is True:
try:
catalog_plist = plistlib.loads(requests.get(link).content)
except plistlib.InvalidFileException:
return available_apps
for item in catalog_plist["Products"]:
try:
@@ -129,8 +131,10 @@ def list_downloadable_macOS_installers(download_path, catalog):
for bm_package in catalog_plist["Products"][item]["Packages"]:
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")))
build_plist = plistlib.load((Path(download_path) / Path("Info.plist")).open("rb"))
try:
build_plist = plistlib.loads(requests.get(bm_package["URL"]).content)
except plistlib.InvalidFileException:
continue
version = build_plist["MobileAssetProperties"]["OSVersion"]
build = build_plist["MobileAssetProperties"]["Build"]
try:

View File

@@ -13,6 +13,8 @@ class OpenCoreLegacyPatcher:
def __init__(self, launch_gui=False):
print("- Loading...")
self.constants = constants.Constants()
if launch_gui is True:
self.constants.wxpython_variant = True
self.generate_base_data()
if utilities.check_cli_args() is None:
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()):
self.success_status = False
print("- Unable to build new kernel cache")
print("\nPlease report this to Github")
print("Reason for Patch Failure:")
print("\nReason for Patch Failure:")
print(result.stdout.decode())
print("")
print("\nPlease reboot the machine to avoid potential issues rerunning the patcher")

View File

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