mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-21 22:50:51 +10:00
Add User configurable Disk notification
This commit is contained in:
@@ -36,6 +36,8 @@
|
|||||||
- After OS updates, Patcher will detect whether system requires root patches and prompt you
|
- After OS updates, Patcher will detect whether system requires root patches and prompt you
|
||||||
- Implemented via Launch Agent in `/Library/LaunchAgents`
|
- Implemented via Launch Agent in `/Library/LaunchAgents`
|
||||||
- OpenCore-Patcher.app will be copied to `/Library/Application Support/Dortania` for storage
|
- OpenCore-Patcher.app will be copied to `/Library/Application Support/Dortania` for storage
|
||||||
|
- Notify users when OpenCore is booted from external disk not matching macOS (ie. USB installer)
|
||||||
|
- Disable notification via `defaults write AutoPatch_Notify_Mismatched_Disks -bool FALSE`
|
||||||
- GUI Enhancements:
|
- GUI Enhancements:
|
||||||
- Add Reboot Prompt after Root Patching
|
- Add Reboot Prompt after Root Patching
|
||||||
- Add Disk Installation Prompt after OpenCore Config Building
|
- Add Disk Installation Prompt after OpenCore Config Building
|
||||||
|
|||||||
@@ -18,3 +18,20 @@ class os_data(enum.IntEnum):
|
|||||||
big_sur = 20
|
big_sur = 20
|
||||||
monterey = 21
|
monterey = 21
|
||||||
max_os = 99
|
max_os = 99
|
||||||
|
|
||||||
|
|
||||||
|
class os_conversion:
|
||||||
|
|
||||||
|
def os_to_kernel(os):
|
||||||
|
# Convert OS version to major XNU version
|
||||||
|
if os.startswith("10."):
|
||||||
|
return (int(os.split(".")[1]) + 4)
|
||||||
|
else:
|
||||||
|
return (int(os.split(".")[0]) + 9)
|
||||||
|
|
||||||
|
def kernel_to_os(kernel):
|
||||||
|
# Convert major XNU version to OS version
|
||||||
|
if kernel >= os_data.big_sur:
|
||||||
|
return str((kernel - 9))
|
||||||
|
else:
|
||||||
|
return str((f"10.{kernel - 4}"))
|
||||||
+2
-3
@@ -1553,9 +1553,8 @@ class wx_python_gui:
|
|||||||
if Path(self.constants.installer_pkg_path).exists():
|
if Path(self.constants.installer_pkg_path).exists():
|
||||||
path = utilities.grab_mount_point_from_disk(disk)
|
path = utilities.grab_mount_point_from_disk(disk)
|
||||||
if Path(path + "/System/Library/CoreServices/SystemVersion.plist").exists():
|
if Path(path + "/System/Library/CoreServices/SystemVersion.plist").exists():
|
||||||
kernel_version = plistlib.load(Path(path + "/System/Library/CoreServices/SystemVersion.plist").open("rb"))
|
os_version = plistlib.load(Path(path + "/System/Library/CoreServices/SystemVersion.plist").open("rb"))
|
||||||
kernel_version = kernel_version["ProductBuildVersion"]
|
kernel_version = os_data.os_conversion.os_to_kernel(os_version["ProductVersion"])
|
||||||
kernel_version = kernel_version[:2] # Grab first 2 digits, we can assume the lowest installer to be 10.9 (XNU 13)
|
|
||||||
if int(kernel_version) >= os_data.os_data.big_sur:
|
if int(kernel_version) >= os_data.os_data.big_sur:
|
||||||
subprocess.run(["mkdir", "-p", f"{path}/Library/Packages/"])
|
subprocess.run(["mkdir", "-p", f"{path}/Library/Packages/"])
|
||||||
subprocess.run(["cp", "-r", self.constants.installer_pkg_path, f"{path}/Library/Packages/"])
|
subprocess.run(["cp", "-r", self.constants.installer_pkg_path, f"{path}/Library/Packages/"])
|
||||||
|
|||||||
@@ -111,6 +111,10 @@ class AutomaticSysPatch:
|
|||||||
|
|
||||||
print("- Determining if macOS drive matches boot drive")
|
print("- Determining if macOS drive matches boot drive")
|
||||||
|
|
||||||
|
should_notify = subprocess.run(["defaults", "read", "com.dortania.opencore-legacy-patcher", "AutoPatch_Notify_Mismatched_Disks"], stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
|
||||||
|
if should_notify in ["0", "false"]:
|
||||||
|
print("- Skipping due to user preference")
|
||||||
|
else:
|
||||||
if settings.booted_oc_disk:
|
if settings.booted_oc_disk:
|
||||||
root_disk = settings.booted_oc_disk.strip("disk")
|
root_disk = settings.booted_oc_disk.strip("disk")
|
||||||
root_disk = "disk" + root_disk.split("s")[0]
|
root_disk = "disk" + root_disk.split("s")[0]
|
||||||
|
|||||||
Reference in New Issue
Block a user