install: only consider names in Alias= as "enabling"
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 21 Sep 2017 16:53:45 +0000 (18:53 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 22 Sep 2017 16:12:52 +0000 (18:12 +0200)
commit5cd8ae31527384dcdbd1e9d2c7e7cd3a803222f8
tree28e011446573dec5d2293bf27e402f3b22a605eb
parent7a7ec2bf71b146aaa217732d2ad029e730ffb3cd
install: only consider names in Alias= as "enabling"

When a unit has a symlink that makes an alias in the filesystem,
but that name is not specified in [Install], it is confusing
is the unit is shown as "enabled". Look only for names specified
in Alias=.

Fixes #6338.

v2:
- Fix indentation.
- Fix checking for normal enablement, when the symlink name is the same as the
  unit name. This case wasn't handled properly in v1.

v3:
- Rework the patch to also handle templates properly:
  A template templ@.service with DefaultInstance=foo will be considered
  enabled only when templ@foo.service symlink is found. Symlinks with
  other instance names do not count, which matches the logic for aliases
  to normal units. Tests are updated.
man/systemctl.xml
src/shared/install.c
src/test/test-install-root.c