commit 400d487b6b6213ed48aef584d0ee867daea92b96
| author | 斟酌 鵬兄 <tgckpg@gmail.com> |
| date | 2016-02-22T00:31:54Z |
| subject | testing for downloader |
commit 400d487b6b6213ed48aef584d0ee867daea92b96
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date: 2016-02-22T00:31:54Z
testing for downloader
---
bash/bashrc/rbashrc | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/bash/bashrc/rbashrc b/bash/bashrc/rbashrc
index e04ffd9..ffe0722 100644
--- a/bash/bashrc/rbashrc
+++ b/bash/bashrc/rbashrc
@@ -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>"