From: Robert Buchholz Date: Sun, 11 Nov 2012 19:25:06 +0000 (+0100) Subject: Make short uuid specification for allow-discards work X-Git-Tag: 025~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=065fc56ab27d8ea1aace72de54a6884bb558ea97;p=thirdparty%2Fdracut.git Make short uuid specification for allow-discards work 1) strstr " $discarduuids " did not remove the optional 'luks-' prefix from the argument as the documentation says. 2) The lookup seems backwards. $luksdev ($luks in the other code copy) is the full uuid and thus one should check whether the user-supplied argument (short form) is contained therein, not the other way around. Before this commit, the only way to trigger allow-discards was to specify the full uuid without the 'luks-' prefix. --- diff --git a/modules.d/90crypt/crypt-run-generator.sh b/modules.d/90crypt/crypt-run-generator.sh index bacdbbe0e..29fb22d8b 100755 --- a/modules.d/90crypt/crypt-run-generator.sh +++ b/modules.d/90crypt/crypt-run-generator.sh @@ -14,7 +14,7 @@ fi # parse for allow-discards if strstr "$(cryptsetup --help)" "allow-discards"; then if discarduuids=$(getargs "rd.luks.allow-discards"); then - if strstr " $discarduuids " " ${luks##luks-}"; then + if strstr " ${luksdev##luks-} " " ${discarduuids##luks-}"; then allowdiscards="allow-discards" fi elif getargbool rd.luks.allow-discards; then diff --git a/modules.d/90crypt/cryptroot-ask.sh b/modules.d/90crypt/cryptroot-ask.sh index 17955eccc..87522d9a6 100755 --- a/modules.d/90crypt/cryptroot-ask.sh +++ b/modules.d/90crypt/cryptroot-ask.sh @@ -97,7 +97,7 @@ done # parse for allow-discards if strstr "$(cryptsetup --help)" "allow-discards"; then if discarduuids=$(getargs "rd.luks.allow-discards"); then - if strstr " $discarduuids " " ${luksdev##luks-}"; then + if strstr " ${luksdev##luks-} " " ${discarduuids##luks-}"; then allowdiscards="--allow-discards" fi elif getargbool rd.luks.allow-discards; then