thread through original key to retrieveEnctypted
Allows showing progress bar for this last case of the directory special remote.
This commit is contained in:
parent
4638314001
commit
7ba79cfb8c
6 changed files with 17 additions and 16 deletions
|
@ -129,8 +129,8 @@ retrieve buprepo k f = do
|
||||||
retrieveCheap :: BupRepo -> Key -> FilePath -> Annex Bool
|
retrieveCheap :: BupRepo -> Key -> FilePath -> Annex Bool
|
||||||
retrieveCheap _ _ _ = return False
|
retrieveCheap _ _ _ = return False
|
||||||
|
|
||||||
retrieveEncrypted :: BupRepo -> (Cipher, Key) -> FilePath -> Annex Bool
|
retrieveEncrypted :: BupRepo -> (Cipher, Key) -> Key -> FilePath -> Annex Bool
|
||||||
retrieveEncrypted buprepo (cipher, enck) f = do
|
retrieveEncrypted buprepo (cipher, enck) _ f = do
|
||||||
let params = bupParams "join" buprepo [Param $ show enck]
|
let params = bupParams "join" buprepo [Param $ show enck]
|
||||||
liftIO $ catchBoolIO $ do
|
liftIO $ catchBoolIO $ do
|
||||||
(pid, h) <- hPipeFrom "bup" $ toCommand params
|
(pid, h) <- hPipeFrom "bup" $ toCommand params
|
||||||
|
|
|
@ -237,11 +237,12 @@ retrieve d chunksize k f = metered k $ \meterupdate ->
|
||||||
(L.concat <$> mapM L.readFile files)
|
(L.concat <$> mapM L.readFile files)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
retrieveEncrypted :: FilePath -> ChunkSize -> (Cipher, Key) -> FilePath -> Annex Bool
|
retrieveEncrypted :: FilePath -> ChunkSize -> (Cipher, Key) -> Key -> FilePath -> Annex Bool
|
||||||
retrieveEncrypted d chunksize (cipher, enck) f =
|
retrieveEncrypted d chunksize (cipher, enck) k f = metered k $ \meterupdate ->
|
||||||
liftIO $ withStoredFiles chunksize d enck $ \files -> catchBoolIO $ do
|
liftIO $ withStoredFiles chunksize d enck $ \files ->
|
||||||
|
catchBoolIO $ do
|
||||||
withDecryptedContent cipher (L.concat <$> mapM L.readFile files) $
|
withDecryptedContent cipher (L.concat <$> mapM L.readFile files) $
|
||||||
L.writeFile f
|
meteredWriteFile meterupdate f
|
||||||
return True
|
return True
|
||||||
|
|
||||||
retrieveCheap :: FilePath -> ChunkSize -> Key -> FilePath -> Annex Bool
|
retrieveCheap :: FilePath -> ChunkSize -> Key -> FilePath -> Annex Bool
|
||||||
|
|
|
@ -40,7 +40,7 @@ encryptionSetup c =
|
||||||
encryptableRemote
|
encryptableRemote
|
||||||
:: Maybe RemoteConfig
|
:: Maybe RemoteConfig
|
||||||
-> ((Cipher, Key) -> Key -> Annex Bool)
|
-> ((Cipher, Key) -> Key -> Annex Bool)
|
||||||
-> ((Cipher, Key) -> FilePath -> Annex Bool)
|
-> ((Cipher, Key) -> Key -> FilePath -> Annex Bool)
|
||||||
-> Remote
|
-> Remote
|
||||||
-> Remote
|
-> Remote
|
||||||
encryptableRemote c storeKeyEncrypted retrieveKeyFileEncrypted r =
|
encryptableRemote c storeKeyEncrypted retrieveKeyFileEncrypted r =
|
||||||
|
@ -58,7 +58,7 @@ encryptableRemote c storeKeyEncrypted retrieveKeyFileEncrypted r =
|
||||||
(`storeKeyEncrypted` k)
|
(`storeKeyEncrypted` k)
|
||||||
retrieve k f = cip k >>= maybe
|
retrieve k f = cip k >>= maybe
|
||||||
(retrieveKeyFile r k f)
|
(retrieveKeyFile r k f)
|
||||||
(`retrieveKeyFileEncrypted` f)
|
(\enck -> retrieveKeyFileEncrypted enck k f)
|
||||||
retrieveCheap k f = cip k >>= maybe
|
retrieveCheap k f = cip k >>= maybe
|
||||||
(retrieveKeyFileCheap r k f)
|
(retrieveKeyFileCheap r k f)
|
||||||
(\_ -> return False)
|
(\_ -> return False)
|
||||||
|
|
|
@ -114,8 +114,8 @@ retrieve h k f = runHook h "retrieve" k (Just f) $ return True
|
||||||
retrieveCheap :: String -> Key -> FilePath -> Annex Bool
|
retrieveCheap :: String -> Key -> FilePath -> Annex Bool
|
||||||
retrieveCheap _ _ _ = return False
|
retrieveCheap _ _ _ = return False
|
||||||
|
|
||||||
retrieveEncrypted :: String -> (Cipher, Key) -> FilePath -> Annex Bool
|
retrieveEncrypted :: String -> (Cipher, Key) -> Key -> FilePath -> Annex Bool
|
||||||
retrieveEncrypted h (cipher, enck) f = withTmp enck $ \tmp ->
|
retrieveEncrypted h (cipher, enck) _ f = withTmp enck $ \tmp ->
|
||||||
runHook h "retrieve" enck (Just tmp) $ liftIO $ catchBoolIO $ do
|
runHook h "retrieve" enck (Just tmp) $ liftIO $ catchBoolIO $ do
|
||||||
withDecryptedContent cipher (L.readFile tmp) $ L.writeFile f
|
withDecryptedContent cipher (L.readFile tmp) $ L.writeFile f
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -119,8 +119,8 @@ retrieveCheap o k f = do
|
||||||
then retrieve o k f
|
then retrieve o k f
|
||||||
else return False
|
else return False
|
||||||
|
|
||||||
retrieveEncrypted :: RsyncOpts -> (Cipher, Key) -> FilePath -> Annex Bool
|
retrieveEncrypted :: RsyncOpts -> (Cipher, Key) -> Key -> FilePath -> Annex Bool
|
||||||
retrieveEncrypted o (cipher, enck) f = withTmp enck $ \tmp -> do
|
retrieveEncrypted o (cipher, enck) _ f = withTmp enck $ \tmp -> do
|
||||||
res <- retrieve o enck tmp
|
res <- retrieve o enck tmp
|
||||||
if res
|
if res
|
||||||
then liftIO $ catchBoolIO $ do
|
then liftIO $ catchBoolIO $ do
|
||||||
|
|
|
@ -161,8 +161,8 @@ retrieve r k f = s3Action r False $ \(conn, bucket) -> do
|
||||||
retrieveCheap :: Remote -> Key -> FilePath -> Annex Bool
|
retrieveCheap :: Remote -> Key -> FilePath -> Annex Bool
|
||||||
retrieveCheap _ _ _ = return False
|
retrieveCheap _ _ _ = return False
|
||||||
|
|
||||||
retrieveEncrypted :: Remote -> (Cipher, Key) -> FilePath -> Annex Bool
|
retrieveEncrypted :: Remote -> (Cipher, Key) -> Key -> FilePath -> Annex Bool
|
||||||
retrieveEncrypted r (cipher, enck) f = s3Action r False $ \(conn, bucket) -> do
|
retrieveEncrypted r (cipher, enck) _ f = s3Action r False $ \(conn, bucket) -> do
|
||||||
res <- liftIO $ getObject conn $ bucketKey r bucket enck
|
res <- liftIO $ getObject conn $ bucketKey r bucket enck
|
||||||
case res of
|
case res of
|
||||||
Right o -> liftIO $
|
Right o -> liftIO $
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue