From: Harald Hoyer Date: Wed, 26 Sep 2012 09:49:28 +0000 (+0200) Subject: crypt/crypt-run-generator.sh: add allow-discards to options in crypttab X-Git-Tag: 024~60 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=372202007163a3294f3198dfb0eb9882e89b6e0e;p=thirdparty%2Fdracut.git crypt/crypt-run-generator.sh: add allow-discards to options in crypttab --- diff --git a/modules.d/90crypt/crypt-run-generator.sh b/modules.d/90crypt/crypt-run-generator.sh index 224e51180..3264b2990 100755 --- a/modules.d/90crypt/crypt-run-generator.sh +++ b/modules.d/90crypt/crypt-run-generator.sh @@ -11,7 +11,18 @@ if [ -f /etc/crypttab ]; then done < /etc/crypttab fi -echo "$luks $dev" >> /etc/crypttab +# 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 + allowdiscards="allow-discards" + fi + elif getargbool rd.luks.allow-discards; then + allowdiscards="allow-discards" + fi +fi + +echo "$luks $dev none $allowdiscards" >> /etc/crypttab systemctl daemon-reload systemctl start cryptsetup.target exit 0