-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·40 lines (31 loc) · 1002 Bytes
/
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/sh
set -e
log() {
echo "$1"
}
repo="SampaioLeal/butiko"
os_arch="linux_amd64"
latest_release=$(curl -sL "https://api.github.com/repos/${repo}/releases/latest" | jq -r '.tag_name')
asset_url="https://github.com/SampaioLeal/butiko/releases/download/${latest_release}/butiko_${latest_release}_${os_arch}.xz"
install_path="$HOME/.butiko/bin"
exe="$install_path/butiko"
if ! command -v xz >/dev/null; then
log "Error: xz is required to install Butiko." 1>&2
exit 1
fi
mkdir -p "$install_path"
curl --fail --location --progress-bar --output "${exe}.xz" "$asset_url"
xz -d "$exe.xz"
chmod +x "$exe"
log "Butiko was installed successfully to $exe"
if command -v butiko >/dev/null; then
log "Run 'butiko --help' to get started"
else
case $SHELL in
/bin/zsh) shell_profile=".zshrc" ;;
*) shell_profile=".bashrc" ;;
esac
log "Manually add the directory to your \$HOME/$shell_profile (or similar)"
log " export PATH=\"$install_path:\$PATH\""
log "Run '$exe --help' to get started"
fi