-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathinstall.sh
74 lines (65 loc) · 1.36 KB
/
install.sh
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env bash
hash tar uname grep curl head
OS="$(uname)"
PROXY="https://ghproxy.com/"
case $OS in
Linux)
OS='linux'
;;
Darwin)
OS='darwin'
;;
*)
echo 'OS not supported'
exit 2
;;
esac
ARCH="$(uname -m)"
case $ARCH in
x86_64|amd64)
ARCH='amd64'
;;
aarch64)
ARCH='arm64'
;;
i?86|x86)
ARCH='386'
;;
arm*)
ARCH='arm'
;;
*)
echo 'OS type not supported'
exit 2
;;
esac
if [[ $1 == "-y" ]]; then
echo "使用加速代理"
elif [[ $1 == "-n" ]]; then
echo "不使用加速代理"
PROXY=""
elif [[ $(curl -m 10 -s https://ipapi.co/json | grep 'China') != "" ]]; then
echo "根据ipapi.co提供的信息,当前IP可能在中国"
read -e -r -p "是否选用使用加速代理完成安装? [Y/n] " input
case $input in
[yY][eE][sS] | [yY])
echo "使用加速代理"
;;
[nN][oO] | [nN])
echo "不使用加速代理"
PROXY=""
;;
*)
echo "使用加速代理"
;;
esac
fi
Install()
{
echo '正在下载阿里云盘上传工具...'
CORE_DOWNLOAD_URL=$PROXY$(curl -fsSL https://api.github.com/repos/aoaostar/alidrive-uploader/releases/latest | grep "browser_download_url.*$OS.*$ARCH" | cut -d '"' -f 4)
curl -L "$CORE_DOWNLOAD_URL" | tar -xz
echo '================================================'
echo '阿里云盘上传工具下载完成'
}
Install