-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall_dunner.sh
executable file
·38 lines (33 loc) · 1.07 KB
/
install_dunner.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
#!/bin/bash
VERSION='latest'
API_URL="https://api.github.com/repos/leopardslab/dunner/releases"
RELEASES_URL="https://github.com/leopardslab/dunner/releases"
setVersion() {
echo "Finding latest version of dunner"
VERSION=$(curl -s "$API_URL/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/');
if [ "$VERSION" == "" ]; then
VERSION=$(curl "$API_URL/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/');
echo "Version not set"
VERSION="v2.1.3"
fi
echo "version: $VERSION"
}
binInstall() {
# Binary installation from the release page.
ARCH=$(uname -m)
OS=$(uname -s)
ver=$(echo $VERSION | sed s/v//g)
if [[ $(which tar) ]]; then
downloadUrl="${RELEASES_URL}/download/${VERSION}/dunner_${ver}_${OS}_${ARCH}.tar.gz"
echo "Downloading dunner_${ver}_${OS}_${ARCH}..."
wget -O "dunner.tar.gz" $downloadUrl 2>/dev/null || curl -o "dunner.tar.gz" -L $downloadUrl
if [[ $OS == 'Linux' || $OS == 'Darwin' ]]; then
tar -xf dunner.tar.gz
fi
else
echo "'tar' command not found..."
exit 1
fi
}
setVersion
binInstall