Skip to content

Commit 5ea5230

Browse files
committed
main: Work around bless brokenness with passwords with spaces
This is silly... Fixes: #56 Signed-off-by: Hector Martin <[email protected]>
1 parent 4c17cab commit 5ea5230

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/main.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,19 @@ def bless(self):
379379
check=True)
380380
break
381381
except subprocess.CalledProcessError:
382+
if self.admin_password.strip() != self.admin_password:
383+
p_warning("Failed to run bless.")
384+
p_warning("This is probably because your password starts or ends with a space,")
385+
p_warning("and that doesn't work due to a silly Apple bug.")
386+
p_warning("Let's try a different way. Sorry, you'll have to type it in again.")
387+
try:
388+
subprocess.run(["bless", "--setBoot",
389+
"--device", "/dev/" + self.ins.osi.sys_volume,
390+
"--user", self.admin_user], check=True)
391+
print()
392+
return
393+
except subprocess.CalledProcessError:
394+
pass
382395
p_error("Failed to run bless. Press enter to try again.")
383396
self.input()
384397

0 commit comments

Comments
 (0)