-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
86 lines (66 loc) · 1.88 KB
/
install.sh
File metadata and controls
86 lines (66 loc) · 1.88 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
#!/bin/bash
set -e # Exit on error
# Print colored output
info() {
printf "\033[36m%s\033[0m\n" "$1"
}
success() {
printf "\033[32m%s\033[0m\n" "$1"
}
error() {
printf "\033[31m%s\033[0m\n" "$1"
exit 1
}
# Detect OS and architecture
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
# Verify supported platform
if [ "$OS" != "darwin" ]; then
error "❌ This installer only supports macOS currently"
fi
# Detect architecture
if [ "$ARCH" != "arm64" ] && [ "$ARCH" != "x86_64" ]; then
error "❌ Unsupported architecture $ARCH"
fi
# Set install location
INSTALL_DIR="/usr/local/bin"
BINARY_NAME="gyst"
BINARY_PATH="$INSTALL_DIR/$BINARY_NAME"
# Create install directory if needed
if [ ! -d "$INSTALL_DIR" ]; then
info "📁 Creating install directory..."
sudo mkdir -p "$INSTALL_DIR"
fi
# Set binary name based on architecture
BINARY="gyst-darwin-${ARCH}"
# GitHub repository information
REPO="created-by-varun/gyst"
LATEST_RELEASE_TAG="v0.1.2"
# Download URLs
BINARY_URL="https://github.com/$REPO/releases/download/$LATEST_RELEASE_TAG/$BINARY"
CHECKSUM_URL="https://github.com/$REPO/releases/download/$LATEST_RELEASE_TAG/$BINARY.sha256"
# Create temporary directory
TMP_DIR=$(mktemp -d)
cd "$TMP_DIR"
info "⚡ Downloading gyst..."
# Download binary and checksum
curl -fsSL "$BINARY_URL" -o "$BINARY"
curl -fsSL "$CHECKSUM_URL" -o "$BINARY.sha256"
# Verify checksum
info "🔒 Verifying checksum..."
shasum -a 256 -c "$BINARY.sha256"
# Make binary executable
chmod +x "$BINARY"
# Move binary to /usr/local/bin
info "📦 Installing gyst..."
sudo mv "$BINARY" "$BINARY_PATH"
# Clean up
cd - > /dev/null
rm -rf "$TMP_DIR"
# Verify installation
if command -v gyst >/dev/null; then
success "✨ gyst has been installed successfully!"
info "💡 Run 'gyst --help' to get started"
else
error "❌ Installation failed. Please try again or report the issue."
fi