add PARTLABEL and PARTUUID
[platform/upstream/dracut.git] / modules.d / 90crypt / parse-crypt.sh
index d61220c..961ec61 100755 (executable)
@@ -4,7 +4,7 @@
 
 if ! getargbool 1 rd.luks -d -n rd_NO_LUKS; then
     info "rd.luks=0: removing cryptoluks activation"
-    rm -f /etc/udev/rules.d/70-luks.rules
+    rm -f -- /etc/udev/rules.d/70-luks.rules
 else
     {
         echo 'SUBSYSTEM!="block", GOTO="luks_end"'
@@ -27,6 +27,14 @@ else
                     printf -- '--name cryptroot-ask-%%k %s ' $(command -v cryptroot-ask)
                     printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $tout
                 } >> /etc/udev/rules.d/70-luks.rules.new
+            else
+                {
+                    printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
+                    printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
+                    printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
+                    printf -- '--name systemd-cryptsetup-%%k %s start ' $(command -v systemctl)
+                    printf -- 'systemd-cryptsetup@luks$$(dev_unit_name -$env{ID_FS_UUID}).service"\n'
+                } >> /etc/udev/rules.d/70-luks.rules.new
             fi
 
             uuid=$luksid