diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-09-13 18:18:52 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-09-13 18:18:52 -0400 |
| commit | 515f823c49e0eda9a07673bd938e36c33d9c1a80 (patch) | |
| tree | 0fda0f0909daa418810bbda84c905f9c62f3e6e9 /src | |
| parent | 5242708ae3d7d3433e45c50e9246776cbb4f1976 (diff) | |
avoid running debconf-set-selections on [] and add some types for documentation
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/Property/Apt.hs | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs index e89ea6a2..2e913540 100644 --- a/src/Propellor/Property/Apt.hs +++ b/src/Propellor/Property/Apt.hs @@ -239,18 +239,25 @@ unattendedUpgrades = enable <!> disable ("Unattended-Upgrade::Origins-Pattern { \"o=Debian,a="++showSuite suite++"\"; };") _ -> noChange +type DebconfTemplate = String +type DebconfTemplateType = String +type DebconfTemplateValue = String + -- | Preseeds debconf values and reconfigures the package so it takes -- effect. -reConfigure :: Package -> [(String, String, String)] -> Property NoInfo +reConfigure :: Package -> [(DebconfTemplate, DebconfTemplateType, DebconfTemplateValue)] -> Property NoInfo reConfigure package vals = reconfigure `requires` setselections `describe` ("reconfigure " ++ package) where - setselections = property "preseed" $ makeChange $ - withHandle StdinHandle createProcessSuccess - (proc "debconf-set-selections" []) $ \h -> do - forM_ vals $ \(tmpl, tmpltype, value) -> - hPutStrLn h $ unwords [package, tmpl, tmpltype, value] - hClose h + setselections = property "preseed" $ + if null vals + then noChange + else makeChange $ + withHandle StdinHandle createProcessSuccess + (proc "debconf-set-selections" []) $ \h -> do + forM_ vals $ \(tmpl, tmpltype, value) -> + hPutStrLn h $ unwords [package, tmpl, tmpltype, value] + hClose h reconfigure = cmdPropertyEnv "dpkg-reconfigure" ["-fnone", package] noninteractiveEnv -- | Ensures that a service is installed and running. |
