1 diff --git a/mod-luks.sh b/mod-luks.sh
2 index 8cd9959..43bdcaa 100644
5 @@ -134,15 +134,27 @@ luks_crypttab() {
6 if key_is_random "$key"; then
7 die "$dst: LUKS requires non-random key, skipping"
9 - if [ -n "$opt" ]; then
10 - warn "$dst: options are invalid for LUKS partitions, ignoring them"
13 keyfile=/etc/.$dst.key
17 - verbose "+ cryptsetup ${keyfile:+-d $keyfile} luksOpen '$src' '$dst'"
21 + for option in $opt; do
23 + discard|allow-discards)
24 + crypttab_opt="$crypttab_opt --allow-discards"
27 + warn "$dst: option \'$opt\' is invalid for LUKS partitions, ignored"
33 + verbose "+ cryptsetup ${keyfile:+-d $keyfile} open --type luks $crypttab_opt '$src' '$dst'"
37 @@ -169,7 +181,7 @@ luks_crypttab() {
38 crypt_status=\$(cryptsetup \$cryptsetup_opt status '$dst')
39 if [ "\${crypt_status%%is inactive.}" != "\$crypt_status" ]; then
41 - cryptsetup \$cryptsetup_opt ${keyfile:+-d $keyfile} luksOpen "\$luksdev" '$dst' <&1
42 + cryptsetup \$cryptsetup_opt ${keyfile:+-d $keyfile} open --type luks $crypttab_opt "\$luksdev" '$dst' <&1