From: Harald Hoyer Date: Wed, 21 Nov 2012 15:30:58 +0000 (+0100) Subject: crypt/crypt-run-generator.sh: fixup last commit 065fc56ab27d8ea1aace72de54a6884bb558ea97 X-Git-Tag: 025~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=329bbd797fb5ffb0865afc6eb4726e32e34b0b15;p=thirdparty%2Fdracut.git crypt/crypt-run-generator.sh: fixup last commit 065fc56ab27d8ea1aace72de54a6884bb558ea97 --- diff --git a/modules.d/90crypt/crypt-run-generator.sh b/modules.d/90crypt/crypt-run-generator.sh index 29fb22d8b..8d16f7c16 100755 --- a/modules.d/90crypt/crypt-run-generator.sh +++ b/modules.d/90crypt/crypt-run-generator.sh @@ -1,4 +1,6 @@ #!/bin/sh +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh . /lib/dracut-lib.sh @@ -11,18 +13,21 @@ if [ -f /etc/crypttab ]; then done < /etc/crypttab fi +allowdiscards="-" + # parse for allow-discards if strstr "$(cryptsetup --help)" "allow-discards"; then if discarduuids=$(getargs "rd.luks.allow-discards"); then - if strstr " ${luksdev##luks-} " " ${discarduuids##luks-}"; then - allowdiscards="allow-discards" - fi - elif getargbool rd.luks.allow-discards; then - allowdiscards="allow-discards" + discarduuids=$(str_replace "$discarduuids" 'luks-' '') + if strstr " $discarduuids " " ${luks##luks-}"; then + allowdiscards="allow-discards" + fi + elif getargbool 0 rd.luks.allow-discards; then + allowdiscards="allow-discards" fi fi -echo "$luks $dev none $allowdiscards" >> /etc/crypttab +echo "$luks $dev - $allowdiscards" >> /etc/crypttab if command -v systemctl >/dev/null; then systemctl daemon-reload diff --git a/modules.d/90crypt/cryptroot-ask.sh b/modules.d/90crypt/cryptroot-ask.sh index 87522d9a6..9665e4869 100755 --- a/modules.d/90crypt/cryptroot-ask.sh +++ b/modules.d/90crypt/cryptroot-ask.sh @@ -97,10 +97,11 @@ done # parse for allow-discards if strstr "$(cryptsetup --help)" "allow-discards"; then if discarduuids=$(getargs "rd.luks.allow-discards"); then - if strstr " ${luksdev##luks-} " " ${discarduuids##luks-}"; then + discarduuids=$(str_replace "$discarduuids" 'luks-' '') + if strstr " $discarduuids " " ${luksdev##luks-}"; then allowdiscards="--allow-discards" fi - elif getargbool rd.luks.allow-discards; then + elif getargbool 0 rd.luks.allow-discards; then allowdiscards="--allow-discards" fi fi