mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-20 22:20:53 +10:00
sys_patch.py: Add patch set info to root
This commit is contained in:
@@ -6,6 +6,9 @@
|
|||||||
- Add Macmini8,1 FeatureUnlock support
|
- Add Macmini8,1 FeatureUnlock support
|
||||||
- Drops CPU check, supports all machines
|
- Drops CPU check, supports all machines
|
||||||
- Refactor Root Patching System
|
- Refactor Root Patching System
|
||||||
|
- Add `OpenCore-Legacy-Patcher.plist` for applied patch info
|
||||||
|
- Located under `/System/Library/CoreServices`
|
||||||
|
- Lists patch sets applied including files installed and removed
|
||||||
|
|
||||||
## 0.4.4
|
## 0.4.4
|
||||||
- Lower SIP requirement for Root Patching
|
- Lower SIP requirement for Root Patching
|
||||||
|
|||||||
+1
-1
@@ -804,7 +804,7 @@ class wx_python_gui:
|
|||||||
i = i + self.patch_label.GetSize().height + 3
|
i = i + self.patch_label.GetSize().height + 3
|
||||||
else:
|
else:
|
||||||
# Prompt user with no patches found
|
# Prompt user with no patches found
|
||||||
self.patch_label = wx.StaticText(self.frame, label="No patches found")
|
self.patch_label = wx.StaticText(self.frame, label="No patches needed")
|
||||||
self.patch_label.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
|
self.patch_label.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
|
||||||
self.patch_label.SetPosition(
|
self.patch_label.SetPosition(
|
||||||
wx.Point(
|
wx.Point(
|
||||||
|
|||||||
+2
-1
@@ -44,7 +44,8 @@ class OpenCoreLegacyPatcher:
|
|||||||
if utilities.check_cli_args() is not None:
|
if utilities.check_cli_args() is not None:
|
||||||
print("- Detected arguments, switching to CLI mode")
|
print("- Detected arguments, switching to CLI mode")
|
||||||
self.constants.gui_mode = True # Assumes no user interaction is required
|
self.constants.gui_mode = True # Assumes no user interaction is required
|
||||||
if "--auto_patch" not in sys.argv:
|
ignore_args = ["--auto_patch", "--gui_patch", "--gui_unpatch"]
|
||||||
|
if not any(x in sys.argv for x in ignore_args):
|
||||||
self.constants.current_path = Path.cwd()
|
self.constants.current_path = Path.cwd()
|
||||||
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
|
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
|
||||||
print("- Rerouting payloads location")
|
print("- Rerouting payloads location")
|
||||||
|
|||||||
@@ -25,6 +25,9 @@
|
|||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from datetime import datetime
|
||||||
|
import plistlib
|
||||||
|
import os
|
||||||
|
|
||||||
from resources import constants, generate_smbios, utilities, sys_patch_download, sys_patch_detect, sys_patch_auto
|
from resources import constants, generate_smbios, utilities, sys_patch_download, sys_patch_detect, sys_patch_auto
|
||||||
from data import os_data
|
from data import os_data
|
||||||
@@ -167,6 +170,27 @@ class PatchSysVolume:
|
|||||||
print("- Creating SkylightPlugins folder")
|
print("- Creating SkylightPlugins folder")
|
||||||
utilities.process_status(utilities.elevated(["mkdir", "-p", f"{self.mount_application_support}/SkyLightPlugins/"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
utilities.process_status(utilities.elevated(["mkdir", "-p", f"{self.mount_application_support}/SkyLightPlugins/"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||||
|
|
||||||
|
def write_patchset(self, patchset):
|
||||||
|
source_path = f"{self.constants.payload_path}"
|
||||||
|
destination_path = f"{self.mount_location}/System/Library/CoreServices"
|
||||||
|
file_name = "OpenCore-Legacy-Patcher.plist"
|
||||||
|
source_path_file = f"{source_path}/{file_name}"
|
||||||
|
destination_path_file = f"{destination_path}/{file_name}"
|
||||||
|
|
||||||
|
data = {
|
||||||
|
"OpenCore Legacy Patcher": f"v{self.constants.patcher_version}",
|
||||||
|
"PatcherSupportPkg": f"v{self.constants.patcher_support_pkg_version}",
|
||||||
|
"Time Patched": f"{datetime.now().strftime('%B %d, %Y @ %H:%M:%S')}",
|
||||||
|
}
|
||||||
|
print("- Writing patchset information to Root Volume")
|
||||||
|
data.update(patchset)
|
||||||
|
if Path(source_path_file).exists():
|
||||||
|
os.remove(source_path_file)
|
||||||
|
# Need to write to a safe location
|
||||||
|
plistlib.dump(data, Path(source_path_file).open("wb"), sort_keys=False)
|
||||||
|
if Path(destination_path_file).exists():
|
||||||
|
utilities.process_status(utilities.elevated(["rm", destination_path_file], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||||
|
utilities.process_status(utilities.elevated(["cp", source_path_file, destination_path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||||
|
|
||||||
def patch_root_vol(self):
|
def patch_root_vol(self):
|
||||||
print(f"- Running patches for {self.model}")
|
print(f"- Running patches for {self.model}")
|
||||||
@@ -214,6 +238,7 @@ class PatchSysVolume:
|
|||||||
utilities.process_status(utilities.elevated(process_array, stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
utilities.process_status(utilities.elevated(process_array, stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||||
else:
|
else:
|
||||||
utilities.process_status(subprocess.run(process_array, stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
utilities.process_status(subprocess.run(process_array, stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||||
|
self.write_patchset(required_patches)
|
||||||
|
|
||||||
def preflight_checks(self, required_patches, source_files_path):
|
def preflight_checks(self, required_patches, source_files_path):
|
||||||
print("- Running Preflight Checks before patching")
|
print("- Running Preflight Checks before patching")
|
||||||
|
|||||||
Reference in New Issue
Block a user