Skip to content

Commit 5486ab2

Browse files
committed
fix unmount
1 parent d68a7bc commit 5486ab2

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

oclp_r/sys_patch/mount/mount.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,15 @@ def _mount_root_volume(self) -> str:
6767
if self.xnu_major >= os_data.os_data.big_sur.value:
6868
if Path("/System/Volumes/Update/mnt1/System/Library/CoreServices/SystemVersion.plist").exists():
6969
return "/System/Volumes/Update/mnt1"
70-
result_unmount = subprocess_wrapper.run_as_root(["/usr/sbin/diskutil", "unmount", f"/dev/{self.root_volume_identifier}"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
71-
if result_unmount.returncode != 0:
72-
logging.error("Failed to unmount root volume")
70+
try:
71+
result_unmount = subprocess_wrapper.run_as_root(["/usr/sbin/diskutil", "unmount", f"/dev/{self.root_volume_identifier}"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
72+
if result_unmount.returncode != 0:
73+
logging.error("Failed to unmount root volume")
74+
subprocess_wrapper.log(result_unmount)
75+
return None
76+
except subprocess.CalledProcessError:
77+
logging.error("Disk has already been unmounted.")
7378
subprocess_wrapper.log(result_unmount)
74-
return None
7579
result = subprocess_wrapper.run_as_root(["/sbin/mount", "-o", "nobrowse", "-t", "apfs", f"/dev/{self.root_volume_identifier}", "/System/Volumes/Update/mnt1"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
7680
if result.returncode != 0:
7781
logging.error("Failed to mount root volume")

0 commit comments

Comments
 (0)