summaryrefslogtreecommitdiff
path: root/lib/KeyRing.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2016-04-28 00:58:14 -0400
committerjoe <joe@jerkface.net>2016-04-28 00:58:14 -0400
commit39b94e9bb752d1a5590c94d2847d421dbcea8e6f (patch)
tree408d88aa4b22bf957d66f5f881b7eb7297f911df /lib/KeyRing.hs
parent368ae2d134ceb7ffbc3a5b1696574e7eb4d3e3d8 (diff)
write hosts file to cache.
Diffstat (limited to 'lib/KeyRing.hs')
-rw-r--r--lib/KeyRing.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/KeyRing.hs b/lib/KeyRing.hs
index fbd23fe..04ac7c6 100644
--- a/lib/KeyRing.hs
+++ b/lib/KeyRing.hs
@@ -107,6 +107,8 @@ module KeyRing
107 107
108import System.Environment 108import System.Environment
109import Control.Monad 109import Control.Monad
110import Control.Exception ( catch )
111import System.IO.Error ( isDoesNotExistError )
110import Data.Maybe 112import Data.Maybe
111import Data.Either 113import Data.Either
112import Data.Char 114import Data.Char
@@ -137,7 +139,7 @@ import Data.Text.Encoding ( encodeUtf8 )
137import qualified Data.Map as Map 139import qualified Data.Map as Map
138import qualified Data.ByteString.Lazy as L ( unpack, null, readFile, writeFile 140import qualified Data.ByteString.Lazy as L ( unpack, null, readFile, writeFile
139 , ByteString, toChunks, hGetContents, hPut, concat, fromChunks, splitAt 141 , ByteString, toChunks, hGetContents, hPut, concat, fromChunks, splitAt
140 , index, break, pack ) 142 , index, break, pack, empty )
141import qualified Data.ByteString as S ( ByteString, unpack, splitAt, concat, cons, spanEnd, hGetContents, readFile, breakSubstring, drop, length, null, hPutStr, singleton, unfoldr, reverse ) 143import qualified Data.ByteString as S ( ByteString, unpack, splitAt, concat, cons, spanEnd, hGetContents, readFile, breakSubstring, drop, length, null, hPutStr, singleton, unfoldr, reverse )
142import qualified Codec.Binary.Base32 as Base32 144import qualified Codec.Binary.Base32 as Base32
143import qualified Codec.Binary.Base64 as Base64 145import qualified Codec.Binary.Base64 as Base64
@@ -1354,7 +1356,13 @@ mergeHostFiles krd db ctx = do
1354 guard (istyp $ typ stream) 1356 guard (istyp $ typ stream)
1355 return f 1357 return f
1356 1358
1357 hostdbs0 <- mapM (fmap Hosts.decode . readInputFileL ctx) hns 1359 readInputFileL' ctx f =
1360 readInputFileL ctx f
1361 `catch` \e -> do when (not $ isDoesNotExistError e) $ do
1362 return () -- todo report problem
1363 return L.empty
1364
1365 hostdbs0 <- mapM (fmap Hosts.decode . readInputFileL' ctx) hns
1358 1366
1359 let gpgnames = map getHostnames $ Map.elems db 1367 let gpgnames = map getHostnames $ Map.elems db
1360 os = do 1368 os = do