Add 11.2.3 mirror

This commit is contained in:
Mykola Grymalyuk
2021-11-03 11:20:30 -06:00
parent c83e926e7d
commit 924cac7577
6 changed files with 36 additions and 14 deletions
+8 -4
View File
@@ -4,7 +4,7 @@ from __future__ import print_function
import sys
from resources import constants, install, utilities, defaults, sys_patch, installer
from data import cpu_data, smbios_data, model_array, os_data
from data import cpu_data, smbios_data, model_array, os_data, mirror_data
class MenuOptions:
@@ -1073,8 +1073,10 @@ to your USB drive.
menu = utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
avalible_installers = installer.list_downloadable_macOS_installers(self.constants.payload_path, "DeveloperSeed")
if avalible_installers:
# Add mirror of 11.2.3 for users who want it
options.append([f"macOS {mirror_data.Install_macOS_Big_Sur_11_2_3['Version']} ({mirror_data.Install_macOS_Big_Sur_11_2_3['Build']} - {utilities.human_fmt(mirror_data.Install_macOS_Big_Sur_11_2_3['Size'])} - {mirror_data.Install_macOS_Big_Sur_11_2_3['Source']})", lambda: self.download_install_assistant(mirror_data.Install_macOS_Big_Sur_11_2_3['Link'])])
for app in avalible_installers:
options.append([f"macOS {avalible_installers[app]['Version']} ({avalible_installers[app]['Build']} - {utilities.human_fmt(avalible_installers[app]['Size'])})", lambda x=app: self.download_install_assistant(avalible_installers[x]['Link'])])
options.append([f"macOS {avalible_installers[app]['Version']} ({avalible_installers[app]['Build']} - {utilities.human_fmt(avalible_installers[app]['Size'])} - {avalible_installers[app]['Source']})", lambda x=app: self.download_install_assistant(avalible_installers[x]['Link'])])
for option in options:
menu.add_menu_option(option[0], function=option[1])
response = menu.start()
@@ -1107,7 +1109,8 @@ to your USB drive.
utilities.header(["Create macOS installer"])
print("Installer created successfully.")
input("Press enter to exit.")
self.closing_message()
if self.constants.walkthrough is True:
self.closing_message()
else:
utilities.cls()
utilities.header(["Create macOS installer"])
@@ -1115,7 +1118,8 @@ to your USB drive.
input("Press enter to return to the previous.")
return
else:
sys.exit()
if self.constants.walkthrough is True:
sys.exit()
def closing_message(self):
utilities.cls()
+2 -1
View File
@@ -160,7 +160,8 @@ class Constants:
self.disable_msr_power_ctl = False # Disable MSR Power Control (missing battery throttling)
self.software_demux = False # Enable Software Demux patch set
self.force_vmm = False # Force VMM patch
self.custom_sip_value = None # Set custom SIP value
self.custom_sip_value = None # Set custom SIP value
self.walkthrough = False # Enable Walkthrough
self.legacy_accel_support = [
os_data.os_data.mojave,
+1
View File
@@ -99,6 +99,7 @@ def list_downloadable_macOS_installers(download_path, catalog):
"Link": download_link,
"Size": size,
"integirty": integirty,
"Source": "Apple Inc.",
}
})
except KeyError:
+9 -3
View File
@@ -293,6 +293,11 @@ def get_rom(variable: str, *, decode: bool = False):
def download_file(link, location):
if Path(location).exists():
Path(location).unlink()
try:
# Handle cases where Content-Length has garbage or is missing
size_string = f" of {int(requests.head(link).headers['Content-Length']) / 1024 / 1024}MB"
except KeyError:
size_string = ""
response = requests.get(link, stream=True)
short_link = os.path.basename(link)
# SU Catalog's link is quite long, strip to make it bearable
@@ -300,17 +305,18 @@ def download_file(link, location):
short_link = "sucatalog.gz"
header = f"# Downloading: {short_link} #"
box_length = len(header)
box_string = "#" * box_length
with location.open("wb") as file:
count = 0
for chunk in response.iter_content(1024 * 1024 * 4):
file.write(chunk)
count += len(chunk)
cls()
print("#" * box_length)
print(box_string)
print(header)
print("#" * box_length)
print(box_string)
print("")
print(f"{count / 1024 / 1024}MB Downloaded")
print(f"{count / 1024 / 1024}MB Downloaded{size_string}")
checksum = hashlib.sha256()
with location.open("rb") as file:
chunk = file.read(1024 * 1024 * 16)