diff --git a/bash/fs.sh b/bash/fs.sh index 07bd84f..bf59782 100644 --- a/bash/fs.sh +++ b/bash/fs.sh @@ -83,18 +83,23 @@ luks_format() { local label="${3}" local uuid="${4}" if [ -b "${device}" ]; then + set -- \ + --batch-mode \ + --cipher "aes-xts-plain64" \ + --hash "sha512" \ + --iter-time 4096 \ + --key-size 512 \ + --pbkdf "argon2id" \ + --type "luks2" \ + --use-random \ + --verbose + if [ -n "${label}" ]; then + set -- "${@}" --label "${label}" + fi + if [ -n "${uuid}" ]; then + set -- "${@}" --label "${uuid}" + fi echo "${passphrase}" | - cryptsetup \ - --batch-mode \ - --cipher "aes-xts-plain64" \ - --hash "sha512" \ - --iter-time 4096 \ - --key-size 512 \ - --pbkdf "argon2id" \ - --type "luks2" \ - --use-random \ - --verbose \ - luksFormat \ - "${device}" + cryptsetup "${@}" luksFormat "${device}" fi }