mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-21 06:30:52 +10:00
Remove curl usage for downloading
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
OCLP-GUI.command
|
OCLP-GUI.command
|
||||||
/payloads/Apple
|
/payloads/Apple
|
||||||
|
/payloads/Apple.zip
|
||||||
/payloads/__MACOSX
|
/payloads/__MACOSX
|
||||||
/App
|
/App
|
||||||
/Build-Folder
|
/Build-Folder
|
||||||
|
|||||||
+24
-12
@@ -5,7 +5,9 @@
|
|||||||
# - Temporary Work-around: sudo bless --mount /System/Volumes/Update/mnt1 --bootefi --last-sealed-snapshot
|
# - Temporary Work-around: sudo bless --mount /System/Volumes/Update/mnt1 --bootefi --last-sealed-snapshot
|
||||||
# - Work-around battery throttling on laptops with no battery (IOPlatformPluginFamily.kext/Contents/PlugIns/ACPI_SMC_PlatformPlugin.kext/Contents/Resources/)
|
# - Work-around battery throttling on laptops with no battery (IOPlatformPluginFamily.kext/Contents/PlugIns/ACPI_SMC_PlatformPlugin.kext/Contents/Resources/)
|
||||||
|
|
||||||
|
import hashlib
|
||||||
import os
|
import os
|
||||||
|
import requests
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import zipfile
|
import zipfile
|
||||||
@@ -328,18 +330,27 @@ class PatchSysVolume:
|
|||||||
elif self.constants.detected_os == self.constants.mojave:
|
elif self.constants.detected_os == self.constants.mojave:
|
||||||
os_ver = "10.14-Mojave"
|
os_ver = "10.14-Mojave"
|
||||||
link = f"{self.constants.url_patcher_support_pkg}{self.constants.patcher_support_pkg_version}/{os_ver}.zip"
|
link = f"{self.constants.url_patcher_support_pkg}{self.constants.patcher_support_pkg_version}/{os_ver}.zip"
|
||||||
Utilities.cls()
|
|
||||||
print("- Downloading Apple binaries")
|
if Path(self.constants.payload_apple_root_path).exists():
|
||||||
popen_oclp = subprocess.Popen(
|
print("- Removing old Apple Binaries")
|
||||||
["curl", "-S", "-L", link, "--output", self.constants.payload_apple_root_path_zip],
|
Path(self.constants.payload_apple_root_path).unlink()
|
||||||
stdin=subprocess.PIPE,
|
|
||||||
stdout=subprocess.PIPE,
|
response = requests.get(link, stream=True)
|
||||||
stderr=subprocess.STDOUT,
|
with self.constants.payload_apple_root_path_zip.open("wb") as file:
|
||||||
universal_newlines=True,
|
count = 0
|
||||||
)
|
for chunk in response.iter_content(1024 * 1024 * 4):
|
||||||
for stdout_line in iter(popen_oclp.stdout.readline, ""):
|
file.write(chunk)
|
||||||
print(stdout_line, end="")
|
count += len(chunk)
|
||||||
popen_oclp.stdout.close()
|
Utilities.cls()
|
||||||
|
print("- Downloading Apple binaries (Big Sur) from PatcherSupportPkg")
|
||||||
|
print(f"- {count / 1024 / 1024}MB Downloaded")
|
||||||
|
checksum = hashlib.sha256()
|
||||||
|
with self.constants.payload_apple_root_path_zip.open("rb") as file:
|
||||||
|
chunk = file.read(1024 * 1024 * 16)
|
||||||
|
while chunk:
|
||||||
|
checksum.update(chunk)
|
||||||
|
chunk = file.read(1024 * 1024 * 16)
|
||||||
|
print(f"- Checksum: {checksum.hexdigest()}")
|
||||||
if self.constants.payload_apple_root_path_zip.exists():
|
if self.constants.payload_apple_root_path_zip.exists():
|
||||||
print("- Download completed")
|
print("- Download completed")
|
||||||
print("- Unzipping download...")
|
print("- Unzipping download...")
|
||||||
@@ -470,6 +481,7 @@ class PatchSysVolume:
|
|||||||
print("- Starting Patch Process")
|
print("- Starting Patch Process")
|
||||||
print(f"- Determinging Required Patch set for Darwin {self.constants.detected_os}")
|
print(f"- Determinging Required Patch set for Darwin {self.constants.detected_os}")
|
||||||
self.detect_patch_set()
|
self.detect_patch_set()
|
||||||
|
self.check_files()
|
||||||
if self.no_patch is False and self.constants.gui_mode is False:
|
if self.no_patch is False and self.constants.gui_mode is False:
|
||||||
change_menu = input("Would you like to continue with Root Volume Patching?(y/n): ")
|
change_menu = input("Would you like to continue with Root Volume Patching?(y/n): ")
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user