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/Kiki.hs | |
parent | 368ae2d134ceb7ffbc3a5b1696574e7eb4d3e3d8 (diff) |
write hosts file to cache.
Diffstat (limited to 'lib/Kiki.hs')
-rw-r--r-- | lib/Kiki.hs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Kiki.hs b/lib/Kiki.hs index 9fb71be..8090aac 100644 --- a/lib/Kiki.hs +++ b/lib/Kiki.hs | |||
@@ -240,6 +240,20 @@ refreshCache rt rootdir = do | |||
240 | return (mkpath,commit) | 240 | return (mkpath,commit) |
241 | (mkpath, commit) <- getMkPathAndCommit (fromMaybe "" rootdir ++ "/var/cache/kiki/config") | 241 | (mkpath, commit) <- getMkPathAndCommit (fromMaybe "" rootdir ++ "/var/cache/kiki/config") |
242 | 242 | ||
243 | -- Generete hosts file. | ||
244 | let hostspath = mkpath "hosts" | ||
245 | op = KeyRingOperation | ||
246 | { opFiles = Map.fromList $ | ||
247 | [ ( HomePub, streaminfo { typ=KeyRingFile, spill=KF_All, access=Pub } ) | ||
248 | , ( ArgFile hostspath, streaminfo { typ=Hosts, spill=KF_None, fill=KF_All, access=Pub } ) | ||
249 | ] | ||
250 | , opPassphrases = [] | ||
251 | , opHome = Just $ takeDirectory (rtPubring rt) | ||
252 | , opTransforms = [] | ||
253 | } | ||
254 | KikiResult _ report <- runKeyRing op | ||
255 | outputReport report | ||
256 | |||
243 | let write' wr f bs = do | 257 | let write' wr f bs = do |
244 | createDirectoryIfMissing True $ takeDirectory f | 258 | createDirectoryIfMissing True $ takeDirectory f |
245 | wr f bs | 259 | wr f bs |