From adc686031bf60e72ba9dc13b7fb6b65121050ed1 Mon Sep 17 00:00:00 2001 From: joe Date: Wed, 27 Apr 2016 20:27:17 -0400 Subject: TODO (atomic transactions for /var/cache/kiki). --- lib/Kiki.hs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib') 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 -- sshspathpub0 = fromMaybe "" rootdir ++ "/etc/ssh/ssh_host_rsa_key.pub" -- contactipsec0 = fromMaybe "" rootdir ++ "/etc/ipsec.d/certs/%(onion).pem" + -- TODO (atomic transactions) + -- + -- Use this stratagy for atomic transactions: + -- + -- # cachedir=./cache + -- # destdir=config # relative to cachedir + -- # mkdir -p "$cachedir" + -- # cd "$cachedir" + -- # tempdir=$(mktemp -d --tmpdir=.) || exit 1 + -- # touch "$tempdir"/asdf + -- # ln -s "$tempdir" "$tempdir".link + -- # mv -T "$tempdir".link "$destdir" + -- + -- (before ln -s, "$tempdir" could be renamed to something meaningful) + -- + -- For now, we will just rm -rf the old cache and regenerate in-place. readProcessWithExitCode "rm" ["-rf", mkpath "*"] "" -- clean up, in case gpg altered the keyring. flip (maybe $ warn "missing working key?") (rtWorkingKey rt) $ \wk -> do -- cgit v1.2.3