From f8dc9b294dbc114255129113f84fabde6dac46cc Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 16 Aug 2015 17:47:21 -0700 Subject: ConfFile.containsIniPair property plus scaffolding for other generic conf file properties (cherry picked from commit 86b077b7a21efd5484dfaeee3c31fc5f3c151f6c) --- propellor.cabal | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'propellor.cabal') diff --git a/propellor.cabal b/propellor.cabal index f00e5594..640d0293 100644 --- a/propellor.cabal +++ b/propellor.cabal @@ -73,7 +73,8 @@ Library Propellor.Property.Apt Propellor.Property.Cmd Propellor.Property.Hostname - Propellor.Property.Chroot + Propellor.Property.Chroot + Propellor.Property.ConfFile Propellor.Property.Cron Propellor.Property.Debootstrap Propellor.Property.Dns -- cgit v1.3-2-g0d8e From 47059b7358a94e06dadc44b76b5b81d560dadd80 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 20 Aug 2015 10:13:18 -0400 Subject: layout --- propellor.cabal | 2 +- src/Propellor/Property/ConfFile.hs | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'propellor.cabal') diff --git a/propellor.cabal b/propellor.cabal index 640d0293..317f30d8 100644 --- a/propellor.cabal +++ b/propellor.cabal @@ -73,7 +73,7 @@ Library Propellor.Property.Apt Propellor.Property.Cmd Propellor.Property.Hostname - Propellor.Property.Chroot + Propellor.Property.Chroot Propellor.Property.ConfFile Propellor.Property.Cron Propellor.Property.Debootstrap diff --git a/src/Propellor/Property/ConfFile.hs b/src/Propellor/Property/ConfFile.hs index 72996c74..b2d96d29 100644 --- a/src/Propellor/Property/ConfFile.hs +++ b/src/Propellor/Property/ConfFile.hs @@ -5,17 +5,17 @@ import Propellor.Property.File import Data.List (isPrefixOf, foldl') -type SectionStart = Line -> Bool -- ^ find the line that is the start of the - -- wanted section (eg, == "") -type SectionPast = Line -> Bool -- ^ find a line that indicates we are past - -- the section (eg, a new section header) -type AdjustSection = [Line] -> [Line] -- ^ run on all lines in the section, - -- including the SectionStart line and any - -- SectionEnd line; can add/delete/modify - -- lines, or even delete entire section -type InsertSection = [Line] -> [Line] -- ^ if SectionStart does not find the - -- section in the file, this is used to - -- insert the section somewhere within it +-- | find the line that is the start of the wanted section (eg, == "") +type SectionStart = Line -> Bool +-- | find a line that indicates we are past the section +-- (eg, a new section header) +type SectionPast = Line -> Bool +-- | run on all lines in the section, including the SectionStart line; +-- can add/delete/modify lines, or even delete entire section +type AdjustSection = [Line] -> [Line] +-- | if SectionStart does not find the section in the file, this is used to +-- insert the section somewhere within it +type InsertSection = [Line] -> [Line] adjustSection :: String @@ -29,9 +29,9 @@ adjustSection desc start past adjust insert f = fileProperty desc go f where go ls = let (pre, wanted, post) = foldl' find ([], [], []) ls - in if null wanted - then insert ls - else pre ++ (adjust wanted) ++ post + in if null wanted + then insert ls + else pre ++ (adjust wanted) ++ post find (pre, wanted, post) l | null wanted && null post && (not . start) l = (pre ++ [l], wanted, post) -- cgit v1.3-2-g0d8e From 0a08f4a1541b3711861a67ff660d60d3f5d668e3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 20 Aug 2015 10:14:18 -0400 Subject: include lightdm module (and formatting) --- propellor.cabal | 1 + src/Propellor/Property/LightDM.hs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'propellor.cabal') diff --git a/propellor.cabal b/propellor.cabal index 317f30d8..ad02c6b3 100644 --- a/propellor.cabal +++ b/propellor.cabal @@ -97,6 +97,7 @@ Library Propellor.Property.Prosody Propellor.Property.Reboot Propellor.Property.List + Propellor.Property.LightDM Propellor.Property.Scheduled Propellor.Property.Service Propellor.Property.Ssh diff --git a/src/Propellor/Property/LightDM.hs b/src/Propellor/Property/LightDM.hs index 09f7165d..156a2a82 100644 --- a/src/Propellor/Property/LightDM.hs +++ b/src/Propellor/Property/LightDM.hs @@ -8,5 +8,5 @@ import qualified Propellor.Property.ConfFile as ConfFile -- | Configures LightDM to skip the login screen and autologin as a user. autoLogin :: User -> Property NoInfo autoLogin (User u) = "/etc/lightdm/lightdm.conf" `ConfFile.containsIniPair` - ("SeatDefaults", "autologin-user", u) - `describe` "lightdm autologin" + ("SeatDefaults", "autologin-user", u) + `describe` "lightdm autologin" -- cgit v1.3-2-g0d8e