From a095edc380941a6499ff23128d0ee6162611fd80 Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk <48863253+khronokernel@users.noreply.github.com> Date: Mon, 2 Aug 2021 21:06:33 -0600 Subject: [PATCH] Allow Root Patching on Mojave and Catalina --- CHANGELOG.md | 2 ++ OCLP-CLI.command | 10 +++++----- OpenCore-Patcher.command | 1 + Resources/CliMenu.py | 27 +++++++++++++++++++++++++++ Resources/SysPatch.py | 10 +++++----- 5 files changed, 40 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fce3481b..fae217fd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ - Implement Latebloom configuration via command line tool - Implement Root Volume backups in addition to APFS snapshot reversions - Backups applicable to machines with sealed APFS snapshots +- Allow Root Patching on Mojave and Catalina + - Currently experimental ## 0.2.4 diff --git a/OCLP-CLI.command b/OCLP-CLI.command index 060ffa959..927467c57 100755 --- a/OCLP-CLI.command +++ b/OCLP-CLI.command @@ -50,8 +50,9 @@ class OpenCoreLegacyPatcher: parser.add_argument("--wlan", help="Enable Wake on WLAN support", action="store_true", required=False) parser.add_argument("--disable_amfi", help="Disable AMFI", action="store_true", required=False) parser.add_argument("--moderate_smbios", help="Moderate SMBIOS Patching", action="store_true", required=False) + parser.add_argument("--moj_cat_accel", help="Allow Root Patching on Mojave and Catalina", action="store_true", required=False) - # Building args requiring value values + # Building args requiring value values (ie. --model iMac12,2) parser.add_argument("--model", action="store", help="Set custom model", required=False) parser.add_argument("--disk", action="store", help="Specifies disk to install to", required=False) parser.add_argument("--smbios_spoof", action="store", help="Set SMBIOS patching mode", required=False) @@ -62,7 +63,6 @@ class OpenCoreLegacyPatcher: # SysPatch args parser.add_argument("--patch_sys_vol", help="Patches root volume", action="store_true", required=False) parser.add_argument("--unpatch_sys_vol", help="Unpatches root volume, EXPERIMENTAL", action="store_true", required=False) - parser.add_argument("--terascale_2", help="Enable TeraScale 2 Acceleration", action="store_true", required=False) # parser.add_argument("--patch_disk", action="store", help="Specifies disk to root patch", required=False) parser.add_argument("--validate", help="Validate", action="store_true", required=False) @@ -180,9 +180,9 @@ If you plan to create the USB for another machine, please select the "Change Mod self.set_defaults(self.constants.custom_model, True) self.build_opencore() if args.patch_sys_vol: - if args.terascale_2: - print("- Set TeraScale 2 Accel configuration") - self.constants.terascale_2_patch = True + if args.moj_cat_accel: + print("- Set Mojave/Catalina root patch configuration") + self.constants.moj_cat_accel = True print("- Set System Volume patching") self.patch_vol() elif args.unpatch_sys_vol: diff --git a/OpenCore-Patcher.command b/OpenCore-Patcher.command index 11f5e0a8d..ac9505285 100755 --- a/OpenCore-Patcher.command +++ b/OpenCore-Patcher.command @@ -123,6 +123,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier' [f"Allow NVMe Boot:\t\t\tCurrently {self.constants.nvme_boot}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_nvme], [f"Allow Wake on WLAN:\t\t\tCurrently {self.constants.enable_wake_on_wlan}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_wowl], [f"Allow Ivy iMac iGPU:\t\tCurrently {self.constants.allow_ivy_igpu}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_ivy], + [f"Allow Accel on Mojave/Catalina:\tCurrently {self.constants.moj_cat_accel}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_moj_cat_patch], [f"Disable AMFI:\t\t\tCurrently {self.constants.disable_amfi}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).set_amfi], [ f"Set SIP and SecureBootModel:\tSIP: {self.constants.sip_status} SBM: {self.constants.secure_status}", diff --git a/Resources/CliMenu.py b/Resources/CliMenu.py index b8a56d429..6fd5cd3ea 100644 --- a/Resources/CliMenu.py +++ b/Resources/CliMenu.py @@ -565,3 +565,30 @@ Valid options: input("Invalid value, press [ENTER] to continue") else: print("Invalid option") + + + def allow_moj_cat_patch(self): + Utilities.cls() + Utilities.header(["Allow Root Patching on Mojave/Catalina"]) + print( + """ +This is an experimental option that allows the usage of legacy acceleration +patches in Mojave and Catalina. + +The main goal of this is to allow developers to better test patch sets as well +as allow acceleration on TeraScale 2 machines. Not all features may be available +(ie. GPU switching may not work, FileVault is not supported, etc) + +Note: for the average user, we recommend using dosdude1's legacy patcher: + +- http://dosdude1.com/software.html + """ + ) + + change_menu = input("Allow Root Patching on Mojave/Catalina?(y/n): ") + if change_menu in {"y", "Y", "yes", "Yes"}: + self.constants.moj_cat_accel = True + elif change_menu in {"n", "N", "no", "No"}: + self.constants.moj_cat_accel = False + else: + print("Invalid option") \ No newline at end of file diff --git a/Resources/SysPatch.py b/Resources/SysPatch.py index 02f872aff..670932060 100644 --- a/Resources/SysPatch.py +++ b/Resources/SysPatch.py @@ -139,7 +139,7 @@ class PatchSysVolume: def manual_root_patch_revert(self): print("- Attempting to revert patches") - if (Path(self.mount_location) / Path("System/Library/Extensions-Backup.zip")).exists(): + if (Path(self.mount_location) / Path("/System/Library/Extensions-Backup.zip")).exists(): print("- Verified manual unpatching is available") for location in SysPatchArray.BackupLocations: @@ -147,16 +147,16 @@ class PatchSysVolume: print("Reverting root volume patches (This may take some time)") print(f"- Attempting to unpatch {location}") - location_zip = f"{location}-Backup.zip" + location_zip = f"/{location}-Backup.zip" location_zip_path = Path(self.mount_location) / Path(location_zip) location_old_path = Path(self.mount_location) / Path(location) if "PrivateFrameworks" in location: - copy_path = Path(self.mount_location) / Path("System/Library/PrivateFrameworks") + copy_path = Path(self.mount_location) / Path("/System/Library/PrivateFrameworks") elif "Frameworks" in location: - copy_path = Path(self.mount_location) / Path("System/Library/Frameworks") + copy_path = Path(self.mount_location) / Path("/System/Library/Frameworks") else: - copy_path = Path(self.mount_location) / Path("System/Library") + copy_path = Path(self.mount_location) / Path("/System/Library") if location_zip_path.exists(): print(f"- Found {location_zip}")