initrd: fix systemd.debug-shell & friends

They would get assigned to an inactive target in the initramfs.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-12-03 14:48:27 +01:00
parent 2b1daf24dc
commit 23e5e79a51
1 changed files with 9 additions and 1 deletions

View 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)