kdk_handler.py: Avoid double unmount

This commit is contained in:
Mykola Grymalyuk
2023-02-08 13:15:19 -07:00
parent 0d38bc0edf
commit 8b18c59d8a
2 changed files with 10 additions and 9 deletions

View File

@@ -273,8 +273,8 @@ class KernelDebugKitObject:
plist_path.unlink()
kdk_dict = {
"Build": self.kdk_url_build,
"Version": self.kdk_url_version,
"build": self.kdk_url_build,
"version": self.kdk_url_version,
}
try:
@@ -553,18 +553,19 @@ class KernelDebugKitUtilities:
return False
self._create_backup(kdk_pkg_path, Path(f"{kdk_path.parent}/{KDK_INFO_PLIST}"))
result = subprocess.run(["hdiutil", "detach", mount_point], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
self._unmount_disk_image(mount_point)
logging.info("- Successfully installed KDK")
return True
def _unmount_disk_image(self, mount_point):
result = subprocess.run(["hdiutil", "detach", mount_point], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if result.returncode != 0:
logging.info("- Failed to unmount KDK:")
logging.info(result.stdout.decode('utf-8'))
"""
Unmounts provided disk image silently
Parameters:
mount_point (Path): Path to mount point
"""
subprocess.run(["hdiutil", "detach", mount_point], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
def _create_backup(self, kdk_path: Path, kdk_info_plist: Path):

View File

@@ -187,7 +187,7 @@ class PatchSysVolume:
# Note it's a folder, not a file
utilities.elevated(["cp", "-r", cs_path, f"{self.constants.payload_path}/IOHIDEventDriver_CodeSignature.bak"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
logging.info("- Merging KDK with Root Volume")
logging.info(f"- Merging KDK with Root Volume: {kdk_path.name}")
utilities.elevated(
# Only merge '/System/Library/Extensions'
# 'Kernels' and 'KernelSupport' is wasted space for root patching (we don't care above dev kernels)