-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
63 lines (53 loc) · 1.33 KB
/
Copy pathinstall.sh
File metadata and controls
63 lines (53 loc) · 1.33 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
#!/bin/sh
set -e
# Detect OS and Architecture
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
ARCH="$(uname -m)"
# Normalize ARCH
case "$ARCH" in
x86_64|amd64)
ARCH="amd64"
;;
arm64|aarch64)
ARCH="arm64"
;;
*)
echo "Unsupported architecture: $ARCH"
exit 1
;;
esac
# Normalize OS
case "$OS" in
darwin)
OS="darwin"
;;
linux)
OS="linux"
;;
*)
echo "Unsupported operating system: $OS"
exit 1
;;
esac
BINARY_NAME="mean-${OS}-${ARCH}"
DOWNLOAD_URL="https://github.com/mini-page/mean-cli/releases/latest/download/${BINARY_NAME}"
echo "Installing mean-cli..."
echo "Downloading from: ${DOWNLOAD_URL}"
# Create a temporary directory
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"' EXIT
# Download binary
curl -sSfL "$DOWNLOAD_URL" -o "$TMP_DIR/mean"
# Determine install directory (fallback to ~/.local/bin if /usr/local/bin is read-only)
INSTALL_DIR="/usr/local/bin"
if [ ! -w "$INSTALL_DIR" ]; then
INSTALL_DIR="$HOME/.local/bin"
mkdir -p "$INSTALL_DIR"
fi
# Move and make executable
mv "$TMP_DIR/mean" "$INSTALL_DIR/mean"
chmod +x "$INSTALL_DIR/mean"
echo ""
echo "✓ mean-cli successfully installed at: $INSTALL_DIR/mean"
echo " Run 'mean' to launch the TUI or check the CLI help with 'mean --help'."
echo ""