src/zlevis-fetch: added summary and improved zlevis-decrypt check
This commit is contained in:
parent
f573008075
commit
f2405d842b
1 changed files with 15 additions and 3 deletions
|
@ -3,8 +3,20 @@
|
|||
# Exit immediately if a command exits with a non-zero status
|
||||
set -e
|
||||
|
||||
# Summary of the script's functionality
|
||||
summary="Decrypts a ZFS root pool with a TPM2.0 chip."
|
||||
|
||||
# Display summary if requested
|
||||
if [ "$1" = "--summary" ]; then
|
||||
echo "$summary"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if zlevis-decrypt is present
|
||||
command -v zlevis-decrypt > /dev/null || exit 1
|
||||
if ! command -v zlevis-decrypt > /dev/null; then
|
||||
echo "Script zlevis-decrypt is not present"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Read ZFS dataset information.
|
||||
zfs list -Ho name,encryption,keystatus,encryptionroot,tpm:jwe | while IFS=$'\t' read -r ds enc keystatus encroot jwe; do
|
||||
|
@ -18,8 +30,8 @@ zfs list -Ho name,encryption,keystatus,encryptionroot,tpm:jwe | while IFS=$'\t'
|
|||
echo "Unlocked $ds"
|
||||
else
|
||||
echo "Failed to unlock $ds" >&2
|
||||
exit 1
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue