Systemd.masked property

This property masks, and when reverted unmasks, systemd services.  This is just
`systemctl mask service` and `systemctl unmask service`.  It's useful for
turning off a system service that you intend to run with --user.

Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
This commit is contained in:
Sean Whitton 2015-07-03 20:32:47 +01:00 committed by Joey Hess
parent 1d6972bb79
commit b462aefdb2
1 changed files with 10 additions and 0 deletions

View File

@ -7,6 +7,7 @@ module Propellor.Property.Systemd (
stopped,
enabled,
disabled,
masked,
running,
restarted,
networkd,
@ -89,6 +90,15 @@ disabled :: ServiceName -> Property NoInfo
disabled n = trivial $ cmdProperty "systemctl" ["disable", n]
`describe` ("service " ++ n ++ " disabled")
-- | Masks a systemd service.
masked :: ServiceName -> RevertableProperty
masked n = systemdMask <!> systemdUnmask
where
systemdMask = trivial $ cmdProperty "systemctl" ["mask", n]
`describe` ("service " ++ n ++ " masked")
systemdUnmask = trivial $ cmdProperty "systemctl" ["unmask", n]
`describe` ("service " ++ n ++ " unmasked")
-- | Ensures that a service is both enabled and started
running :: ServiceName -> Property NoInfo
running n = trivial $ started n `requires` enabled n