extract common download
This commit is contained in:
19
scripts/download.sh
Executable file
19
scripts/download.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
WGET_OPTS="--tries=5 --waitretry=5"
|
||||
|
||||
function remove_file() {
|
||||
if [ -f "$1" ]; then
|
||||
rm -f "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
function download_file() {
|
||||
remove_file "$2"
|
||||
if wget ${WGET_OPTS} "$1" -O "$2"; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
remove_file "$2"
|
||||
return 1
|
||||
}
|
||||
Reference in New Issue
Block a user