shared/install: properly report masked units listed in Also=
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 18 Aug 2016 02:15:54 +0000 (22:15 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 19 Aug 2016 13:55:56 +0000 (09:55 -0400)
commitf16517151310b88591f3501a59e23ae2a79e7f02
tree91633cc4bbbae903e4fb83756a8d3a1b912451fb
parentde78fa9ba0be55b01066ca5a716c6673d76b817b
shared/install: properly report masked units listed in Also=

A masked unit is listed in Also=:

$ systemctl cat test1 test2
→# /etc/systemd/system/test1.service
[Unit]
Description=test service 1

[Service]
Type=oneshot
ExecStart=/usr/bin/true

[Install]
WantedBy=multi-user.target
Also=test2.service
Alias=alias1.service

→# /dev/null

$ systemctl --root=/ enable test1
(before)
Created symlink /etc/systemd/system/alias1.service → /etc/systemd/system/test1.service.
Created symlink /etc/systemd/system/multi-user.target.wants/test1.service → /etc/systemd/system/test1.service.
The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
settings in the [Install] section, and DefaultInstance for template units).
This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).
4) In case of template units, the unit is meant to be enabled with some
   instance name specified.

(after)
Created symlink /etc/systemd/system/alias1.service → /etc/systemd/system/test1.service.
Created symlink /etc/systemd/system/multi-user.target.wants/test1.service → /etc/systemd/system/test1.service.
Unit /etc/systemd/system/test2.service is masked, ignoring.
src/shared/install.c