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 _ _ _ = return False
|
||||
|
||||
retrieveEncrypted :: BupRepo -> (Cipher, Key) -> FilePath -> Annex Bool
|
||||
retrieveEncrypted buprepo (cipher, enck) f = do
|
||||
retrieveEncrypted :: BupRepo -> (Cipher, Key) -> Key -> FilePath -> Annex Bool
|
||||
retrieveEncrypted buprepo (cipher, enck) _ f = do
|
||||
let params = bupParams "join" buprepo [Param $ show enck]
|
||||
liftIO $ catchBoolIO $ do
|
||||
(pid, h) <- hPipeFrom "bup" $ toCommand params
|
||||
|
|
|
@ -237,12 +237,13 @@ retrieve d chunksize k f = metered k $ \meterupdate ->
|
|||
(L.concat <$> mapM L.readFile files)
|
||||
return True
|
||||
|
||||
retrieveEncrypted :: FilePath -> ChunkSize -> (Cipher, Key) -> FilePath -> Annex Bool
|
||||
retrieveEncrypted d chunksize (cipher, enck) f =
|
||||
liftIO $ withStoredFiles chunksize d enck $ \files -> catchBoolIO $ do
|
||||
withDecryptedContent cipher (L.concat <$> mapM L.readFile files) $
|
||||
L.writeFile f
|
||||
return True
|
||||
retrieveEncrypted :: FilePath -> ChunkSize -> (Cipher, Key) -> Key -> FilePath -> Annex Bool
|
||||
retrieveEncrypted d chunksize (cipher, enck) k f = metered k $ \meterupdate ->
|
||||
liftIO $ withStoredFiles chunksize d enck $ \files ->
|
||||
catchBoolIO $ do
|
||||
withDecryptedContent cipher (L.concat <$> mapM L.readFile files) $
|
||||
meteredWriteFile meterupdate f
|
||||
return True
|
||||
|
||||
retrieveCheap :: FilePath -> ChunkSize -> Key -> FilePath -> Annex Bool
|
||||
retrieveCheap _ (Just _) _ _ = return False -- no cheap retrieval for chunks
|
||||
|
|
|
@ -40,7 +40,7 @@ encryptionSetup c =
|
|||
encryptableRemote
|
||||
:: Maybe RemoteConfig
|
||||
-> ((Cipher, Key) -> Key -> Annex Bool)
|
||||
-> ((Cipher, Key) -> FilePath -> Annex Bool)
|
||||
-> ((Cipher, Key) -> Key -> FilePath -> Annex Bool)
|
||||
-> Remote
|
||||
-> Remote
|
||||
encryptableRemote c storeKeyEncrypted retrieveKeyFileEncrypted r =
|
||||
|
@ -58,7 +58,7 @@ encryptableRemote c storeKeyEncrypted retrieveKeyFileEncrypted r =
|
|||
(`storeKeyEncrypted` k)
|
||||
retrieve k f = cip k >>= maybe
|
||||
(retrieveKeyFile r k f)
|
||||
(`retrieveKeyFileEncrypted` f)
|
||||
(\enck -> retrieveKeyFileEncrypted enck k f)
|
||||
retrieveCheap k f = cip k >>= maybe
|
||||
(retrieveKeyFileCheap r k f)
|
||||
(\_ -> 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 _ _ _ = return False
|
||||
|
||||
retrieveEncrypted :: String -> (Cipher, Key) -> FilePath -> Annex Bool
|
||||
retrieveEncrypted h (cipher, enck) f = withTmp enck $ \tmp ->
|
||||
retrieveEncrypted :: String -> (Cipher, Key) -> Key -> FilePath -> Annex Bool
|
||||
retrieveEncrypted h (cipher, enck) _ f = withTmp enck $ \tmp ->
|
||||
runHook h "retrieve" enck (Just tmp) $ liftIO $ catchBoolIO $ do
|
||||
withDecryptedContent cipher (L.readFile tmp) $ L.writeFile f
|
||||
return True
|
||||
|
|
|
@ -119,8 +119,8 @@ retrieveCheap o k f = do
|
|||
then retrieve o k f
|
||||
else return False
|
||||
|
||||
retrieveEncrypted :: RsyncOpts -> (Cipher, Key) -> FilePath -> Annex Bool
|
||||
retrieveEncrypted o (cipher, enck) f = withTmp enck $ \tmp -> do
|
||||
retrieveEncrypted :: RsyncOpts -> (Cipher, Key) -> Key -> FilePath -> Annex Bool
|
||||
retrieveEncrypted o (cipher, enck) _ f = withTmp enck $ \tmp -> do
|
||||
res <- retrieve o enck tmp
|
||||
if res
|
||||
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 _ _ _ = return False
|
||||
|
||||
retrieveEncrypted :: Remote -> (Cipher, Key) -> FilePath -> Annex Bool
|
||||
retrieveEncrypted r (cipher, enck) f = s3Action r False $ \(conn, bucket) -> do
|
||||
retrieveEncrypted :: Remote -> (Cipher, Key) -> Key -> FilePath -> Annex Bool
|
||||
retrieveEncrypted r (cipher, enck) _ f = s3Action r False $ \(conn, bucket) -> do
|
||||
res <- liftIO $ getObject conn $ bucketKey r bucket enck
|
||||
case res of
|
||||
Right o -> liftIO $
|
||||
|
|
Loading…
Reference in a new issue