]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
crypt/crypt-run-generator.sh: add allow-discards to options in crypttab
authorHarald Hoyer <harald@redhat.com>
Wed, 26 Sep 2012 09:49:28 +0000 (11:49 +0200)
committerHarald Hoyer <harald@redhat.com>
Wed, 26 Sep 2012 09:49:28 +0000 (11:49 +0200)
modules.d/90crypt/crypt-run-generator.sh

index 224e51180b1e078e5e831a43ccd88aa0eb9a6326..3264b29909dcdbac9d8a59ae5df6ac8636827cf2 100755 (executable)
@@ -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