scr/zlevis: update format
This commit is contained in:
parent
f022b1fe3c
commit
078495815c
1 changed files with 18 additions and 18 deletions
36
src/zlevis
36
src/zlevis
|
@ -12,6 +12,24 @@ if [ "$1" = "--summary" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
"decrypt")
|
||||
case "$2" in
|
||||
"pool") zfs list -Ho tpm:jwe "$3" | zlevis-decrypt;;
|
||||
"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";;
|
||||
"key") zlevis-encrypt "$3";;
|
||||
*) exit 1;;
|
||||
esac
|
||||
;;
|
||||
*) exit 1;;
|
||||
esac
|
||||
|
||||
# Display usage information if input is from a terminal
|
||||
if [ -t 0 ]; then
|
||||
exec >&2
|
||||
|
@ -19,23 +37,5 @@ if [ -t 0 ]; then
|
|||
exit 2
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
decrypt)
|
||||
case "$2" in
|
||||
pool) zfs list -Ho tpm:jwe $3 | zlevis-decrypt;;
|
||||
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;;
|
||||
key) zlevis-encrypt $3;;
|
||||
*) exit 1;;
|
||||
esac
|
||||
;;
|
||||
*) exit 1;;
|
||||
esac
|
||||
|
||||
# Exit with the status of the last command
|
||||
exit $?
|
Loading…
Reference in a new issue