mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-23 03:20:16 +10:00
kdk_handler.py: Fix pkg detection
This commit is contained in:
@@ -448,14 +448,13 @@ class KernelDebugKitObject:
|
|||||||
logging.warning(f"- KDK does not exist: {kdk_path}")
|
logging.warning(f"- KDK does not exist: {kdk_path}")
|
||||||
return
|
return
|
||||||
|
|
||||||
rm_args = ["rm", "-f", kdk_path]
|
rm_args = ["rm", "-rf" if Path(kdk_path).is_dir() else "-f", kdk_path]
|
||||||
if Path(kdk_path).is_dir():
|
|
||||||
rm_args = ["rm", "-rf", kdk_path]
|
|
||||||
|
|
||||||
result = utilities.elevated(rm_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
result = utilities.elevated(rm_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
if result.returncode != 0:
|
if result.returncode != 0:
|
||||||
logging.warning(f"- Failed to remove KDK: {kdk_path}")
|
logging.warning(f"- Failed to remove KDK: {kdk_path}")
|
||||||
logging.warning(f"- {result.stdout.decode('utf-8')}")
|
logging.warning(f"- {result.stdout.decode('utf-8')}")
|
||||||
|
return
|
||||||
|
|
||||||
logging.info(f"- Successfully removed KDK: {kdk_path}")
|
logging.info(f"- Successfully removed KDK: {kdk_path}")
|
||||||
|
|
||||||
@@ -486,18 +485,17 @@ class KernelDebugKitObject:
|
|||||||
|
|
||||||
logging.info("- Cleaning unused KDKs")
|
logging.info("- Cleaning unused KDKs")
|
||||||
for kdk_folder in Path(KDK_INSTALL_PATH).iterdir():
|
for kdk_folder in Path(KDK_INSTALL_PATH).iterdir():
|
||||||
if kdk_folder.is_dir():
|
if kdk_folder.name.endswith(".kdk") or kdk_folder.name.endswith(".pkg"):
|
||||||
if kdk_folder.name.endswith(".kdk") or kdk_folder.name.endswith(".pkg"):
|
should_remove = True
|
||||||
should_remove = True
|
for build in exclude_builds:
|
||||||
for build in exclude_builds:
|
if build != "":
|
||||||
if build != "":
|
|
||||||
continue
|
|
||||||
if kdk_folder.name.endswith(f"{build}.kdk") or kdk_folder.name.endswith(f"{build}.pkg"):
|
|
||||||
should_remove = False
|
|
||||||
break
|
|
||||||
if should_remove is False:
|
|
||||||
continue
|
continue
|
||||||
self._remove_kdk(kdk_folder)
|
if kdk_folder.name.endswith(f"_{build}.kdk") or kdk_folder.name.endswith(f"_{build}.pkg"):
|
||||||
|
should_remove = False
|
||||||
|
break
|
||||||
|
if should_remove is False:
|
||||||
|
continue
|
||||||
|
self._remove_kdk(kdk_folder)
|
||||||
|
|
||||||
|
|
||||||
def validate_kdk_checksum(self, kdk_dmg_path: str = None) -> bool:
|
def validate_kdk_checksum(self, kdk_dmg_path: str = None) -> bool:
|
||||||
|
|||||||
Reference in New Issue
Block a user