diff options
| author | Joey Hess <joey@kitenet.net> | 2014-04-02 12:13:39 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-04-02 13:18:08 -0400 |
| commit | 526bcbf093af665f316a0ba4d1a836786ab66dcf (patch) | |
| tree | d4ceb9ec125587cfac37cb50c178fcc4624dcedf /Propellor/Property/Apt.hs | |
| parent | 7705f65ae22f38989f404c77de4d661b652e692e (diff) | |
type-safe reversions
Diffstat (limited to 'Propellor/Property/Apt.hs')
| -rw-r--r-- | Propellor/Property/Apt.hs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/Propellor/Property/Apt.hs b/Propellor/Property/Apt.hs index 92e23b7e..0b8b8ab9 100644 --- a/Propellor/Property/Apt.hs +++ b/Propellor/Property/Apt.hs @@ -129,16 +129,18 @@ autoRemove :: Property autoRemove = runApt ["-y", "autoremove"] `describe` "apt autoremove" -unattendedUpgrades :: Bool -> Property -unattendedUpgrades enabled = - (if enabled then installed else removed) ["unattended-upgrades"] - `onChange` reConfigure "unattended-upgrades" - [("unattended-upgrades/enable_auto_updates" , "boolean", v)] - `describe` ("unattended upgrades " ++ v) +-- | Enables unattended upgrades. Revert to disable. +unattendedUpgrades :: RevertableProperty +unattendedUpgrades = RevertableProperty (go True) (go False) where - v - | enabled = "true" - | otherwise = "false" + go enabled = (if enabled then installed else removed) ["unattended-upgrades"] + `onChange` reConfigure "unattended-upgrades" + [("unattended-upgrades/enable_auto_updates" , "boolean", v)] + `describe` ("unattended upgrades " ++ v) + where + v + | enabled = "true" + | otherwise = "false" -- | Preseeds debconf values and reconfigures the package so it takes -- effect. |
