Skip to content

Commit 55abe28

Browse files
committed
feat: Add install.sh to simplify installation
1 parent 3bf06e0 commit 55abe28

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

install.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
REPO="yusuf-musleh/mmar"
6+
BINARY="mmar"
7+
8+
echo "Installing $BINARY..."
9+
10+
# Detect OS
11+
OS="$(uname -s)"
12+
case "$OS" in
13+
Linux) OS_TITLE="Linux";;
14+
Darwin) OS_TITLE="Darwin";;
15+
*) echo "Unsupported OS: $OS"; exit 1;;
16+
esac
17+
18+
# Detect ARCH
19+
ARCH="$(uname -m)"
20+
case "$ARCH" in
21+
x86_64) ARCH_ID="x86_64";;
22+
i386) ARCH_ID="i386";;
23+
aarch64|arm64) ARCH_ID="arm64";;
24+
*) echo "Unsupported architecture: $ARCH"; exit 1;;
25+
esac
26+
27+
ASSET="${BINARY}_${OS_TITLE}_${ARCH_ID}.tar.gz"
28+
URL="https://github.com/$REPO/releases/latest/download/$ASSET"
29+
30+
# Temp dir
31+
TMP_DIR=$(mktemp -d)
32+
cd "$TMP_DIR"
33+
34+
echo "Downloading $ASSET..."
35+
curl -sSL "$URL" -o "$ASSET"
36+
37+
echo "Extracting..."
38+
tar -xzf "$ASSET"
39+
40+
# Install location
41+
INSTALL_DIR="/usr/local/bin"
42+
43+
# Ensure /usr/local/lib exists
44+
if [ ! -d "$INSTALL_DIR" ]; then
45+
sudo mkdir -p "$INSTALL_DIR"
46+
fi
47+
48+
echo "Installing to $INSTALL_DIR"
49+
sudo install -m 755 "$BINARY" "$INSTALL_DIR/$BINARY"
50+
51+
echo "$BINARY installed successfully to $INSTALL_DIR/$BINARY"
52+
"$BINARY" version || true

0 commit comments

Comments
 (0)