summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Grub.hs
diff options
context:
space:
mode:
authorSean Whitton2018-06-15 16:44:06 +0100
committerJoey Hess2018-06-16 07:46:52 -0400
commitbdda5413e14a4e9c7d7e7a19f5e0ebe3e43feef0 (patch)
tree55513b160241022b2bf398a07389b9b0e7ce91ee /src/Propellor/Property/Grub.hs
parent87cfaae69f29e156a7bcb5b1924b806056c4401c (diff)
Grub.configured uses ConfFile.containsShellSetting
This implies the following behavioural changes: (1) Grub.configured will now change the value set by the first line it finds that sets the value of its key, if one exists. Previously, Grub.configured would unconditionally append to /etc/default/grub, unless the key=value pair was already present. (2) Grub.configured will comment out any further lines setting the value of its key found further down the file. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/Propellor/Property/Grub.hs')
-rw-r--r--src/Propellor/Property/Grub.hs12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/Propellor/Property/Grub.hs b/src/Propellor/Property/Grub.hs
index 79ecd8c9..852b8dcd 100644
--- a/src/Propellor/Property/Grub.hs
+++ b/src/Propellor/Property/Grub.hs
@@ -68,17 +68,9 @@ installed' grubtarget = setInfoProperty aptinstall
-- > & Grub.configured "GRUB_TIMEOUT" "10"
-- > & Grub.configured "GRUB_TERMINAL_INPUT" "console serial"
configured :: String -> String -> Property DebianLike
-configured k v = ConfFile.adjustSection
- ("grub configured with " ++ k ++ "=" ++ v)
- isline
- (not . isline)
- (const [l])
- (const [l])
- simpleConfigFile
+configured k v = ConfFile.containsShellSetting simpleConfigFile (k, v)
+ `describe` ("grub configured with " ++ k ++ "=" ++ v)
`onChange` mkConfig
- where
- isline s = (k ++ "=") `isPrefixOf` s
- l = k ++ "=" ++ shellEscape v
simpleConfigFile :: FilePath
simpleConfigFile = "/etc/default/grub"