-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·154 lines (131 loc) · 3.83 KB
/
install.sh
File metadata and controls
executable file
·154 lines (131 loc) · 3.83 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/usr/bin/env bash
# ccboard installer - Downloads and installs latest release binary
# Usage: curl -sSL https://raw.githubusercontent.com/FlorianBruniaux/ccboard/main/install.sh | bash
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Config
REPO="FlorianBruniaux/ccboard"
INSTALL_DIR="${INSTALL_DIR:-$HOME/.local/bin}"
# Detect OS and architecture
OS="$(uname -s)"
ARCH="$(uname -m)"
case "$OS" in
Linux*)
OS_TYPE="linux"
;;
Darwin*)
OS_TYPE="macos"
;;
MINGW*|MSYS*|CYGWIN*)
OS_TYPE="windows"
;;
*)
echo -e "${RED}Unsupported OS: $OS${NC}"
exit 1
;;
esac
case "$ARCH" in
x86_64|amd64)
ARCH_TYPE="x86_64"
;;
aarch64|arm64)
ARCH_TYPE="aarch64"
;;
*)
echo -e "${RED}Unsupported architecture: $ARCH${NC}"
exit 1
;;
esac
echo -e "${GREEN}ccboard installer${NC}"
echo "OS: $OS_TYPE"
echo "Architecture: $ARCH_TYPE"
echo "Install directory: $INSTALL_DIR"
echo ""
# Get latest release version
echo -e "${YELLOW}Fetching latest release...${NC}"
LATEST_VERSION=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
if [ -z "$LATEST_VERSION" ]; then
echo -e "${RED}Failed to fetch latest version${NC}"
exit 1
fi
echo "Latest version: v$LATEST_VERSION"
# Construct download URL
if [ "$OS_TYPE" = "windows" ]; then
ASSET_NAME="ccboard-windows-${ARCH_TYPE}.exe.zip"
BINARY_NAME="ccboard-windows-${ARCH_TYPE}.exe"
else
ASSET_NAME="ccboard-${OS_TYPE}-${ARCH_TYPE}.tar.gz"
BINARY_NAME="ccboard"
fi
DOWNLOAD_URL="https://github.com/$REPO/releases/download/v$LATEST_VERSION/$ASSET_NAME"
echo "Downloading: $DOWNLOAD_URL"
# Create temp directory
TMP_DIR=$(mktemp -d)
trap "rm -rf $TMP_DIR" EXIT
cd "$TMP_DIR"
# Download
if ! curl -sL "$DOWNLOAD_URL" -o "$ASSET_NAME"; then
echo -e "${RED}Failed to download $ASSET_NAME${NC}"
echo "URL: $DOWNLOAD_URL"
exit 1
fi
# Extract
echo -e "${YELLOW}Extracting...${NC}"
if [ "$OS_TYPE" = "windows" ]; then
unzip -q "$ASSET_NAME"
else
tar xzf "$ASSET_NAME"
fi
# Create install directory if needed
mkdir -p "$INSTALL_DIR"
# Install binary
echo -e "${YELLOW}Installing to $INSTALL_DIR...${NC}"
if [ "$OS_TYPE" = "windows" ]; then
mv "$BINARY_NAME" "$INSTALL_DIR/ccboard.exe"
INSTALLED_PATH="$INSTALL_DIR/ccboard.exe"
else
mv ccboard "$INSTALL_DIR/ccboard"
chmod +x "$INSTALL_DIR/ccboard"
INSTALLED_PATH="$INSTALL_DIR/ccboard"
fi
echo -e "${GREEN}✓ ccboard v$LATEST_VERSION installed successfully!${NC}"
echo ""
echo "Binary location: $INSTALLED_PATH"
echo ""
# Check if install dir is in PATH
if ! echo "$PATH" | grep -q "$INSTALL_DIR"; then
echo -e "${YELLOW}⚠ $INSTALL_DIR is not in your PATH${NC}"
echo ""
echo "Add it to your PATH by adding this line to your shell config:"
echo ""
if [ -n "$BASH_VERSION" ]; then
echo " echo 'export PATH=\"$INSTALL_DIR:\$PATH\"' >> ~/.bashrc"
echo " source ~/.bashrc"
elif [ -n "$ZSH_VERSION" ]; then
echo " echo 'export PATH=\"$INSTALL_DIR:\$PATH\"' >> ~/.zshrc"
echo " source ~/.zshrc"
else
echo " export PATH=\"$INSTALL_DIR:\$PATH\""
fi
echo ""
fi
# Verify installation
echo "Verifying installation..."
if command -v ccboard &> /dev/null; then
VERSION_OUTPUT=$(ccboard --version 2>&1 || true)
echo -e "${GREEN}✓ ccboard is ready to use${NC}"
echo "$VERSION_OUTPUT"
else
echo -e "${YELLOW}⚠ ccboard command not found in PATH${NC}"
echo "You may need to add $INSTALL_DIR to your PATH (see above)"
fi
echo ""
echo "Usage:"
echo " ccboard # Launch TUI"
echo " ccboard web # Launch web interface"
echo " ccboard stats # Print stats"
echo " ccboard --help # Show help"