diff options
author | joe <joe@jerkface.net> | 2016-04-27 20:27:17 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2016-04-27 20:27:17 -0400 |
commit | adc686031bf60e72ba9dc13b7fb6b65121050ed1 (patch) | |
tree | 82d83aa60e72f15a266bba1278f05e3c867336df /lib | |
parent | 7cb2a0f142d3999d06285c7a0e438bba8c765057 (diff) |
TODO (atomic transactions for /var/cache/kiki).
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kiki.hs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Kiki.hs b/lib/Kiki.hs index 6b4ee83..f4c8820 100644 --- a/lib/Kiki.hs +++ b/lib/Kiki.hs | |||
@@ -235,6 +235,22 @@ refreshCache rt rootdir = do | |||
235 | -- sshspathpub0 = fromMaybe "" rootdir ++ "/etc/ssh/ssh_host_rsa_key.pub" | 235 | -- sshspathpub0 = fromMaybe "" rootdir ++ "/etc/ssh/ssh_host_rsa_key.pub" |
236 | -- contactipsec0 = fromMaybe "" rootdir ++ "/etc/ipsec.d/certs/%(onion).pem" | 236 | -- contactipsec0 = fromMaybe "" rootdir ++ "/etc/ipsec.d/certs/%(onion).pem" |
237 | 237 | ||
238 | -- TODO (atomic transactions) | ||
239 | -- | ||
240 | -- Use this stratagy for atomic transactions: | ||
241 | -- | ||
242 | -- # cachedir=./cache | ||
243 | -- # destdir=config # relative to cachedir | ||
244 | -- # mkdir -p "$cachedir" | ||
245 | -- # cd "$cachedir" | ||
246 | -- # tempdir=$(mktemp -d --tmpdir=.) || exit 1 | ||
247 | -- # touch "$tempdir"/asdf | ||
248 | -- # ln -s "$tempdir" "$tempdir".link | ||
249 | -- # mv -T "$tempdir".link "$destdir" | ||
250 | -- | ||
251 | -- (before ln -s, "$tempdir" could be renamed to something meaningful) | ||
252 | -- | ||
253 | -- For now, we will just rm -rf the old cache and regenerate in-place. | ||
238 | readProcessWithExitCode "rm" ["-rf", mkpath "*"] "" -- clean up, in case gpg altered the keyring. | 254 | readProcessWithExitCode "rm" ["-rf", mkpath "*"] "" -- clean up, in case gpg altered the keyring. |
239 | 255 | ||
240 | flip (maybe $ warn "missing working key?") (rtWorkingKey rt) $ \wk -> do | 256 | flip (maybe $ warn "missing working key?") (rtWorkingKey rt) $ \wk -> do |