pmbootstrap shutdown: Make cryptsetup closing slightly more robust
I've had a strange case where `cryptsetup status` did not work inside the chroot anymore, and only zapping it would resolve it. But I couldn't zap, because the status check was preventing shutdown (on which zap depends) from working. This commit works around that.
This commit is contained in:
parent
70fbed99da
commit
223f584e26
|
@ -35,6 +35,12 @@ def shutdown_cryptsetup_device(args, name):
|
|||
pmb.chroot.apk.install(args, ["cryptsetup"])
|
||||
status = pmb.chroot.root(args, ["cryptsetup", "status", name], check=False,
|
||||
return_stdout=True)
|
||||
if not status:
|
||||
logging.warning("WARNING: Failed to run cryptsetup to get the status"
|
||||
" for " + name + ", assuming it is not mounted"
|
||||
" (shutdown fails later if it is)!")
|
||||
return
|
||||
|
||||
if status.startswith("/dev/mapper/" + name + " is active."):
|
||||
pmb.chroot.root(args, ["cryptsetup", "luksClose", name])
|
||||
elif status.startswith("/dev/mapper/" + name + " is inactive."):
|
||||
|
|
Loading…
Reference in New Issue