-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·39 lines (36 loc) · 1.15 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
#!/bin/bash
shellFile=""
if [ -n "$($SHELL -c 'echo $ZSH_VERSION')" ]; then
shellFile=".zshrc"
elif [ -n "$($SHELL -c 'echo $BASH_VERSION')" ]; then
shellFile=".bashrc"
else
echo "it is something else"
fi
platform=''
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
platform="linux-amd64"
elif [[ "$OSTYPE" == "darwin"* ]]; then
if [[ $(sysctl -n machdep.cpu.brand_string) == *"Apple"* ]]; then
platform="darwin-arm64"
else
platform="darwin-amd64"
fi
else
echo "something else"
fi
platform="destiny-$platform"
tagName=$(curl -s https://api.github.com/repos/bhumit070/destiny/releases/136918205 | awk -F'"tag_name":' '{print $2}' | awk -F'"' '{print $2}' | xargs)
downloadableUrl="https://github.com/bhumit070/destiny/releases/download/$tagName/$platform"
echo "downloading..."
installDir="$HOME/.destiny"
destinationPath="$installDir/destiny"
mkdir -p "$installDir"
curl -# -L "$downloadableUrl" -o "$destinationPath" && chmod +x "$destinationPath"
command="export PATH=\$PATH:\$HOME/.destiny"
if grep -q "$command" "$HOME/$shellFile"; then
echo "already installed."
exit 0
fi
echo $command >> "$HOME/$shellFile"
echo "installation completed."