summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Apt.hs
diff options
context:
space:
mode:
authorJoey Hess2014-12-01 11:59:23 -0400
committerJoey Hess2014-12-01 11:59:27 -0400
commitc9d09afafac30ab40f16faf45a216782fb02c39b (patch)
tree38384b5228127febfa6d698c0e49f8a456c17ecf /src/Propellor/Property/Apt.hs
parent1906500030b1f2692d9abe46c2368338d9163894 (diff)
Run apt-cache policy with LANG=C.
Diffstat (limited to 'src/Propellor/Property/Apt.hs')
-rw-r--r--src/Propellor/Property/Apt.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs
index 471d6195..68e877ed 100644
--- a/src/Propellor/Property/Apt.hs
+++ b/src/Propellor/Property/Apt.hs
@@ -193,13 +193,15 @@ isInstalled p = (== [True]) <$> isInstalled' [p]
-- even vary. If apt does not know about a package at all, it will not
-- be included in the result list.
isInstalled' :: [Package] -> IO [Bool]
-isInstalled' ps = catMaybes . map parse . lines
- <$> readProcess "apt-cache" ("policy":ps)
+isInstalled' ps = catMaybes . map parse . lines <$> policy
where
parse l
| "Installed: (none)" `isInfixOf` l = Just False
| "Installed: " `isInfixOf` l = Just True
| otherwise = Nothing
+ policy = do
+ environ <- addEntry "LANG" "C" <$> getEnvironment
+ readProcessEnv "apt-cache" ("policy":ps) (Just environ)
autoRemove :: Property
autoRemove = runApt ["-y", "autoremove"]