-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·74 lines (63 loc) · 1.92 KB
/
install.sh
File metadata and controls
executable file
·74 lines (63 loc) · 1.92 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
#!/bin/bash
# SpringWell CLI installer
set -e
# Determine system type
SYSTEM=$(uname -s)
ARCH=$(uname -m)
# Translate architecture names
if [ "$ARCH" = "x86_64" ]; then
ARCH="amd64"
elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
ARCH="arm64"
else
echo "Unsupported architecture: $ARCH"
exit 1
fi
# Set platform-specific variables
case "$SYSTEM" in
"Linux")
PLATFORM="linux"
INSTALL_DIR="/usr/local/bin"
;;
"Darwin")
PLATFORM="darwin"
INSTALL_DIR="/usr/local/bin"
;;
*)
echo "Unsupported system: $SYSTEM"
exit 1
;;
esac
# Binary name
BINARY_NAME="springwell"
BINARY_PATH="$INSTALL_DIR/$BINARY_NAME"
# Print banner
echo "╔═══════════════════════════════════════════╗"
echo "║ SpringWell CLI Installer ║"
echo "╚═══════════════════════════════════════════╝"
echo
# Check if we have the binary already built
if [ -f "$BINARY_NAME" ]; then
echo "✓ Found local binary, installing..."
sudo cp "$BINARY_NAME" "$BINARY_PATH"
sudo chmod +x "$BINARY_PATH"
else
echo "Building SpringWell CLI from source..."
# Check if Go is installed
if ! command -v go &>/dev/null; then
echo "❌ Go is not installed. Please install Go first."
exit 1
fi
# Build the binary
echo "⚙️ Building for $PLATFORM-$ARCH..."
GOOS=$PLATFORM GOARCH=$ARCH go build -o "$BINARY_NAME" ./cmd/springwell
# Install the binary
echo "📦 Installing to $INSTALL_DIR..."
sudo cp "$BINARY_NAME" "$BINARY_PATH"
sudo chmod +x "$BINARY_PATH"
# Clean up
rm "$BINARY_NAME"
fi
echo
echo "🎉 Installation complete! SpringWell CLI is now available."
echo "Run 'springwell --help' to get started."