Added annex.web-download-command setting.
This commit is contained in:
		
					parent
					
						
							
								1c36af163c
							
						
					
				
			
			
				commit
				
					
						d440b6047b
					
				
			
		
					 4 changed files with 28 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
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 o file) urls
 | 
			
		||||
		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. -}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,6 +36,7 @@ data GitConfig = GitConfig
 | 
			
		|||
	, annexHttpHeadersCommand :: Maybe String
 | 
			
		||||
	, annexAutoCommit :: Bool
 | 
			
		||||
	, annexWebOptions :: [String]
 | 
			
		||||
	, annexWebDownloadCommand :: Maybe String
 | 
			
		||||
	, annexCrippledFileSystem :: Bool
 | 
			
		||||
	, annexLargeFiles :: Maybe String
 | 
			
		||||
	, coreSymlinks :: Bool
 | 
			
		||||
| 
						 | 
				
			
			@ -59,6 +60,7 @@ extractGitConfig r = GitConfig
 | 
			
		|||
	, annexHttpHeadersCommand = getmaybe (annex "http-headers-command")
 | 
			
		||||
	, annexAutoCommit = getbool (annex "autocommit") True
 | 
			
		||||
	, annexWebOptions = getwords (annex "web-options")
 | 
			
		||||
	, annexWebDownloadCommand = getmaybe (annex "web-download-command")
 | 
			
		||||
	, annexCrippledFileSystem = getbool (annex "crippledfilesystem") False
 | 
			
		||||
	, annexLargeFiles = getmaybe (annex "largefiles")
 | 
			
		||||
	, coreSymlinks = getbool "core.symlinks" True
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										1
									
								
								debian/changelog
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								debian/changelog
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -13,6 +13,7 @@ git-annex (4.20130406) UNRELEASED; urgency=low
 | 
			
		|||
  * webapp: New --listen= option allows running the webapp on one computer
 | 
			
		||||
    and connecting to it from another. (Note: Does not yet use HTTPS.)
 | 
			
		||||
  * webapp: When a repository's group is changed, rescan for transfers.
 | 
			
		||||
  * Added annex.web-download-command setting.
 | 
			
		||||
 | 
			
		||||
 -- Joey Hess <joeyh@debian.org>  Sat, 06 Apr 2013 15:24:15 -0400
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -966,7 +966,7 @@ Here are all the supported configuration settings.
 | 
			
		|||
* `annex.web-options`
 | 
			
		||||
 | 
			
		||||
  Options to use when using wget or curl to download a file from the web.
 | 
			
		||||
  (wget is always used in preference to curl if available).
 | 
			
		||||
  (wget is always used in preference to curl if available.)
 | 
			
		||||
  For example, to force ipv4 only, set it to "-4"
 | 
			
		||||
 | 
			
		||||
* `annex.http-headers`
 | 
			
		||||
| 
						 | 
				
			
			@ -979,6 +979,16 @@ Here are all the supported configuration settings.
 | 
			
		|||
  If set, the command is run and each line of its output is used as a HTTP
 | 
			
		||||
  header. This overrides annex.http-headers.
 | 
			
		||||
 | 
			
		||||
* `annex.web-download-command`
 | 
			
		||||
 | 
			
		||||
  Use to specify a command to run to download a file from the web.
 | 
			
		||||
  (The default is to use wget or curl.)
 | 
			
		||||
 | 
			
		||||
  In the command line, %url is replaced with the url to download,
 | 
			
		||||
  and %file is replaced with the file that it should be saved to.
 | 
			
		||||
  Note that both these values will automatically be quoted, since
 | 
			
		||||
  the command is run in a shell.
 | 
			
		||||
 | 
			
		||||
* `remote.<name>.rsyncurl`
 | 
			
		||||
 | 
			
		||||
  Used by rsync special remotes, this configures
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue