aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/simplaret24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/simplaret b/src/simplaret
index fd8113a..0bc27d6 100755
--- a/src/simplaret
+++ b/src/simplaret
@@ -38,7 +38,8 @@ function simplaret_usage {
function simplaret_get_index {
for file in `simplaret_metafiles`; do
- simplaret_download $1 $file $2
+ echo $BASENAME: getting $1/$file
+ simplaret_download $1 $file $2 --no-verbose
done
}
@@ -69,10 +70,11 @@ function simplaret_check_index {
function simplaret_download {
# download a file from a repo to a folder
- # usage: simplaret <repository_url> <package> <destination-folder>
+ # usage: simplaret <repository_url> <package> <destination-folder> [--no-verbose]
local protocol file
- local wget_timeout wget_passive_ftp
+ local wget_timeout wget_passive_ftp wget_verbose
+ local curl_timeout curl_passive_ftp
local ncftpget_timeout ncftpget_passive_ftp
protocol="`echo $1 | cut -d : -f 1`"
@@ -85,19 +87,31 @@ function simplaret_download {
if [ ! -z "$CONNECT_TIMEOUT" ] || [ "$CONNECT_TIMEOUT" != "0" ]; then
wget_timeout="--timeout $CONNECT_TIMEOUT"
ncftpget_timeout="-t $CONNECT_TIMEOUT"
+ curl_timeout="--connect-timeout $CONNECT_TIMEOUT"
+ fi
+
+ if [ "$4" == "--no-verbose" ]; then
+ wget_verbose="--no-verbose"
fi
if [ "$protocol" == "http" ]; then
- wget $wget_timeout $1/$2 -O $3/$file
+ if [ "$HTTP_TOOL" == "wget" ]; then
+ wget $wget_timeout $wget_verbose $1/$2 -O $3/$file
+ elif [ "$HTTP_TOOL" == "curl" ]; then
+ curl $curl_timeout $1/$2 > $3/$file
+ fi
elif [ "$protocol" == "ftp" ]; then
if [ "$PASSIVE_FTP" == "1" ]; then
wget_passive_ftp="--passive-ftp"
ncftpget_passive_ftp="-F"
+ curl_passive_ftp="--ftp-pasv"
fi
if [ "$FTP_TOOL" == "ncftpget" ]; then
ncftpget -c $ncftpget_timeout $ncftpget_passive_ftp $1/$2 > $3/$file
elif [ "$FTP_TOOL" == "wget" ]; then
- wget $wget_timeout $wget_passive_ftp $1/$2 -O $3/$file
+ wget $wget_timeout $wget_passive_ftp $wget_verbose $1/$2 -O $3/$file
+ elif [ "$FTP_TOOL" == "curl" ]; then
+ curl $curl_timeout $curl_passive_ftp $1/$2 > $3/$file
else
echo $BASENAME: error: invalid value for config variable FTP_TOOL: $FTP_TOOL
echo $BASENAME: please check your config file $CONF