mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-23 11:30:15 +10:00
payloads: USe variable name for mounting
This commit is contained in:
@@ -106,8 +106,9 @@ class Constants:
|
|||||||
self.kdkless_version: str = "1.0.0"
|
self.kdkless_version: str = "1.0.0"
|
||||||
|
|
||||||
# Get resource path
|
# Get resource path
|
||||||
self.current_path: Path = Path(__file__).parent.parent.resolve()
|
self.current_path: Path = Path(__file__).parent.parent.resolve()
|
||||||
self.payload_path: Path = self.current_path / Path("payloads")
|
self.original_path: Path = Path(__file__).parent.parent.resolve()
|
||||||
|
self.payload_path: Path = self.current_path / Path("payloads")
|
||||||
|
|
||||||
# Patcher Settings
|
# Patcher Settings
|
||||||
## Internal settings
|
## Internal settings
|
||||||
@@ -225,6 +226,11 @@ class Constants:
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Payload Location
|
# Payload Location
|
||||||
|
|
||||||
|
# Support Disk Images
|
||||||
|
@property
|
||||||
|
def payload_path_dmg(self):
|
||||||
|
return self.original_path / Path("payloads.dmg")
|
||||||
# OpenCore
|
# OpenCore
|
||||||
@property
|
@property
|
||||||
def opencore_zip_source(self):
|
def opencore_zip_source(self):
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class RoutePayloadDiskImage:
|
|||||||
self._unmount_active_dmgs(unmount_all_active=False)
|
self._unmount_active_dmgs(unmount_all_active=False)
|
||||||
output = subprocess.run(
|
output = subprocess.run(
|
||||||
[
|
[
|
||||||
"hdiutil", "attach", "-noverify", f"{self.constants.payload_path}.dmg",
|
"hdiutil", "attach", "-noverify", f"{self.constants.payload_path_dmg}",
|
||||||
"-mountpoint", Path(self.temp_dir.name / Path("payloads")),
|
"-mountpoint", Path(self.temp_dir.name / Path("payloads")),
|
||||||
"-nobrowse",
|
"-nobrowse",
|
||||||
"-shadow", Path(self.temp_dir.name / Path("payloads_overlay")),
|
"-shadow", Path(self.temp_dir.name / Path("payloads_overlay")),
|
||||||
@@ -55,7 +55,7 @@ class RoutePayloadDiskImage:
|
|||||||
logging.info(f"Return Code: {output.returncode}")
|
logging.info(f"Return Code: {output.returncode}")
|
||||||
|
|
||||||
|
|
||||||
def _unmount_active_dmgs(self, unmount_all_active=True) -> None:
|
def _unmount_active_dmgs(self, unmount_all_active: bool = True) -> None:
|
||||||
"""
|
"""
|
||||||
Unmounts disk images associated with OCLP
|
Unmounts disk images associated with OCLP
|
||||||
|
|
||||||
@@ -70,20 +70,22 @@ class RoutePayloadDiskImage:
|
|||||||
dmg_info = subprocess.run(["hdiutil", "info", "-plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
dmg_info = subprocess.run(["hdiutil", "info", "-plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
dmg_info = plistlib.loads(dmg_info.stdout)
|
dmg_info = plistlib.loads(dmg_info.stdout)
|
||||||
|
|
||||||
for image in dmg_info["images"]:
|
|
||||||
if image["image-path"].endswith("payloads.dmg"):
|
for variant in ["Universal-Binaries.dmg", "payloads.dmg"]:
|
||||||
if unmount_all_active is False:
|
for image in dmg_info["images"]:
|
||||||
# Check that only our personal payloads.dmg is unmounted
|
if image["image-path"].endswith(variant):
|
||||||
if "shadow-path" in image:
|
if unmount_all_active is False:
|
||||||
if self.temp_dir.name in image["shadow-path"]:
|
# Check that only our personal payloads.dmg is unmounted
|
||||||
logging.info("- Unmounting personal payloads.dmg")
|
if "shadow-path" in image:
|
||||||
subprocess.run(
|
if self.temp_dir.name in image["shadow-path"]:
|
||||||
["hdiutil", "detach", image["system-entities"][0]["dev-entry"], "-force"],
|
logging.info(f"- Unmounting personal {variant}")
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT
|
subprocess.run(
|
||||||
)
|
["hdiutil", "detach", image["system-entities"][0]["dev-entry"], "-force"],
|
||||||
else:
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT
|
||||||
logging.info(f"- Unmounting payloads.dmg at: {image['system-entities'][0]['dev-entry']}")
|
)
|
||||||
subprocess.run(
|
else:
|
||||||
["hdiutil", "detach", image["system-entities"][0]["dev-entry"], "-force"],
|
logging.info(f"- Unmounting {variant} at: {image['system-entities'][0]['dev-entry']}")
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT
|
subprocess.run(
|
||||||
)
|
["hdiutil", "detach", image["system-entities"][0]["dev-entry"], "-force"],
|
||||||
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user