]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
feat(crypt): check if pkcs11 module is needed in hostonly mode
authorJóhann B. Guðmundsson <johannbg@gmail.com>
Wed, 29 Dec 2021 09:55:02 +0000 (09:55 +0000)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Wed, 2 Feb 2022 23:14:00 +0000 (23:14 +0000)
In hostonly mode, include the pkcs11 module if any encrypted volumes
are configured to be decrypted using pkcs11.

modules.d/90crypt/module-setup.sh

index fce898f8fa70e04f38aafe08b4e443200871a559..572cba28fdeae2d7df8c2f6f4a6322ff890f2046 100755 (executable)
@@ -21,12 +21,15 @@ depends() {
     local deps
     deps="dm rootfs-block"
     if [[ $hostonly && -f "$dracutsysrootdir"/etc/crypttab ]]; then
-        if grep -q "tpm2-device=" "$dracutsysrootdir"/etc/crypttab; then
-            deps+=" tpm2-tss"
-        fi
         if grep -q -e "fido2-device=" -e "fido2-cid=" "$dracutsysrootdir"/etc/crypttab; then
             deps+=" fido2"
         fi
+        if grep -q "pkcs11-uri" "$dracutsysrootdir"/etc/crypttab; then
+            deps+=" pkcs11"
+        fi
+        if grep -q "tpm2-device=" "$dracutsysrootdir"/etc/crypttab; then
+            deps+=" tpm2-tss"
+        fi
     fi
     echo "$deps"
     return 0