From fb732ff0691c852f2c0ed79c9376abbfd90fe0c9 Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Thu, 7 Jul 2022 19:26:02 -0600 Subject: [PATCH 1/6] installer.py: Add CoW support check HFS+ root volumes do not support CoW --- resources/installer.py | 9 ++++++++- resources/utilities.py | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/resources/installer.py b/resources/installer.py index 0217087cc..b6ec28cdb 100644 --- a/resources/installer.py +++ b/resources/installer.py @@ -363,10 +363,17 @@ def generate_installer_creation_script(tmp_location, installer_path, disk): subprocess.run(["rm", "-rf", str(file)]) # Copy installer to tmp (use CoW to avoid extra disk writes) - subprocess.run(["cp", "-cR", installer_path, ia_tmp]) + args = ["cp", "-cR", installer_path, ia_tmp] + if utilities.check_filesystem_type() != "apfs": + # HFS+ disks do not support CoW + args[1] = "-R" + subprocess.run(args) # Adjust installer_path to point to the copied installer installer_path = Path(ia_tmp) / Path(Path(installer_path).name) + if not Path(installer_path).exists(): + print(f"Failed to copy installer to {ia_tmp}") + return False createinstallmedia_path = str(Path(installer_path) / Path("Contents/Resources/createinstallmedia")) plist_path = str(Path(installer_path) / Path("Contents/Info.plist")) diff --git a/resources/utilities.py b/resources/utilities.py index 71d3864dd..6ea3fb514 100644 --- a/resources/utilities.py +++ b/resources/utilities.py @@ -93,6 +93,10 @@ def check_seal(): else: return False +def check_filesystem_type(): + # Expected to return 'apfs' or 'hfs' + filesystem_type = plistlib.loads(subprocess.run(["diskutil", "info", "-plist", "/"], stdout=subprocess.PIPE).stdout.decode().strip().encode()) + return filesystem_type["FilesystemType"] def csr_dump(): # Based off sip_config.py From ffb4613221639b0daef5a1e1f519f7a678e9d676 Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Tue, 12 Jul 2022 09:50:21 -0600 Subject: [PATCH 2/6] installer.py: Avoid listing beta installers and warn 13.0 builds --- gui/gui_main.py | 11 +++++++++++ resources/installer.py | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/gui/gui_main.py b/gui/gui_main.py index 249a751ae..51d6d98fe 100644 --- a/gui/gui_main.py +++ b/gui/gui_main.py @@ -1495,6 +1495,17 @@ class wx_python_gui: self.grab_installer_data(ias=ias) def download_macos_click(self, app_dict): + + try: + app_major = app_dict['Version'].split(".")[0] + if float(app_major) > self.constants.os_support: + # Throw pop up warning OCLP does not support this OS + dlg = wx.MessageDialog(self.frame_modal, f"OpenCore Legacy patcher currently does not support macOS {os_data.os_conversion.convert_kernel_to_marketing_name(os_data.os_conversion.os_to_kernel(app_major))}. We highly recommend you select and older installer.\n\nThe newest version we officially support is macOS {os_data.os_conversion.convert_kernel_to_marketing_name(os_data.os_conversion.os_to_kernel(str(self.constants.os_support)))}", "Unsupported OS", wx.YES_NO | wx.ICON_WARNING) + if dlg.ShowModal() == wx.ID_NO: + return + except ValueError: + pass + self.frame.DestroyChildren() installer_name = f"macOS {app_dict['Version']} ({app_dict['Build']})" diff --git a/resources/installer.py b/resources/installer.py index b6ec28cdb..7de40ffdd 100644 --- a/resources/installer.py +++ b/resources/installer.py @@ -207,6 +207,11 @@ def only_list_newest_installers(available_apps): # Now remove all versions that are not the largest for ia in list(available_apps): + if available_apps[ia]["Variant"] in ["DeveloperSeed", "PublicSeed"]: + # Remove Beta builds from default listing + available_apps.pop(ia) + continue + if available_apps[ia]["Version"].startswith(version): remote_version = available_apps[ia]["Version"].split(".") if remote_version[0] == "10": From 1a4538c32040951af87b6a4a6d7b8df0afbf1e15 Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Tue, 12 Jul 2022 09:59:10 -0600 Subject: [PATCH 3/6] Sync changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46a56a55c..39f1b31ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ - Attempt to avoid misuse of option - Work-around `Failed to extract AssetData` during installer creation - Apple bug, resolved by using CoW into a different directory than `/Applications` +- Avoid listing beta installers in downloader +- Warn about downloading macOS Ventura installers, unsupported by current patcher ## 0.4.7 - Fix crashing on defaults parsing From 57daf050b245b827fc499044a6890962e0e0e655 Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Tue, 12 Jul 2022 15:39:53 -0600 Subject: [PATCH 4/6] gui_main.py: Adjust prompt --- gui/gui_main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gui/gui_main.py b/gui/gui_main.py index 51d6d98fe..3c8d8e19e 100644 --- a/gui/gui_main.py +++ b/gui/gui_main.py @@ -1500,7 +1500,8 @@ class wx_python_gui: app_major = app_dict['Version'].split(".")[0] if float(app_major) > self.constants.os_support: # Throw pop up warning OCLP does not support this OS - dlg = wx.MessageDialog(self.frame_modal, f"OpenCore Legacy patcher currently does not support macOS {os_data.os_conversion.convert_kernel_to_marketing_name(os_data.os_conversion.os_to_kernel(app_major))}. We highly recommend you select and older installer.\n\nThe newest version we officially support is macOS {os_data.os_conversion.convert_kernel_to_marketing_name(os_data.os_conversion.os_to_kernel(str(self.constants.os_support)))}", "Unsupported OS", wx.YES_NO | wx.ICON_WARNING) + os = os_data.os_conversion.convert_kernel_to_marketing_name(os_data.os_conversion.os_to_kernel(app_major)) + dlg = wx.MessageDialog(self.frame_modal, f"OpenCore Legacy patcher currently does not support macOS {os}. We highly recommend you select an older installer.\n\nThe newest version we officially support is macOS {os_data.os_conversion.convert_kernel_to_marketing_name(os_data.os_conversion.os_to_kernel(str(self.constants.os_support)))}\n\nWould you still want to continue downloading macOS {os}?", "Unsupported OS", wx.YES_NO | wx.ICON_WARNING) if dlg.ShowModal() == wx.ID_NO: return except ValueError: From ac5c754789dc4d5814cb759147b8a754ace8041d Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Sat, 16 Jul 2022 13:36:05 -0600 Subject: [PATCH 5/6] gui_main.py: Fix typo --- gui/gui_main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gui/gui_main.py b/gui/gui_main.py index 3c8d8e19e..b87497bb1 100644 --- a/gui/gui_main.py +++ b/gui/gui_main.py @@ -1887,7 +1887,7 @@ class wx_python_gui: 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("- Successfully generated creation script") print("- Starting creation script as admin") wx.GetApp().Yield() time.sleep(1) @@ -1926,13 +1926,13 @@ class wx_python_gui: self.constants.host_is_hackintosh is True ) ): - popup_message = wx.MessageDialog(self.frame, "Sucessfully created a macOS installer!", "Success", wx.OK) + popup_message = wx.MessageDialog(self.frame, "Successfully created a macOS installer!", "Success", wx.OK) popup_message.ShowModal() else: self.dialog = wx.MessageDialog( parent=self.frame, message="Would you like to continue and Install OpenCore to this disk?", - caption="Sucessfully created the macOS installer!", + caption="Successfully created the macOS installer!", style=wx.YES_NO | wx.ICON_QUESTION ) self.dialog.SetYesNoLabels("Install OpenCore to disk", "Skip") @@ -1956,7 +1956,7 @@ class wx_python_gui: args = [self.constants.oclp_helper_path, "/bin/sh", self.constants.installer_sh_path] output, error, returncode = run.Run()._stream_output(comm=args) if "Install media now available at" in output: - print("- Sucessfully created macOS installer") + print("- Successfully created macOS installer") while self.download_thread.is_alive(): # wait for download_thread to finish # though highly unlikely this thread is still alive (flashing an Installer will take a while) From bbb087db63b2e73dc54b49a7a692a361cfd0ec21 Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Sat, 16 Jul 2022 14:10:13 -0600 Subject: [PATCH 6/6] gui_main.py: Fix available typo --- gui/gui_main.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gui/gui_main.py b/gui/gui_main.py index b87497bb1..3b204f1ac 100644 --- a/gui/gui_main.py +++ b/gui/gui_main.py @@ -1750,12 +1750,12 @@ class wx_python_gui: self.usb_selection_label.Centre(wx.HORIZONTAL) i = -15 - availible_disks = installer.list_disk_to_format() - if availible_disks: + available_disks = installer.list_disk_to_format() + if available_disks: print("Disks found") - for disk in availible_disks: - print(f"{disk}: {availible_disks[disk]['name']} - {availible_disks[disk]['size']}") - self.usb_selection = wx.Button(self.frame, label=f"{disk} - {availible_disks[disk]['name']} - {utilities.human_fmt(availible_disks[disk]['size'])}", size=(300, 30)) + for disk in available_disks: + print(f"{disk}: {available_disks[disk]['name']} - {available_disks[disk]['size']}") + self.usb_selection = wx.Button(self.frame, label=f"{disk} - {available_disks[disk]['name']} - {utilities.human_fmt(available_disks[disk]['size'])}", size=(300, 30)) i = i + 25 self.usb_selection.SetPosition( wx.Point( @@ -1763,7 +1763,7 @@ class wx_python_gui: self.usb_selection_label.GetPosition().y + self.usb_selection_label.GetSize().height + i ) ) - self.usb_selection.Bind(wx.EVT_BUTTON, lambda event, temp=disk: self.format_usb_progress(availible_disks[temp]['identifier'], installer_name, installer_path)) + self.usb_selection.Bind(wx.EVT_BUTTON, lambda event, temp=disk: self.format_usb_progress(available_disks[temp]['identifier'], installer_name, installer_path)) self.usb_selection.Centre(wx.HORIZONTAL) else: print("No disks found")