Allow Root Patching on Mojave and Catalina

This commit is contained in:
Mykola Grymalyuk
2021-08-02 21:06:33 -06:00
parent f1ac88d23b
commit a095edc380
5 changed files with 40 additions and 10 deletions

View File

@@ -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

View File

@@ -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:

View File

@@ -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}",

View File

@@ -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")

View File

@@ -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}")