diff options
author | joe <joe@jerkface.net> | 2016-04-28 00:58:14 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2016-04-28 00:58:14 -0400 |
commit | 39b94e9bb752d1a5590c94d2847d421dbcea8e6f (patch) | |
tree | 408d88aa4b22bf957d66f5f881b7eb7297f911df /lib/KeyRing.hs | |
parent | 368ae2d134ceb7ffbc3a5b1696574e7eb4d3e3d8 (diff) |
write hosts file to cache.
Diffstat (limited to 'lib/KeyRing.hs')
-rw-r--r-- | lib/KeyRing.hs | 12 |
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 | ||
108 | import System.Environment | 108 | import System.Environment |
109 | import Control.Monad | 109 | import Control.Monad |
110 | import Control.Exception ( catch ) | ||
111 | import System.IO.Error ( isDoesNotExistError ) | ||
110 | import Data.Maybe | 112 | import Data.Maybe |
111 | import Data.Either | 113 | import Data.Either |
112 | import Data.Char | 114 | import Data.Char |
@@ -137,7 +139,7 @@ import Data.Text.Encoding ( encodeUtf8 ) | |||
137 | import qualified Data.Map as Map | 139 | import qualified Data.Map as Map |
138 | import qualified Data.ByteString.Lazy as L ( unpack, null, readFile, writeFile | 140 | import 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 ) |
141 | import qualified Data.ByteString as S ( ByteString, unpack, splitAt, concat, cons, spanEnd, hGetContents, readFile, breakSubstring, drop, length, null, hPutStr, singleton, unfoldr, reverse ) | 143 | import qualified Data.ByteString as S ( ByteString, unpack, splitAt, concat, cons, spanEnd, hGetContents, readFile, breakSubstring, drop, length, null, hPutStr, singleton, unfoldr, reverse ) |
142 | import qualified Codec.Binary.Base32 as Base32 | 144 | import qualified Codec.Binary.Base32 as Base32 |
143 | import qualified Codec.Binary.Base64 as Base64 | 145 | import 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 |