From bdda5413e14a4e9c7d7e7a19f5e0ebe3e43feef0 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Fri, 15 Jun 2018 16:44:06 +0100 Subject: 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 --- src/Propellor/Property/Grub.hs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src') 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" -- cgit v1.3-2-g0d8e