-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·94 lines (75 loc) · 2.35 KB
/
install.sh
File metadata and controls
executable file
·94 lines (75 loc) · 2.35 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/sh
# ModelsLab CLI installer
# Usage: curl -fsSL https://modelslab.sh/install.sh | sh
set -e
REPO="ModelsLab/modelslab-cli"
BINARY="modelslab"
# Detect OS and architecture
detect_platform() {
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case "$OS" in
darwin) OS="darwin" ;;
linux) OS="linux" ;;
mingw*|msys*|cygwin*) OS="windows" ;;
*) echo "Unsupported OS: $OS"; exit 1 ;;
esac
case "$ARCH" in
x86_64|amd64) ARCH="amd64" ;;
arm64|aarch64) ARCH="arm64" ;;
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
esac
}
# Get latest release version
get_latest_version() {
curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" | \
grep '"tag_name"' | sed 's/.*"v\(.*\)".*/\1/'
}
# Download and install
install() {
detect_platform
VERSION=$(get_latest_version)
if [ -z "$VERSION" ]; then
echo "Error: Could not determine latest version"
exit 1
fi
echo "Installing ${BINARY} v${VERSION} (${OS}/${ARCH})..."
EXT="tar.gz"
if [ "$OS" = "windows" ]; then
EXT="zip"
fi
URL="https://github.com/${REPO}/releases/download/v${VERSION}/${BINARY}_${VERSION}_${OS}_${ARCH}.${EXT}"
TMPDIR=$(mktemp -d)
trap "rm -rf $TMPDIR" EXIT
echo "Downloading from ${URL}..."
curl -fsSL "$URL" -o "${TMPDIR}/archive.${EXT}"
echo "Extracting..."
if [ "$EXT" = "tar.gz" ]; then
tar -xzf "${TMPDIR}/archive.${EXT}" -C "$TMPDIR"
else
unzip -q "${TMPDIR}/archive.${EXT}" -d "$TMPDIR"
fi
# Determine install location
INSTALL_DIR="/usr/local/bin"
if [ ! -w "$INSTALL_DIR" ]; then
INSTALL_DIR="$HOME/.local/bin"
mkdir -p "$INSTALL_DIR"
fi
mv "${TMPDIR}/${BINARY}" "${INSTALL_DIR}/${BINARY}"
chmod +x "${INSTALL_DIR}/${BINARY}"
echo ""
echo "✓ ${BINARY} v${VERSION} installed to ${INSTALL_DIR}/${BINARY}"
echo ""
# Check if in PATH
if ! command -v "$BINARY" >/dev/null 2>&1; then
echo "Note: ${INSTALL_DIR} is not in your PATH."
echo "Add it with:"
echo " export PATH=\"${INSTALL_DIR}:\$PATH\""
echo ""
fi
echo "Get started:"
echo " ${BINARY} auth login"
echo " ${BINARY} models search --search flux"
echo " ${BINARY} generate image --prompt \"sunset over mountains\""
}
install