Skip to content

Commit

Permalink
Try both Clevis and passphrase in /etc/fstab setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaublitz committed Jan 8, 2024
1 parent 594d568 commit bd0a8cc
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions systemd/stratis-fstab-setup
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,30 @@ done

if $(stratis-min pool is-stopped "$POOL_UUID"); then
if $(stratis-min pool is-bound "$POOL_UUID"); then
if ! stratis-min pool start --unlock-method=clevis "$POOL_UUID"; then
echo Failed to start pool with UUID $POOL_UUID using Clevis. >&2
exit 1
if ! $(stratis-min pool is-bound "$POOL_UUID"); then
if ! stratis-min pool start --unlock-method=clevis "$POOL_UUID"; then
echo Failed to start pool with UUID $POOL_UUID using Clevis. >&2
exit 1
fi
else
if ! stratis-min pool start --unlock-method=clevis "$POOL_UUID"; then
echo Failed to start pool with UUID $POOL_UUID using Clevis. >&2
if ! systemd-ask-password \
"Enter password for pool with UUID $POOL_UUID" |
stratis-min pool start --unlock-method=keyring --prompt "$POOL_UUID"; then
echo Failed to start pool with UUID $POOL_UUID using passphrase. >&2
exit 1
fi
fi
fi
elif $(stratis-min pool is-encrypted "$POOL_UUID"); then
elif $(stratis-min pool has-passphrase "$POOL_UUID"); then
if ! systemd-ask-password \
"Enter password for pool with UUID $POOL_UUID" |
stratis-min pool start --unlock-method=keyring --prompt "$POOL_UUID"; then
echo Failed to start pool with UUID $POOL_UUID using passphrase. >&2
exit 1
fi
else
elif ! $(stratis-min pool is-encrypted); then
if ! stratis-min pool start "$POOL_UUID"; then
echo Failed to start pool with UUID $POOL_UUID. >&2
exit 1
Expand Down

0 comments on commit bd0a8cc

Please sign in to comment.