From 2e62f1f65c0000c10c30d14fe032702ec9dbbe89 Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk <48863253+khronokernel@users.noreply.github.com> Date: Wed, 21 Apr 2021 14:42:54 -0600 Subject: [PATCH] Add better kmutil crash handling --- CHANGELOG.md | 3 ++- Resources/SysPatch.py | 26 ++++++++++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8a73f05e..d5c79feef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,9 @@ - Fix iMac11,1 boot issues after PRAM reset - Fix DRM support on Nvidia-only configurations - Support optional setting between DRM and QuickSync support on iMacs13,x and iMac14,x -- Add public beta support for Legacy GPU Acceleration +- Add public beta support for Legacy GPU Acceleration (v0.0.3) - Note ATI/AMD TeraScale 2 unsupported (HD 5/6000) +- Add better kmutil crash handling ## 0.1.0 - Fix crash on iMacs with Metal GPUs diff --git a/Resources/SysPatch.py b/Resources/SysPatch.py index d94e78d41..59d7525a7 100644 --- a/Resources/SysPatch.py +++ b/Resources/SysPatch.py @@ -262,11 +262,22 @@ class PatchSysVolume: if self.constants.gui_mode is False: input("Press [ENTER] to continue with cache rebuild") print("- Rebuilding Kernel Cache (This may take some time)") - subprocess.run(f"sudo kmutil install --volume-root {self.mount_location} --update-all".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode() - if self.constants.gui_mode is False: - input("Press [ENTER] to continue with snapshotting") - print("- Creating new APFS snapshot") - subprocess.run(f"sudo bless --folder {self.mount_location}/System/Library/CoreServices --bootefi --create-snapshot".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode() + result = subprocess.run(f"sudo kmutil install --volume-root {self.mount_location} --update-all".split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + if result.returncode != 0: + self.sucess_status = False + print("- Unable to build new kernel cache") + print("\nPlease report this to Github") + print("Reason for Patch Failure:") + print(result) + print("") + else: + self.sucess_status = True + print("- Sucessfully built new kernel cache") + if self.constants.gui_mode is False: + input("Press [ENTER] to continue with snapshotting") + print("- Creating new APFS snapshot") + subprocess.run(f"sudo bless --folder {self.mount_location}/System/Library/CoreServices --bootefi --create-snapshot".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode() def unmount_drive(self): print("- Unmounting Root Volume (Don't worry if this fails)") @@ -358,7 +369,10 @@ class PatchSysVolume: self.find_mount_root_vol(True) self.unmount_drive() print("- Patching complete") - print("\nPlease reboot the machine for patches to take effect") + if self.sucess_status is True: + print("\nPlease reboot the machine for patches to take effect") + else: + print("\nPlease reboot the machine to avoid pottential issues rerunning the patcher") if self.sip_patch_status is True: print("SIP set incorrectly, cannot patch on this machine!") print("Please disable SIP and SecureBootModel in Patcher Settings")