-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·72 lines (59 loc) · 1.86 KB
/
install.sh
File metadata and controls
executable file
·72 lines (59 loc) · 1.86 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
69
70
71
72
#!/bin/sh
# Install xmaster - enterprise-grade X/Twitter CLI
# Usage: curl -fsSL https://raw.githubusercontent.com/paperfoot/xmaster-cli/master/install.sh | sh
set -e
REPO="paperfoot/xmaster-cli"
BINARY="xmaster"
# Detect OS and architecture
OS="$(uname -s)"
ARCH="$(uname -m)"
case "$OS" in
Linux) OS_TAG="unknown-linux-gnu" ;;
Darwin) OS_TAG="apple-darwin" ;;
*) echo "Unsupported OS: $OS"; exit 1 ;;
esac
case "$ARCH" in
x86_64) ARCH_TAG="x86_64" ;;
aarch64|arm64) ARCH_TAG="aarch64" ;;
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
esac
TARGET="${ARCH_TAG}-${OS_TAG}"
LATEST=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" | grep '"tag_name"' | sed 's/.*"tag_name": *"\([^"]*\)".*/\1/')
if [ -z "$LATEST" ]; then
echo "No releases found. Install from source:"
echo " cargo install --git https://github.com/${REPO}"
exit 1
fi
ASSET="${BINARY}-${TARGET}"
URL="https://github.com/${REPO}/releases/download/${LATEST}/${ASSET}"
echo "Downloading xmaster ${LATEST} for ${TARGET}..."
TMPDIR=$(mktemp -d)
curl -fsSL "$URL" -o "${TMPDIR}/${BINARY}"
# Install to ~/.local/bin or /usr/local/bin
if [ -d "$HOME/.local/bin" ]; then
INSTALL_DIR="$HOME/.local/bin"
elif [ -w "/usr/local/bin" ]; then
INSTALL_DIR="/usr/local/bin"
else
INSTALL_DIR="$HOME/.local/bin"
mkdir -p "$INSTALL_DIR"
fi
mv "${TMPDIR}/${BINARY}" "${INSTALL_DIR}/${BINARY}"
chmod +x "${INSTALL_DIR}/${BINARY}"
rm -rf "$TMPDIR"
echo ""
echo "Installed xmaster to ${INSTALL_DIR}/${BINARY}"
echo ""
# Check if in PATH
if ! command -v xmaster >/dev/null 2>&1; then
echo "Add to your PATH:"
echo " export PATH=\"${INSTALL_DIR}:\$PATH\""
echo ""
fi
echo "Get started:"
echo " xmaster --help"
echo " xmaster config check"
echo ""
echo "★ If xmaster saves you time, a GitHub star helps others find it:"
echo " https://github.com/paperfoot/xmaster-cli"
echo ""