]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Make short uuid specification for allow-discards work
authorRobert Buchholz <rbu@goodpoint.de>
Sun, 11 Nov 2012 19:25:06 +0000 (20:25 +0100)
committerHarald Hoyer <harald@redhat.com>
Wed, 21 Nov 2012 15:01:45 +0000 (16:01 +0100)
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.

modules.d/90crypt/crypt-run-generator.sh
modules.d/90crypt/cryptroot-ask.sh

index bacdbbe0edd4dca040fa61b45953b77755f8e972..29fb22d8bb3726f2eb1f4359cc4d5f7417b17cfa 100755 (executable)
@@ -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
index 17955ecccdb5787a3121961e765e4d04765a7cf0..87522d9a659c13152e31b7bdfef6c2ebd1943177 100755 (executable)
@@ -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