From a52f7a546def6685be8dba5d7145b1f50aaa35d2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 28 May 2016 14:48:59 -0400 Subject: 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. --- src/Propellor/Property/Systemd.hs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/Propellor') 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 -> -- cgit v1.2.3