-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathinstall.sh
More file actions
29 lines (22 loc) · 775 Bytes
/
install.sh
File metadata and controls
29 lines (22 loc) · 775 Bytes
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
version=$1
repo="TheWinds/devgo"
if [ -z "$version" ]; then
version=$(curl --silent "https://api.github.com/repos/$repo/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
fi
os_linux_bin="https://github.com/TheWinds/devgo/releases/download/$version/dg-$version-linux-amd64.tar.gz"
os_darwin_bin="https://github.com/TheWinds/devgo/releases/download/$version/dg-$version-darwin-amd64.tar.gz"
bin=""
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
bin=$os_linux_bin
elif [[ "$OSTYPE" == "darwin"* ]]; then
bin=$os_darwin_bin
else
echo "os type not support: $OSTYPE"
exit 1
fi
echo "download $version from $bin"
curl -L -o devgo.tar.gz "${bin}"
tar -zxvf devgo.tar.gz
sudo chmod +x dg
sudo mv dg /usr/local/bin
rm devgo.tar.gz