summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-04-08 23:34:05 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-04-08 23:34:05 -0400
commitfc65cfc74d13600dc0b28847cd3b6f5062372dd4 (patch)
tree54b8cf6caa931b2c15cbf8879b260cd2258afbc7 /Annex
parent81ebac3402d72a2cbdacd6830367dcd28429d105 (diff)
Added annex.web-download-command setting.
Diffstat (limited to 'Annex')
-rw-r--r--Annex/Content.hs18
1 files changed, 14 insertions, 4 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs
index 44e5bb106..5985bf227 100644
--- a/Annex/Content.hs
+++ b/Annex/Content.hs
@@ -439,10 +439,20 @@ saveState nocommit = doSideAction $ do
{- Downloads content from any of a list of urls. -}
downloadUrl :: [Url.URLString] -> FilePath -> Annex Bool
-downloadUrl urls file = do
- o <- map Param . annexWebOptions <$> Annex.getGitConfig
- headers <- getHttpHeaders
- liftIO $ anyM (\u -> Url.download u headers o file) urls
+downloadUrl urls file = go =<< annexWebDownloadCommand <$> Annex.getGitConfig
+ where
+ go Nothing = do
+ opts <- map Param . annexWebOptions <$> Annex.getGitConfig
+ headers <- getHttpHeaders
+ liftIO $ anyM (\u -> Url.download u headers opts file) urls
+ go (Just basecmd) = liftIO $ anyM (downloadcmd basecmd) urls
+ downloadcmd basecmd url =
+ boolSystem "sh" [Param "-c", Param $ gencmd basecmd url]
+ <&&> doesFileExist file
+ gencmd basecmd url =
+ replace "%file" (shellEscape file) $
+ replace "%url" (shellEscape url)
+ basecmd
{- Copies a key's content, when present, to a temp file.
- This is used to speed up some rsyncs. -}