-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
42 lines (33 loc) · 1.05 KB
/
install.sh
File metadata and controls
42 lines (33 loc) · 1.05 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
#!/usr/bin/env bash
set -e
REPO="f24aalam/dbmcp"
VERSION=$(curl -s https://api.github.com/repos/$REPO/releases/latest | grep -o '"tag_name": *"[^"]*"' | cut -d'"' -f4)
INSTALL_DIR="${HOME}/.local/bin"
FALLBACK_DIR="/usr/local/bin"
OS="$(uname | tr '[:upper:]' '[:lower:]')"
ARCH="$(uname -m)"
case "$OS" in
linux|darwin) ;;
*) echo "Unsupported OS: $OS"; exit 1 ;;
esac
case "$ARCH" in
x86_64) ARCH="amd64" ;;
arm64|aarch64) ARCH="arm64" ;;
*) echo "Unsupported arch: $ARCH"; exit 1 ;;
esac
BINARY="dbmcp_${OS}_${ARCH}"
URL="https://github.com/$REPO/releases/download/$VERSION/$BINARY"
echo "📦 Installing dbmcp ($OS/$ARCH)"
echo "⬇️ $URL"
mkdir -p "$INSTALL_DIR"
echo "Downloading..."
curl -#L "$URL" -o "${INSTALL_DIR}/dbmcp"
chmod +x "${INSTALL_DIR}/dbmcp"
if [ -w "$FALLBACK_DIR" ] 2>/dev/null; then
mv "${INSTALL_DIR}/dbmcp" "${FALLBACK_DIR}/dbmcp"
echo "✅ Installed to ${FALLBACK_DIR}/dbmcp"
else
echo "✅ Installed to ${INSTALL_DIR}/dbmcp"
echo "Add to PATH: export PATH=\"\$PATH:${INSTALL_DIR}\""
fi
echo "Run: dbmcp --help"