shared/install: resolve specifiers in Also=
Test case: [Install] WantedBy= default.target Also=getty@%p.service $ ./systemctl --root=/ enable testing@instance.service Created symlink /etc/systemd/system/default.target.wants/testing@instance.service → /etc/systemd/system/testing@.service. Created symlink /etc/systemd/system/getty.target.wants/getty@testing.service → /usr/lib/systemd/system/getty@.service. $ ./systemctl --root=/ disable testing@instance.service Removed /etc/systemd/system/getty.target.wants/getty@testing.service. Removed /etc/systemd/system/default.target.wants/testing@instance.service. Fixes part of #4210. Resolving specifiers in DefaultInstance seems to work too: [Install] WantedBy= default.target DefaultInstance=%u $ systemctl --root=/ enable testing3@instance.service Created symlink /etc/systemd/system/default.target.wants/testing3@instance.service → /etc/systemd/system/testing3@.service. $ systemctl --root=/ enable testing3@.service Created symlink /etc/systemd/system/default.target.wants/testing3@zbyszek.service → /etc/systemd/system/testing3@.service.
This commit is contained in:
+11
-4
@@ -1054,7 +1054,7 @@ static int config_parse_also(
|
||||
assert(rvalue);
|
||||
|
||||
for (;;) {
|
||||
_cleanup_free_ char *word = NULL;
|
||||
_cleanup_free_ char *word = NULL, *printed = NULL;
|
||||
|
||||
r = extract_first_word(&rvalue, &word, NULL, 0);
|
||||
if (r < 0)
|
||||
@@ -1062,15 +1062,22 @@ static int config_parse_also(
|
||||
if (r == 0)
|
||||
break;
|
||||
|
||||
r = install_info_add(c, word, NULL, true, &alsoinfo);
|
||||
r = install_full_printf(info, word, &printed);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = strv_push(&info->also, word);
|
||||
if (!unit_name_is_valid(printed, UNIT_NAME_ANY))
|
||||
return -EINVAL;
|
||||
|
||||
r = install_info_add(c, printed, NULL, true, &alsoinfo);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
word = NULL;
|
||||
r = strv_push(&info->also, printed);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
printed = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user