测试版本库,随便折腾。
陈炜
2021-01-26 d717ddd0d4e6e954f7d7f64b7797f28e8806152f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
VERSION=1.0
TARFILE=verysync-linux-installer-${VERSION}.tar
TARURL=http://www.verysync.com/shell/verysync-linux-installer/$TARFILE
 
CURL=`command -v curl  2>/dev/null`
WGET=`command -v wget  2>/dev/null`
 
#######color code########
RED="31m"      # Error message
GREEN="32m"    # Success message
YELLOW="33m"   # Warning message
BLUE="36m"     # Info message
 
colorEcho(){
    COLOR=$1
    echo -e "\033[${COLOR}${@:2}\033[0m"
}
 
if [[ "$CURL" == "" && "$WGET" == "" ]]; then
    colorEcho ${RED} "Did not find the wget or curl command"
    exit 1;
fi
 
 
if [[ "$CURL" == "" ]]; then
    CURL="$WGET -k -O-"
else
    CURL="$CURL --connect-timeout 10 -k"
fi
 
 
colorEcho $GREEN "Downloading from $TARURL"
$CURL $TARURL > $TARFILE
if [[ $? -ne 0 ]]; then
    colorEcho ${RED} "Failed to fetch $TARURL Please check your network or try again."
    exit 3
fi
 
colorEcho $GREEN "Extracting installer"
 
mkdir -p verysync-installer
cd verysync-installer && tar xf "../$TARFILE"
if [[ $? -ne 0 ]]; then
    colorEcho ${RED} "Failed to extract verysync-installer."
    exit 4
fi
 
colorEcho $GREEN "Processing ..."
./go-inst.sh $@