forked from spicetify/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
64 lines (52 loc) · 1.8 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh
# Copyright 2019 khanhas. GPL license.
# Edited from project Denoland install script (https://github.com/denoland/deno_install)
set -e
case $(uname -s) in
Darwin) target="darwin" ;;
*) target="linux" ;;
esac
if [ $(uname -m) != "x86_64" ]; then
echo "Unsupported architecture $(uname -m). Only x64 binaries are available."
exit
fi
if [ $# -eq 0 ]; then
latest_release_uri="https://api.github.com/repos/khanhas/spicetify-cli/releases/latest"
echo "DOWNLOADING $latest_release_uri"
spicetify_asset_path=$(
command curl -sSf "$latest_release_uri" |
command grep -o "/khanhas/spicetify-cli/releases/download/.*/spicetify-.*-${target}-amd64\\.tar\\.gz" |
command head -n 1
)
if [ ! "$spicetify_asset_path" ]; then exit 1; fi
download_uri="https://github.com${spicetify_asset_path}"
else
download_uri="https://github.com/khanhas/spicetify-cli/releases/download/v${1}/spicetify-${1}-${target}-amd64\\.tar\\.gz"
fi
spicetify_install="${SPICETIFY_INSTALL:-$HOME/spicetify-cli}"
exe="$spicetify_install/spicetify"
if [ ! -d "$spicetify_install" ]; then
echo "MAKING FOLDER $spicetify_install";
mkdir -p "$spicetify_install"
fi
tar_file="$exe.tar.gz"
echo "DOWNLOADING $download_uri"
curl --fail --location --progress-bar --output "$tar_file" "$download_uri"
cd "$spicetify_install"
echo "EXTRACTING $tar_file"
tar xzf "$tar_file"
chmod +x "$exe"
echo "REMOVING $tar_file"
rm "$tar_file"
echo ""
echo "spicetify was installed successfully to $exe"
echo ""
if command -v spicetify >/dev/null; then
echo "Run 'spicetify --help' to get started"
else
echo "Manually add the directory to your \$HOME/.bash_profile (or similar)"
echo " export SPICETIFY_INSTALL=\"$spicetify_install\""
echo " export PATH=\"\$SPICETIFY_INSTALL:\$PATH\""
echo ""
echo "Run '$exe --help' to get started"
fi