mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-13 20:28:21 +10:00
installer.py: Add CoW support check
HFS+ root volumes do not support CoW
This commit is contained in:
@@ -363,10 +363,17 @@ def generate_installer_creation_script(tmp_location, installer_path, disk):
|
||||
subprocess.run(["rm", "-rf", str(file)])
|
||||
|
||||
# Copy installer to tmp (use CoW to avoid extra disk writes)
|
||||
subprocess.run(["cp", "-cR", installer_path, ia_tmp])
|
||||
args = ["cp", "-cR", installer_path, ia_tmp]
|
||||
if utilities.check_filesystem_type() != "apfs":
|
||||
# HFS+ disks do not support CoW
|
||||
args[1] = "-R"
|
||||
subprocess.run(args)
|
||||
|
||||
# Adjust installer_path to point to the copied installer
|
||||
installer_path = Path(ia_tmp) / Path(Path(installer_path).name)
|
||||
if not Path(installer_path).exists():
|
||||
print(f"Failed to copy installer to {ia_tmp}")
|
||||
return False
|
||||
|
||||
createinstallmedia_path = str(Path(installer_path) / Path("Contents/Resources/createinstallmedia"))
|
||||
plist_path = str(Path(installer_path) / Path("Contents/Info.plist"))
|
||||
|
||||
@@ -93,6 +93,10 @@ def check_seal():
|
||||
else:
|
||||
return False
|
||||
|
||||
def check_filesystem_type():
|
||||
# Expected to return 'apfs' or 'hfs'
|
||||
filesystem_type = plistlib.loads(subprocess.run(["diskutil", "info", "-plist", "/"], stdout=subprocess.PIPE).stdout.decode().strip().encode())
|
||||
return filesystem_type["FilesystemType"]
|
||||
|
||||
def csr_dump():
|
||||
# Based off sip_config.py
|
||||
|
||||
Reference in New Issue
Block a user