-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
68 lines (54 loc) · 1.44 KB
/
Copy pathinstall.sh
File metadata and controls
68 lines (54 loc) · 1.44 KB
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
65
66
67
68
#!/bin/sh
set -e
# Onyx installer
# curl -fsSL https://raw.githubusercontent.com/lilienblum/onyx/master/install.sh | sh
REPO="lilienblum/onyx"
BIN_DIR="$HOME/.local/bin"
# Detect platform
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case "$OS" in
linux) ;;
darwin) OS="macos" ;;
*) echo "error: unsupported OS: $OS"; exit 1 ;;
esac
case "$ARCH" in
x86_64|amd64) ARCH="x86_64" ;;
aarch64|arm64) ARCH="aarch64" ;;
*) echo "error: unsupported architecture: $ARCH"; exit 1 ;;
esac
if [ "$OS" = "macos" ]; then
NAME="onyx-aarch64-macos"
else
NAME="onyx-${ARCH}-linux"
fi
# Get latest release URL
URL="https://github.com/$REPO/releases/latest/download/${NAME}.tar.gz"
echo "installing onyx..."
echo " $URL"
# Download and extract
TMP=$(mktemp -d)
trap "rm -rf $TMP" EXIT
curl -fsSL "$URL" -o "$TMP/onyx.tar.gz"
tar xzf "$TMP/onyx.tar.gz" -C "$TMP"
# Install
mkdir -p "$BIN_DIR"
mv "$TMP/$NAME" "$BIN_DIR/onyx"
chmod +x "$BIN_DIR/onyx"
echo "installed to $BIN_DIR/onyx"
# Check PATH
case ":$PATH:" in
*":$BIN_DIR:"*) ;;
*)
echo ""
echo "add ~/.local/bin to your PATH:"
SHELL_NAME=$(basename "$SHELL")
case "$SHELL_NAME" in
fish) echo " fish_add_path ~/.local/bin" ;;
zsh) echo " echo 'export PATH=\"\$HOME/.local/bin:\$PATH\"' >> ~/.zshrc" ;;
*) echo " echo 'export PATH=\"\$HOME/.local/bin:\$PATH\"' >> ~/.bashrc" ;;
esac
echo ""
;;
esac
echo "run 'onyx init' to complete setup"