diff options
| author | Sean Whitton <spwhitton@spwhitton.name> | 2015-07-03 20:32:47 +0100 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-07-05 15:52:00 -0400 |
| commit | b462aefdb2e3c413348ce4cc13f5eedb67f22299 (patch) | |
| tree | c2131f84ab144da36a300336d92ae543d1924ff0 /src/Propellor/Property/Systemd.hs | |
| parent | 1d6972bb79361f81a07346f64778418da5d6c6df (diff) | |
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>
Diffstat (limited to 'src/Propellor/Property/Systemd.hs')
| -rw-r--r-- | src/Propellor/Property/Systemd.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Propellor/Property/Systemd.hs b/src/Propellor/Property/Systemd.hs index 17849980..718ceca6 100644 --- a/src/Propellor/Property/Systemd.hs +++ b/src/Propellor/Property/Systemd.hs @@ -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 |
