mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-20 10:44:32 +10:00
Merge pull request #1088 from Jazzzny/devtools
Developer - Add buttons to mount and save the root volume
This commit is contained in:
@@ -279,6 +279,8 @@ class PatchSysVolume:
|
||||
if self.needs_kmutil_exemptions is True:
|
||||
logging.info("Note: Apple will require you to open System Preferences -> Security to allow the new kernel extensions to be loaded")
|
||||
self.constants.root_patcher_succeeded = True
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def _rebuild_kernel_collection(self) -> bool:
|
||||
@@ -417,9 +419,11 @@ class PatchSysVolume:
|
||||
"""
|
||||
Unmount root volume
|
||||
"""
|
||||
|
||||
logging.info("- Unmounting Root Volume (Don't worry if this fails)")
|
||||
utilities.elevated(["diskutil", "unmount", self.root_mount_path], stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||
if self.root_mount_path:
|
||||
logging.info("- Unmounting Root Volume (Don't worry if this fails)")
|
||||
utilities.elevated(["diskutil", "unmount", self.root_mount_path], stdout=subprocess.PIPE).stdout.decode().strip().encode()
|
||||
else:
|
||||
logging.info("- Skipping Root Volume unmount")
|
||||
|
||||
|
||||
def _rebuild_dyld_shared_cache(self) -> None:
|
||||
|
||||
@@ -4,8 +4,10 @@ import pprint
|
||||
import logging
|
||||
import py_sip_xnu
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
from pathlib import Path
|
||||
from resources.sys_patch.sys_patch import PatchSysVolume
|
||||
|
||||
from resources.wx_gui import (
|
||||
gui_support,
|
||||
@@ -814,6 +816,9 @@ class SettingsFrame(wx.Frame):
|
||||
},
|
||||
},
|
||||
"Developer": {
|
||||
"Validation": {
|
||||
"type": "title",
|
||||
},
|
||||
"Install latest nightly build 🧪": {
|
||||
"type": "button",
|
||||
"function": self.on_nightly,
|
||||
@@ -839,6 +844,28 @@ class SettingsFrame(wx.Frame):
|
||||
"Export constants.py values to a txt file.",
|
||||
],
|
||||
},
|
||||
"Developer Root Volume Patching": {
|
||||
"type": "title",
|
||||
},
|
||||
"Mount Root Volume": {
|
||||
"type": "button",
|
||||
"function": self.on_mount_root_vol,
|
||||
"description": [
|
||||
"Life's too short to type 'sudo mount -o",
|
||||
"nobrowse -t apfs /dev/diskXsY",
|
||||
"/System/Volumes/Update/mnt1' every time.",
|
||||
],
|
||||
},
|
||||
"wrap_around 2": {
|
||||
"type": "wrap_around",
|
||||
},
|
||||
"Save Root Volume": {
|
||||
"type": "button",
|
||||
"function": self.on_bless_root_vol,
|
||||
"description": [
|
||||
"Rebuild kernel cache and bless snapshot 🙏",
|
||||
],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1274,4 +1301,24 @@ Hardware Information:
|
||||
|
||||
|
||||
def on_test_exception(self, event: wx.Event) -> None:
|
||||
raise Exception("Test Exception")
|
||||
raise Exception("Test Exception")
|
||||
|
||||
def on_mount_root_vol(self, event: wx.Event) -> None:
|
||||
if os.geteuid() != 0:
|
||||
wx.MessageDialog(self.parent, "Please relaunch as Root to mount the Root Volume", "Error", wx.OK | wx.ICON_ERROR).ShowModal()
|
||||
else:
|
||||
#Don't need to pass model as we're bypassing all logic
|
||||
if PatchSysVolume("",self.constants)._mount_root_vol() == True:
|
||||
wx.MessageDialog(self.parent, "Root Volume Mounted, remember to fix permissions before saving the Root Volume", "Success", wx.OK | wx.ICON_INFORMATION).ShowModal()
|
||||
else:
|
||||
wx.MessageDialog(self.parent, "Root Volume Mount Failed, check terminal output", "Error", wx.OK | wx.ICON_ERROR).ShowModal()
|
||||
|
||||
def on_bless_root_vol(self, event: wx.Event) -> None:
|
||||
if os.geteuid() != 0:
|
||||
wx.MessageDialog(self.parent, "Please relaunch as Root to save changes", "Error", wx.OK | wx.ICON_ERROR).ShowModal()
|
||||
else:
|
||||
#Don't need to pass model as we're bypassing all logic
|
||||
if PatchSysVolume("",self.constants)._rebuild_root_volume() == True:
|
||||
wx.MessageDialog(self.parent, "Root Volume saved, please reboot to apply changes", "Success", wx.OK | wx.ICON_INFORMATION).ShowModal()
|
||||
else:
|
||||
wx.MessageDialog(self.parent, "Root Volume update Failed, check terminal output", "Error", wx.OK | wx.ICON_ERROR).ShowModal()
|
||||
Reference in New Issue
Block a user