diff --git a/src/zlevis b/src/zlevis index fc9b701..85a6733 100755 --- a/src/zlevis +++ b/src/zlevis @@ -15,21 +15,23 @@ fi # Display usage information if input is from a terminal if [ -t 0 ]; then exec >&2 - echo "Usage: zlevis {decrypt|encrypt} {pool|*} [options]" + echo "Usage: \"zlevis {decrypt|encrypt} {pool|key} [options]\"" exit 2 fi case "$1" in decrypt) - case "$2" in + case "$2" in pool) zfs list -Ho tpm:jwe $3 | zlevis-decrypt;; - *) zlevis-decrypt $2;; + key) zlevis-decrypt;; + *) exit 1;; esac ;; encrypt) case "$2" in pool) read -r -d . key || zfs set tpm:jwe=$(printf "%s" "$key" | zlevis-encrypt $4) $3;; - *) zlevis-encrypt $2;; + key) zlevis-encrypt $3;; + *) exit 1;; esac ;; *) exit 1;;