]>
Commit | Line | Data |
---|---|---|
e4008f8c AM |
1 | diff --git a/mod-luks.sh b/mod-luks.sh |
2 | index 8cd9959..43bdcaa 100644 | |
3 | --- a/mod-luks.sh | |
4 | +++ b/mod-luks.sh | |
5 | @@ -134,15 +134,27 @@ luks_crypttab() { | |
6 | if key_is_random "$key"; then | |
7 | die "$dst: LUKS requires non-random key, skipping" | |
8 | fi | |
9 | - if [ -n "$opt" ]; then | |
10 | - warn "$dst: options are invalid for LUKS partitions, ignoring them" | |
11 | - fi | |
12 | if [ "$key" ]; then | |
13 | keyfile=/etc/.$dst.key | |
14 | inst $key $keyfile | |
15 | fi | |
ebc0b856 | 16 | |
e4008f8c AM |
17 | - verbose "+ cryptsetup ${keyfile:+-d $keyfile} luksOpen '$src' '$dst'" |
18 | + crypttab_opt="" | |
19 | + old_IFS="$IFS" | |
20 | + IFS="," | |
21 | + for option in $opt; do | |
22 | + case "$option" in | |
23 | + discard|allow-discards) | |
24 | + crypttab_opt="$crypttab_opt --allow-discards" | |
25 | + ;; | |
26 | + *) | |
27 | + warn "$dst: option \'$opt\' is invalid for LUKS partitions, ignored" | |
28 | + ;; | |
29 | + esac | |
30 | + done | |
31 | + IFS="$old_IFS" | |
c93f3d5b | 32 | + |
e4008f8c AM |
33 | + verbose "+ cryptsetup ${keyfile:+-d $keyfile} open --type luks $crypttab_opt '$src' '$dst'" |
34 | add_linuxrc <<-EOF | |
35 | debugshell | |
c93f3d5b | 36 | |
e4008f8c AM |
37 | @@ -169,7 +181,7 @@ luks_crypttab() { |
38 | crypt_status=\$(cryptsetup \$cryptsetup_opt status '$dst') | |
39 | if [ "\${crypt_status%%is inactive.}" != "\$crypt_status" ]; then | |
40 | # is inactive | |
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 | |
43 | fi | |
44 | fi | |
b66ea229 | 45 |