sys_patch: Relocate old kexts instead of nuke

This commit is contained in:
Mykola Grymalyuk
2022-10-26 18:35:46 -06:00
parent 91cb6e4ecf
commit 406072cbe1
2 changed files with 9 additions and 2 deletions

View File

@@ -7,6 +7,7 @@
- ex. Allow 13.0 KDK on 13.1
- Clean out `/Library/Extensions` on KDK-less root patches
- Ensures old, incompatible kexts are not linked against
- Old kexts are relocated to `/Library/Relocated Extensions`
- Add OpenCore Picker timeout selection
## 0.5.0

View File

@@ -357,12 +357,18 @@ class PatchSysVolume:
# Handle situations where users migrated from older OSes with a lot of garbage in /L*/E*
# ex. Nvidia Web Drivers, NetUSB, dosdude1's patches, etc.
# Delete if file's age is older than October 2021 (year before Ventura)
# Move if file's age is older than October 2021 (year before Ventura)
if self.constants.detected_os < os_data.os_data.ventura:
return
relocation_path = "/Library/Relocated Extensions"
if not Path(relocation_path).exists():
utilities.elevated(["mkdir", relocation_path])
for file in Path("/Library/Extensions").glob("*.kext"):
if datetime.fromtimestamp(file.stat().st_mtime) < datetime(2021, 10, 1):
self.remove_file("/Library/Extensions", file.name)
print(f" - Relocating {file.name} kext to {relocation_path}")
utilities.elevated(["mv", file, relocation_path])
def write_patchset(self, patchset):
destination_path = f"{self.mount_location}/System/Library/CoreServices"