]> git.pld-linux.org Git - packages/geninitrd.git/blob - geninitrd-git.patch
- rel 2; allow discard for LUKS devices
[packages/geninitrd.git] / geninitrd-git.patch
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
16  
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"
32 +
33 +                       verbose "+ cryptsetup ${keyfile:+-d $keyfile} open --type luks $crypttab_opt '$src' '$dst'"
34                         add_linuxrc <<-EOF
35                         debugshell
36  
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
45  
This page took 0.072071 seconds and 4 git commands to generate.