testing for downloader

This commit is contained in:
斟酌 鵬兄 2016-02-22 08:31:54 +08:00
parent a7b3820b69
commit 400d487b6b

View File

@ -105,11 +105,25 @@ function __cacheDownload {
__CFILE=$BASH_SDIR/$MLINK
if [ ! -f "$__CFILE" ]; then
curl -s "$1" > "$__CFILE"
__download "$1" > "$__CFILE"
__crypte "$__CFILE"
fi
}
function __download {
which curl 2>&1 > /dev/null
if [ $? -eq 0 ]; then
curl -s "$1"
return;
fi
which wget 2>&1 > /dev/null
if [ $? -eq 0 ]; then
wget -qO- "$1"
return;
fi
}
function __uuid {
local __out=$1
@ -126,7 +140,7 @@ function rbash_upgrade {
echo "Updating the .bashrc"
__uuid TMPID
TMPFILE=/tmp/$TMPID
curl -s "http://git.astropenguin.net/?p=utils.git;a=blob_plain;f=bash/bashrc/rbashrc;hb=HEAD" > $TMPFILE
__download "http://git.astropenguin.net/?p=utils.git;a=blob_plain;f=bash/bashrc/rbashrc;hb=HEAD" > $TMPFILE
if [ -z "$1" ]; then
MC_NAME="<MACHINE_NAME>"