From b462aefdb2e3c413348ce4cc13f5eedb67f22299 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Fri, 3 Jul 2015 20:32:47 +0100 Subject: 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 --- src/Propellor/Property/Systemd.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') 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 -- cgit v1.2.3