diff options
author | James Crayne <jim.crayne@gmail.com> | 2016-04-27 22:44:45 -0400 |
---|---|---|
committer | James Crayne <jim.crayne@gmail.com> | 2016-04-27 22:44:45 -0400 |
commit | 5464df5bf2fe6fcee35f787455d4bf097e8904ee (patch) | |
tree | 2fbd2db3f93d87cb2b44057ea73ff6cdb287ed96 /lib/Kiki.hs | |
parent | 5d7edcd9d08d86e72fdc65116f3debbde6086845 (diff) |
cleanup old comment, and unnecessary rm -rf
Diffstat (limited to 'lib/Kiki.hs')
-rw-r--r-- | lib/Kiki.hs | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/lib/Kiki.hs b/lib/Kiki.hs index 34594cc..79868c9 100644 --- a/lib/Kiki.hs +++ b/lib/Kiki.hs | |||
@@ -219,7 +219,7 @@ refreshCache rt rootdir = do | |||
219 | unslash ('/':xs) = xs | 219 | unslash ('/':xs) = xs |
220 | unslash xs = xs | 220 | unslash xs = xs |
221 | createDirectoryIfMissing True cachedir | 221 | createDirectoryIfMissing True cachedir |
222 | tmpdir <- createTempDirectory cachedir "tmp.dir" | 222 | tmpdir <- createTempDirectory cachedir "transaction.dir" |
223 | createSymbolicLink tmpdir (tmpdir ++ ".link") | 223 | createSymbolicLink tmpdir (tmpdir ++ ".link") |
224 | let mkpath pth = tmpdir </> unslash pth | 224 | let mkpath pth = tmpdir </> unslash pth |
225 | commit = rename (tmpdir ++ ".link") destdir | 225 | commit = rename (tmpdir ++ ".link") destdir |
@@ -247,24 +247,6 @@ refreshCache rt rootdir = do | |||
247 | -- sshspathpub0 = fromMaybe "" rootdir ++ "/etc/ssh/ssh_host_rsa_key.pub" | 247 | -- sshspathpub0 = fromMaybe "" rootdir ++ "/etc/ssh/ssh_host_rsa_key.pub" |
248 | -- contactipsec0 = fromMaybe "" rootdir ++ "/etc/ipsec.d/certs/%(onion).pem" | 248 | -- contactipsec0 = fromMaybe "" rootdir ++ "/etc/ipsec.d/certs/%(onion).pem" |
249 | 249 | ||
250 | -- TODO (atomic transactions) | ||
251 | -- | ||
252 | -- Use this stratagy for atomic transactions: | ||
253 | -- | ||
254 | -- # cachedir=./cache -- let cacheddir = ".cache" | ||
255 | -- # destdir=config # relative to cachedir -- destdir = "config" | ||
256 | -- # mkdir -p "$cachedir" -- createDirectoryIfMissing True cacheddir | ||
257 | -- # cd "$cachedir" | ||
258 | -- # tempdir=$(mktemp -d --tmpdir=.) || exit 1 -- tmpdir <- createTempDirectory cachedir "tmp.dir" | ||
259 | -- # touch "$tempdir"/asdf -- ** Do Transaction stuff here ** | ||
260 | -- # ln -s "$tempdir" "$tempdir".link -- createSymbolicLink tmpdir (tmpdir ++ ".link") | ||
261 | -- # mv -T "$tempdir".link "$destdir" -- rename (tmpdir ++ ".link") (cachedir </> destdir) | ||
262 | -- | ||
263 | -- (before ln -s, "$tempdir" could be renamed to something meaningful) | ||
264 | -- | ||
265 | -- For now, we will just rm -rf the old cache and regenerate in-place. | ||
266 | readProcessWithExitCode "rm" ["-rf", mkpath "*"] "" -- clean up, in case gpg altered the keyring. | ||
267 | |||
268 | flip (maybe $ warn "missing working key?") (rtWorkingKey rt) $ \wk -> do | 250 | flip (maybe $ warn "missing working key?") (rtWorkingKey rt) $ \wk -> do |
269 | 251 | ||
270 | let grip = fingerprint wk | 252 | let grip = fingerprint wk |