mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-23 03:20:16 +10:00
Copy IAs to tmp during CIM
This commit is contained in:
@@ -123,6 +123,9 @@ class create_binary:
|
|||||||
if file.name in delete_files:
|
if file.name in delete_files:
|
||||||
print(f" - Deleting {file.name}")
|
print(f" - Deleting {file.name}")
|
||||||
file.unlink()
|
file.unlink()
|
||||||
|
elif (Path(file) / Path("Contents/Resources/createinstallmedia")).exists():
|
||||||
|
print(f" - Deleting {file}")
|
||||||
|
subprocess.run(["rm", "-rf", file])
|
||||||
|
|
||||||
def download_resources(self):
|
def download_resources(self):
|
||||||
patcher_support_pkg_version = constants.Constants().patcher_support_pkg_version
|
patcher_support_pkg_version = constants.Constants().patcher_support_pkg_version
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class wx_python_gui:
|
|||||||
self.finished_cim_process = False
|
self.finished_cim_process = False
|
||||||
self.target_disk = ""
|
self.target_disk = ""
|
||||||
self.pulse_forward = False
|
self.pulse_forward = False
|
||||||
|
self.prepare_result = False
|
||||||
self.non_metal_required = self.use_non_metal_alternative()
|
self.non_metal_required = self.use_non_metal_alternative()
|
||||||
self.hyperlink_colour = (25, 179, 231)
|
self.hyperlink_colour = (25, 179, 231)
|
||||||
|
|
||||||
@@ -1832,9 +1833,8 @@ class wx_python_gui:
|
|||||||
20
|
20
|
||||||
)
|
)
|
||||||
self.progress_bar.Centre(wx.HORIZONTAL)
|
self.progress_bar.Centre(wx.HORIZONTAL)
|
||||||
self.progress_bar.SetValue(0)
|
|
||||||
|
|
||||||
self.progress_label = wx.StaticText(self.frame, label="Bytes Written: 0")
|
self.progress_label = wx.StaticText(self.frame, label="Preparing files, beginning shortly...")
|
||||||
self.progress_label.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL))
|
self.progress_label.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL))
|
||||||
self.progress_label.SetPosition(
|
self.progress_label.SetPosition(
|
||||||
wx.Point(
|
wx.Point(
|
||||||
@@ -1863,7 +1863,19 @@ class wx_python_gui:
|
|||||||
print("- Creating installer.sh script")
|
print("- Creating installer.sh script")
|
||||||
print(f"- Disk: {disk}")
|
print(f"- Disk: {disk}")
|
||||||
print(f"- Installer: {installer_path}")
|
print(f"- Installer: {installer_path}")
|
||||||
if installer.generate_installer_creation_script(self.constants.installer_sh_path, installer_path, disk):
|
|
||||||
|
self.prepare_script_thread = threading.Thread(target=self.prepare_script, args=(installer_path,disk))
|
||||||
|
self.prepare_script_thread.start()
|
||||||
|
self.progress_bar.Pulse()
|
||||||
|
|
||||||
|
while self.prepare_script_thread.is_alive():
|
||||||
|
self.pulse_alternative(self.progress_bar)
|
||||||
|
wx.GetApp().Yield()
|
||||||
|
|
||||||
|
self.progress_bar.SetValue(0)
|
||||||
|
if self.prepare_result is True:
|
||||||
|
self.progress_label.SetLabel("Bytes Written: 0")
|
||||||
|
self.progress_label.Centre(wx.HORIZONTAL)
|
||||||
print("- Sucessfully generated creation script")
|
print("- Sucessfully generated creation script")
|
||||||
print("- Starting creation script as admin")
|
print("- Starting creation script as admin")
|
||||||
wx.GetApp().Yield()
|
wx.GetApp().Yield()
|
||||||
@@ -1918,8 +1930,15 @@ class wx_python_gui:
|
|||||||
self.build_install_menu()
|
self.build_install_menu()
|
||||||
else:
|
else:
|
||||||
print("- Failed to create installer script")
|
print("- Failed to create installer script")
|
||||||
|
self.progress_label.SetLabel("Failed to copy files to tmp directory")
|
||||||
|
self.progress_label.Centre(wx.HORIZONTAL)
|
||||||
|
popup_message = wx.MessageDialog(self.frame, "Failed to prepare the base files for installer creation.\n\nPlease ensure you have 20GB~ free on-disk before starting to ensure the installer has enough room to work.", "Error", wx.OK)
|
||||||
|
popup_message.ShowModal()
|
||||||
self.return_to_main_menu.Enable()
|
self.return_to_main_menu.Enable()
|
||||||
|
|
||||||
|
def prepare_script(self, installer_path, disk):
|
||||||
|
self.prepare_result = installer.generate_installer_creation_script(self.constants.payload_path, installer_path, disk)
|
||||||
|
|
||||||
def start_script(self):
|
def start_script(self):
|
||||||
utilities.disable_sleep_while_running()
|
utilities.disable_sleep_while_running()
|
||||||
args = [self.constants.oclp_helper_path, "/bin/sh", self.constants.installer_sh_path]
|
args = [self.constants.oclp_helper_path, "/bin/sh", self.constants.installer_sh_path]
|
||||||
|
|||||||
@@ -332,7 +332,7 @@ def list_disk_to_format():
|
|||||||
return list_disks
|
return list_disks
|
||||||
|
|
||||||
|
|
||||||
def generate_installer_creation_script(script_location, installer_path, disk):
|
def generate_installer_creation_script(tmp_location, installer_path, disk):
|
||||||
# Creates installer.sh to be piped to OCLP-Helper and run as admin
|
# Creates installer.sh to be piped to OCLP-Helper and run as admin
|
||||||
# Goals:
|
# Goals:
|
||||||
# - Format provided disk as HFS+ GPT
|
# - Format provided disk as HFS+ GPT
|
||||||
@@ -341,6 +341,24 @@ def generate_installer_creation_script(script_location, installer_path, disk):
|
|||||||
# OCLP-Helper once to avoid nagging the user about permissions
|
# OCLP-Helper once to avoid nagging the user about permissions
|
||||||
|
|
||||||
additional_args = ""
|
additional_args = ""
|
||||||
|
script_location = Path(tmp_location) / Path("Installer.sh")
|
||||||
|
|
||||||
|
# Due to a bug in createinstallmedia, running from '/Applications' may sometimes error:
|
||||||
|
# 'Failed to extract AssetData/boot/Firmware/Manifests/InstallerBoot/*'
|
||||||
|
# This affects native Macs as well even when manually invoking createinstallmedia
|
||||||
|
|
||||||
|
# To resolve, we'll copy into our temp directory and run from there
|
||||||
|
|
||||||
|
# Remove all installers from tmp
|
||||||
|
for file in Path(tmp_location).glob(pattern="*"):
|
||||||
|
if (Path(file) / Path("Contents/Resources/createinstallmedia")).exists():
|
||||||
|
subprocess.run(["rm", "-rf", file])
|
||||||
|
|
||||||
|
# Copy installer to tmp
|
||||||
|
subprocess.run(["cp", "-R", installer_path, tmp_location])
|
||||||
|
|
||||||
|
# Adjust installer_path to point to the copied installer
|
||||||
|
installer_path = Path(tmp_location) / Path(Path(installer_path).name)
|
||||||
|
|
||||||
createinstallmedia_path = str(Path(installer_path) / Path("Contents/Resources/createinstallmedia"))
|
createinstallmedia_path = str(Path(installer_path) / Path("Contents/Resources/createinstallmedia"))
|
||||||
plist_path = str(Path(installer_path) / Path("Contents/Info.plist"))
|
plist_path = str(Path(installer_path) / Path("Contents/Info.plist"))
|
||||||
|
|||||||
Reference in New Issue
Block a user