Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Commit

Permalink
Fix filevault erase by using deviceidentifier instead of mountpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
davelebbing committed May 14, 2019
1 parent 2d48918 commit 0fce97c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Imagr/MainController.py
Expand Up @@ -1984,7 +1984,12 @@ def eraseTargetVolume(self, name='Macintosh HD', format='Journaled HFS+', progre
NSLog("Volume not HFS+ or APFS, system returned: %@", self.targetVolume._attributes['FilesystemType'])
self.errorMessage = "Not HFS+ or APFS - specify volume format and reload workflows."

cmd = ['/usr/sbin/diskutil', 'eraseVolume', format, name, self.targetVolume.mountpoint ]
if self.targetVolume.filevault or format=="APFS":
NSLog("erasing with identifier since we had filevault or APFS")
cmd = ['/usr/sbin/diskutil', 'eraseVolume', format, name, self.targetVolume.deviceidentifier ]
else:
cmd = ['/usr/sbin/diskutil', 'eraseVolume', format, name, self.targetVolume.mountpoint ]

NSLog("%@", cmd)
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(eraseOut, eraseErr) = proc.communicate()
Expand All @@ -1996,11 +2001,6 @@ def eraseTargetVolume(self, name='Macintosh HD', format='Journaled HFS+', progre
# Reload possible targets because original target name might not exist
self.should_update_volume_list = True
self.targetVolume.EnsureMountedWithRefresh()
# Reload possible targets, because '/Volumes/Macintosh HD' might not exist
# elif name != 'Macintosh HD':
# If the volume was renamed, or isn't named 'Macintosh HD', then we should recheck the volume list
self.should_update_volume_list = True
self.targetVolume.EnsureMountedWithRefresh()

def copyLocalize_(self, item):
if 'keyboard_layout_name' in item:
Expand Down

0 comments on commit 0fce97c

Please sign in to comment.