Merge pull request #10954 from poettering/install-all-fixo
correct of enabling logic for template units without DefaultInstall=
This commit is contained in:
commit
e33437844e
|
@ -365,6 +365,7 @@ const char *special_glyph(SpecialGlyph code) {
|
|||
[TREE_SPACE] = " ",
|
||||
[TRIANGULAR_BULLET] = ">",
|
||||
[BLACK_CIRCLE] = "*",
|
||||
[BULLET] = "*",
|
||||
[ARROW] = "->",
|
||||
[MDASH] = "-",
|
||||
[ELLIPSIS] = "...",
|
||||
|
@ -381,6 +382,7 @@ const char *special_glyph(SpecialGlyph code) {
|
|||
[TREE_SPACE] = " ", /* */
|
||||
[TRIANGULAR_BULLET] = "\342\200\243", /* ‣ */
|
||||
[BLACK_CIRCLE] = "\342\227\217", /* ● */
|
||||
[BULLET] = "\342\200\242", /* • */
|
||||
[ARROW] = "\342\206\222", /* → */
|
||||
[MDASH] = "\342\200\223", /* – */
|
||||
[ELLIPSIS] = "\342\200\246", /* … */
|
||||
|
|
|
@ -45,6 +45,7 @@ typedef enum {
|
|||
TREE_SPACE,
|
||||
TRIANGULAR_BULLET,
|
||||
BLACK_CIRCLE,
|
||||
BULLET,
|
||||
ARROW,
|
||||
MDASH,
|
||||
ELLIPSIS,
|
||||
|
|
|
@ -1048,11 +1048,14 @@ static int install_info_add(
|
|||
if (r < 0)
|
||||
return r;
|
||||
|
||||
i = new0(UnitFileInstallInfo, 1);
|
||||
i = new(UnitFileInstallInfo, 1);
|
||||
if (!i)
|
||||
return -ENOMEM;
|
||||
i->type = _UNIT_FILE_TYPE_INVALID;
|
||||
i->auxiliary = auxiliary;
|
||||
|
||||
*i = (UnitFileInstallInfo) {
|
||||
.type = _UNIT_FILE_TYPE_INVALID,
|
||||
.auxiliary = auxiliary,
|
||||
};
|
||||
|
||||
i->name = strdup(name);
|
||||
if (!i->name) {
|
||||
|
@ -1749,12 +1752,16 @@ static int install_info_symlink_wants(
|
|||
if (strv_isempty(list))
|
||||
return 0;
|
||||
|
||||
if (unit_name_is_valid(i->name, UNIT_NAME_TEMPLATE) && i->default_instance) {
|
||||
if (unit_name_is_valid(i->name, UNIT_NAME_TEMPLATE)) {
|
||||
UnitFileInstallInfo instance = {
|
||||
.type = _UNIT_FILE_TYPE_INVALID,
|
||||
};
|
||||
_cleanup_free_ char *path = NULL;
|
||||
|
||||
/* If this is a template, and we have no instance, don't do anything */
|
||||
if (!i->default_instance)
|
||||
return 1;
|
||||
|
||||
r = unit_name_replace_instance(i->name, i->default_instance, &buf);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
|
|
@ -6297,18 +6297,19 @@ static int enable_unit(int argc, char *argv[], void *userdata) {
|
|||
}
|
||||
|
||||
if (carries_install_info == 0 && !ignore_carries_install_info)
|
||||
log_warning("The unit files have no installation config (WantedBy, RequiredBy, Also, Alias\n"
|
||||
"settings in the [Install] section, and DefaultInstance for template units).\n"
|
||||
"This means they are not meant to be enabled using systemctl.\n"
|
||||
"Possible reasons for having this kind of units are:\n"
|
||||
"1) A unit may be statically enabled by being symlinked from another unit's\n"
|
||||
" .wants/ or .requires/ directory.\n"
|
||||
"2) A unit's purpose may be to act as a helper for some other unit which has\n"
|
||||
" a requirement dependency on it.\n"
|
||||
"3) A unit may be started when needed via activation (socket, path, timer,\n"
|
||||
" D-Bus, udev, scripted systemctl call, ...).\n"
|
||||
"4) In case of template units, the unit is meant to be enabled with some\n"
|
||||
" instance name specified.");
|
||||
log_notice("The unit files have no installation config (WantedBy=, RequiredBy=, Also=,\n"
|
||||
"Alias= settings in the [Install] section, and DefaultInstance= for template\n"
|
||||
"units). This means they are not meant to be enabled using systemctl.\n \n"
|
||||
"Possible reasons for having this kind of units are:\n"
|
||||
"%1$s A unit may be statically enabled by being symlinked from another unit's\n"
|
||||
" .wants/ or .requires/ directory.\n"
|
||||
"%1$s A unit's purpose may be to act as a helper for some other unit which has\n"
|
||||
" a requirement dependency on it.\n"
|
||||
"%1$s A unit may be started when needed via activation (socket, path, timer,\n"
|
||||
" D-Bus, udev, scripted systemctl call, ...).\n"
|
||||
"%1$s In case of template units, the unit is meant to be enabled with some\n"
|
||||
" instance name specified.",
|
||||
special_glyph(BULLET));
|
||||
|
||||
if (arg_now && STR_IN_SET(argv[0], "enable", "disable", "mask")) {
|
||||
sd_bus *bus;
|
||||
|
|
|
@ -77,6 +77,7 @@ static void dump_special_glyphs(void) {
|
|||
dump_glyph(TREE_SPACE);
|
||||
dump_glyph(TRIANGULAR_BULLET);
|
||||
dump_glyph(BLACK_CIRCLE);
|
||||
dump_glyph(BULLET);
|
||||
dump_glyph(ARROW);
|
||||
dump_glyph(MDASH);
|
||||
dump_glyph(ELLIPSIS);
|
||||
|
|
Loading…
Reference in a new issue