[services-systemd] Introduce disable-targets and mask

- With refactored code, introducing new kinds of actions
   is very few lines of code. Allow disabling targets
   (services was already possible). Allow masking units,
   but as a special case require the complete name.

FIXES #975
This commit is contained in:
Adriaan de Groot 2018-06-27 07:09:03 -04:00
parent 5d6e07712b
commit c9c777b055
2 changed files with 23 additions and 0 deletions

View File

@ -76,5 +76,14 @@ def run():
if r is not None:
return r
r = systemctl(cfg["disable-targets"], "disable", ".target")
if r is not None:
return r
r = systemctl(cfg["mask"], "mask", "")
if r is not None:
return r
# This could have just been return r
return None

View File

@ -42,8 +42,22 @@
# disable:
# - name: "pacman-init"
# mandatory: false
#
# # Disables <name>.target
# disable-targets: []
#
# # Masks (stronger version of disable). This section
# # is unusual because you **must** include the suffix
# # (e.g. ".service") as part of the name, so, e.g. to mask
# # NetworkManager (rather than just disable it) you must
# # specify "NetworkManager.service" as name.
# mask:
# - name: "NetworkManager.service"
# - mandatory: true
# By default, no changes are made.
services: []
targets: []
disable: []
disable-targets: []
mask: []