chiark / gitweb /
cryptsetup: don't add unit dependency on /dev/null devices when it is listed as passw...
[elogind.git] / src / cryptsetup / cryptsetup-generator.c
index dfdca1e47b4e3ce82ddf7fd6027a5f89e748b5d8..da1632459989d3c70be0ef047f94e7e851dc07b2 100644 (file)
@@ -29,6 +29,7 @@
 #include "mkdir.h"
 #include "strv.h"
 #include "fileio.h"
+#include "path-util.h"
 
 static const char *arg_dest = "/tmp";
 static bool arg_enabled = true;
@@ -144,16 +145,19 @@ static int create_disk(
                         if (!uu)
                                 return log_oom();
 
-                        if (is_device_path(uu)) {
-                                _cleanup_free_ char *dd;
+                        if (!path_equal(uu, "/dev/null")) {
 
-                                dd = unit_name_from_path(uu, ".device");
-                                if (!dd)
-                                        return log_oom();
+                                if (is_device_path(uu)) {
+                                        _cleanup_free_ char *dd;
 
-                                fprintf(f, "After=%1$s\nRequires=%1$s\n", dd);
-                        } else
-                                fprintf(f, "RequiresMountsFor=%s\n", password);
+                                        dd = unit_name_from_path(uu, ".device");
+                                        if (!dd)
+                                                return log_oom();
+
+                                        fprintf(f, "After=%1$s\nRequires=%1$s\n", dd);
+                                } else
+                                        fprintf(f, "RequiresMountsFor=%s\n", password);
+                        }
                 }
         }
 
@@ -291,8 +295,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value) {
                 if (!arg_keyfile)
                         return log_oom();
 
-        } else if (startswith(key, "luks.") || startswith(key, "rd.luks."))
-                log_warning("Unknown kernel switch %s. Ignoring.", key);
+        }
 
         return 0;
 }