The wget command will now be used in preference to curl, if available.
Got tired of curl's various ugly progress bars.
This commit is contained in:
parent
f82da1d9dc
commit
6e750764b7
5 changed files with 31 additions and 10 deletions
12
Utility.hs
12
Utility.hs
|
@ -15,7 +15,8 @@ module Utility (
|
||||||
dirContains,
|
dirContains,
|
||||||
dirContents,
|
dirContents,
|
||||||
myHomeDir,
|
myHomeDir,
|
||||||
catchBool
|
catchBool,
|
||||||
|
inPath
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import IO (bracket)
|
import IO (bracket)
|
||||||
|
@ -94,3 +95,12 @@ myHomeDir = do
|
||||||
{- Catches IO errors and returns a Bool -}
|
{- Catches IO errors and returns a Bool -}
|
||||||
catchBool :: IO Bool -> IO Bool
|
catchBool :: IO Bool -> IO Bool
|
||||||
catchBool = flip catch (const $ return False)
|
catchBool = flip catch (const $ return False)
|
||||||
|
|
||||||
|
{- Checks if a command is available in PATH. -}
|
||||||
|
inPath :: String -> IO Bool
|
||||||
|
inPath command = search =<< getSearchPath
|
||||||
|
where
|
||||||
|
search [] = return False
|
||||||
|
search (d:ds) = do
|
||||||
|
e <- doesFileExist $ d </> command
|
||||||
|
if e then return True else search ds
|
||||||
|
|
|
@ -20,6 +20,7 @@ import Network.URI
|
||||||
import Types
|
import Types
|
||||||
import Messages
|
import Messages
|
||||||
import Utility.SafeCommand
|
import Utility.SafeCommand
|
||||||
|
import Utility
|
||||||
|
|
||||||
type URLString = String
|
type URLString = String
|
||||||
|
|
||||||
|
@ -35,15 +36,24 @@ exists url =
|
||||||
_ -> return False
|
_ -> return False
|
||||||
|
|
||||||
{- Used to download large files, such as the contents of keys.
|
{- Used to download large files, such as the contents of keys.
|
||||||
- Uses curl program for its progress bar. -}
|
- Uses wget or curl program for its progress bar. (Wget has a better one,
|
||||||
|
- so is preferred.) -}
|
||||||
download :: URLString -> FilePath -> Annex Bool
|
download :: URLString -> FilePath -> Annex Bool
|
||||||
download url file = do
|
download url file = do
|
||||||
showOutput -- make way for curl progress bar
|
showOutput -- make way for program's progress bar
|
||||||
-- Uses the -# progress display, because the normal one is very
|
e <- liftIO $ inPath "wget"
|
||||||
-- confusing when resuming, showing the remainder to download
|
if e
|
||||||
-- as the whole file, and not indicating how much percent was
|
then
|
||||||
|
liftIO $ boolSystem "wget"
|
||||||
|
[Params "-c -O", File file, File url]
|
||||||
|
else
|
||||||
|
-- Uses the -# progress display, because the normal
|
||||||
|
-- one is very confusing when resuming, showing
|
||||||
|
-- the remainder to download as the whole file,
|
||||||
|
-- and not indicating how much percent was
|
||||||
-- downloaded before the resume.
|
-- downloaded before the resume.
|
||||||
liftIO $ boolSystem "curl" [Params "-L -C - -# -o", File file, File url]
|
liftIO $ boolSystem "curl"
|
||||||
|
[Params "-L -C - -# -o", File file, File url]
|
||||||
|
|
||||||
{- Downloads a small file. -}
|
{- Downloads a small file. -}
|
||||||
get :: URLString -> IO String
|
get :: URLString -> IO String
|
||||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -2,6 +2,7 @@ git-annex (3.20110820) UNRELEASED; urgency=low
|
||||||
|
|
||||||
* Set EMAIL when running test suite so that git does not need to be
|
* Set EMAIL when running test suite so that git does not need to be
|
||||||
configured first. Closes: #638998
|
configured first. Closes: #638998
|
||||||
|
* The wget command will now be used in preference to curl, if available.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Tue, 23 Aug 2011 13:41:01 -0400
|
-- Joey Hess <joeyh@debian.org> Tue, 23 Aug 2011 13:41:01 -0400
|
||||||
|
|
||||||
|
|
2
debian/control
vendored
2
debian/control
vendored
|
@ -31,7 +31,7 @@ Depends: ${misc:Depends}, ${shlibs:Depends},
|
||||||
git | git-core,
|
git | git-core,
|
||||||
uuid,
|
uuid,
|
||||||
rsync,
|
rsync,
|
||||||
curl,
|
wget | curl,
|
||||||
openssh-client
|
openssh-client
|
||||||
Suggests: graphviz, bup, gnupg
|
Suggests: graphviz, bup, gnupg
|
||||||
Description: manage files with git, without checking their contents into git
|
Description: manage files with git, without checking their contents into git
|
||||||
|
|
|
@ -34,7 +34,7 @@ To build and use git-annex, you will need:
|
||||||
(or `uuidgen` from util-linux)
|
(or `uuidgen` from util-linux)
|
||||||
* [xargs](http://savannah.gnu.org/projects/findutils/)
|
* [xargs](http://savannah.gnu.org/projects/findutils/)
|
||||||
* [rsync](http://rsync.samba.org/)
|
* [rsync](http://rsync.samba.org/)
|
||||||
* [curl](http://http://curl.haxx.se/) (optional, but recommended)
|
* [wget](http://www.gnu.org/software/wget/) or [curl](http://http://curl.haxx.se/) (optional, but recommended)
|
||||||
* [sha1sum](ftp://ftp.gnu.org/gnu/coreutils/) (optional, but recommended;
|
* [sha1sum](ftp://ftp.gnu.org/gnu/coreutils/) (optional, but recommended;
|
||||||
a sha1 command will also do)
|
a sha1 command will also do)
|
||||||
* [gpg](http://gnupg.org/) (optional; needed for encryption)
|
* [gpg](http://gnupg.org/) (optional; needed for encryption)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue