]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
initrd: fix systemd.debug-shell & friends 14177/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 3 Dec 2019 13:48:27 +0000 (14:48 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 3 Dec 2019 13:48:27 +0000 (14:48 +0100)
They would get assigned to an inactive target in the initramfs.

src/debug-generator/debug-generator.c

index bc8714c4c7f5cbae20cca42f15a141c26c60284b..4e41eca3521b037b7c5f15cecccf870916e05ddc 100644 (file)
@@ -126,7 +126,15 @@ static int generate_wants_symlinks(void) {
 
         STRV_FOREACH(u, arg_wants) {
                 _cleanup_free_ char *p = NULL, *f = NULL;
-                const char *target = arg_default_unit ?: SPECIAL_DEFAULT_TARGET;
+                const char *target;
+
+                /* This should match what do_queue_default_job() in core/main.c does. */
+                if (arg_default_unit)
+                        target = arg_default_unit;
+                else if (in_initrd())
+                        target = SPECIAL_INITRD_TARGET;
+                else
+                        target = SPECIAL_DEFAULT_TARGET;
 
                 p = strjoin(arg_dest, "/", target, ".wants/", *u);
                 if (!p)