-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgo-openbmclapi-in-tmux.sh
52 lines (48 loc) · 1.38 KB
/
go-openbmclapi-in-tmux.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
#!/bin/bash
case "`uname -m`" in
x86_64)
GOARCH="amd64"
;;
i386|i686)
GOARCH="386"
;;
aarch64)
GOARCH="arm64"
;;
armv7l)
GOARCH="arm"
;;
*)
echo "【8Mi & BMCLAPI】 未知处理器架构: `uname -m`,请将该架构报告到 https://github.com/LiterMC/go-openbmclapi/issues"
exit
esac
FILE_NAME="./openbmclapi-go"
#REPROXY_URL="https://mirror.ghproxy.com/"
REPROXY_URL=""
URL="https://github.com/LiterMC/go-openbmclapi/releases/latest/download/go-openbmclapi-linux-$GOARCH"
while true; do
if [ -e "$FILE_NAME" ]; then
echo "【8Mi & BMCLAPI】 检测更新中"
TAG_URL=`curl -sI $URL | grep "location: " | sed 's/location: //'`
TAG=`$FILE_NAME version | grep 'Go-OpenBmclApi v' | sed -e "s/^Go-OpenBmclApi v.* (//" -e "s/)$//"`
if [ -n "$TAG" ] && echo "$TAG_URL" | grep -qF "$TAG"; then
echo "【8Mi & BMCLAPI】 无需更新."
NEED_DL=false
else
NEED_DL=true
fi
else
NEED_DL=true
fi
if [ "$NEED_DL" = true ]; then
echo "【8Mi & BMCLAPI】 开始下载"
while true; do
wget --show-progress -qO "$FILE_NAME" "$REPROXY_URL$URL"
if [ $? -eq 0 ]; then
break
fi
sleep 1
done
fi
chmod +x $FILE_NAME; $FILE_NAME; sleep 1
done