forked from plumthedev/myrient-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
56 lines (43 loc) · 1.42 KB
/
install.sh
File metadata and controls
56 lines (43 loc) · 1.42 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
#!/usr/bin/env bash
set -e
REPO="plumthedev/myrient-cli"
BIN_NAME="myrient-cli"
INSTALL_DIR="${HOME}/.local/bin"
# Try sudo install if available
if command -v sudo >/dev/null && [ -w /usr/local/bin ]; then
INSTALL_DIR="/usr/local/bin"
fi
# Detect OS
OS="$(uname | tr '[:upper:]' '[:lower:]')"
ARCH="$(uname -m)"
case "$ARCH" in
x86_64) ARCH="amd64" ;;
arm64|aarch64) ARCH="arm64" ;;
armv7l|armv6l) ARCH="arm" ;;
*) echo "❌ Unsupported architecture: $ARCH"; exit 1 ;;
esac
EXT=""
if [[ "$OS" == "windows" || "$OS" == "mingw"* || "$OS" == "msys"* ]]; then
EXT=".exe"
fi
# Get latest version tag from GitHub API
LATEST=$(curl -s https://api.github.com/repos/$REPO/releases/latest | grep tag_name | cut -d '"' -f 4)
if [ -z "$LATEST" ]; then
echo "❌ Failed to fetch latest version info."
exit 1
fi
FILENAME="${BIN_NAME}-${OS}-${ARCH}${EXT}"
URL="https://github.com/${REPO}/releases/download/${LATEST}/${FILENAME}"
echo "⬇️ Downloading ${FILENAME} from ${URL}"
curl -L "$URL" -o "/tmp/${FILENAME}"
echo "📦 Installing to ${INSTALL_DIR}..."
mkdir -p "$INSTALL_DIR"
chmod +x "/tmp/${FILENAME}"
mv "/tmp/${FILENAME}" "${INSTALL_DIR}/myrient"
echo "✅ Installed 'myrient' to ${INSTALL_DIR}"
if ! echo "$PATH" | grep -q "$INSTALL_DIR"; then
echo "⚠️ $INSTALL_DIR is not in your PATH."
echo "👉 Add this line to your shell config:"
echo "export PATH=\"\$PATH:$INSTALL_DIR\""
fi
echo "🎉 Done! Run with: myrient"