summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Systemd.hs
diff options
context:
space:
mode:
authorJoey Hess2016-05-28 14:48:59 -0400
committerJoey Hess2016-05-28 14:48:59 -0400
commita52f7a546def6685be8dba5d7145b1f50aaa35d2 (patch)
treeb31a177091c3697a95c93a7b578b752e5aaad8cd /src/Propellor/Property/Systemd.hs
parentdfd567ec3e71d68bba974c23dd4ae27fed37ec0f (diff)
deal with systemd's KillUserProcesses change
* Systemd: Added killUserProcesses property, which can be reverted to return systemd to its default behavior before version 230 started killing processes like screen sessions. * Systemd: Added logindConfigured property.
Diffstat (limited to 'src/Propellor/Property/Systemd.hs')
-rw-r--r--src/Propellor/Property/Systemd.hs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/Propellor/Property/Systemd.hs b/src/Propellor/Property/Systemd.hs
index e5441817..e11c991e 100644
--- a/src/Propellor/Property/Systemd.hs
+++ b/src/Propellor/Property/Systemd.hs
@@ -12,6 +12,7 @@ module Propellor.Property.Systemd (
restarted,
networkd,
journald,
+ logind,
-- * Configuration
installed,
Option,
@@ -20,6 +21,9 @@ module Propellor.Property.Systemd (
-- * Journal
persistentJournal,
journaldConfigured,
+ -- * Logind
+ logindConfigured,
+ killUserProcesses,
-- * Containers and machined
machined,
MachineName,
@@ -127,6 +131,10 @@ networkd = "systemd-networkd"
journald :: ServiceName
journald = "systemd-journald"
+-- | The systemd-logind service.
+logind :: ServiceName
+logind = "systemd-logind"
+
-- | Enables persistent storage of the journal.
persistentJournal :: Property DebianLike
persistentJournal = check (not <$> doesDirectoryExist dir) $
@@ -172,6 +180,25 @@ journaldConfigured option value =
configured "/etc/systemd/journald.conf" option value
`onChange` restarted journald
+-- | Configures logind, restarting it so the changes take effect.
+logindConfigured :: Option -> String -> Property Linux
+logindConfigured option value =
+ configured "/etc/systemd/logind.conf" option value
+ `onChange` restarted logind
+
+-- | Configures whether leftover processes started from the
+-- user's login session are killed after the user logs out.
+--
+-- The default configuration varies depending on the version of systemd.
+--
+-- Revert the property to ensure that screen sessions etc keep running:
+--
+-- > ! killUserProcesses
+killUserProcesses :: RevertableProperty Linux Linux
+killUserProcesses = set "yes" <!> set "no"
+ where
+ set = logindConfigured "KillUserProcesses"
+
-- | Ensures machined and machinectl are installed
machined :: Property Linux
machined = withOS "machined installed" $ \w o ->