forked from youngwoocho02/unity-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·45 lines (37 loc) · 1.14 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·45 lines (37 loc) · 1.14 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
#!/bin/sh
set -e
REPO="youngwoocho02/unity-cli"
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
case "$OS" in
linux) ;;
darwin) ;;
*) echo "Unsupported OS: $OS (use Windows instructions in README)"; exit 1 ;;
esac
ARCH="$(uname -m)"
case "$ARCH" in
x86_64|amd64) ARCH="amd64" ;;
aarch64|arm64) ARCH="arm64" ;;
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
esac
INSTALL_DIR="$HOME/.local/bin"
mkdir -p "$INSTALL_DIR"
URL="https://github.com/${REPO}/releases/latest/download/unity-cli-${OS}-${ARCH}"
echo "Downloading unity-cli for ${OS}/${ARCH}..."
curl -fsSL "$URL" -o "$INSTALL_DIR/unity-cli"
chmod +x "$INSTALL_DIR/unity-cli"
case ":$PATH:" in
*":$INSTALL_DIR:"*) ;;
*)
export PATH="$INSTALL_DIR:$PATH"
LINE="export PATH=\"$INSTALL_DIR:\$PATH\""
if [ -f "$HOME/.zshrc" ]; then
echo "$LINE" >> "$HOME/.zshrc"
elif [ -f "$HOME/.bashrc" ]; then
echo "$LINE" >> "$HOME/.bashrc"
else
echo "$LINE" >> "$HOME/.profile"
fi
echo "Added $INSTALL_DIR to PATH (restart shell to apply)" ;;
esac
echo "Installed unity-cli to $INSTALL_DIR/unity-cli"
"$INSTALL_DIR/unity-cli" version