-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
Β·139 lines (122 loc) Β· 3.88 KB
/
install.sh
File metadata and controls
executable file
Β·139 lines (122 loc) Β· 3.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
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
#!/bin/bash
set -e
# Popcorn CLI Hackathon Installer (Unix/Linux/macOS)
# For Windows users: Use install.ps1 instead
echo "πΏ Installing Popcorn CLI for Hackathon (Unix/Linux/macOS)..."
# Check if we're on Windows
if [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]] || [[ "$OSTYPE" == "cygwin" ]]; then
echo "β οΈ Detected Windows environment"
echo "For native Windows, please use install.ps1 instead:"
echo " powershell -ExecutionPolicy Bypass -File install.ps1"
echo ""
echo "This script will continue assuming you're in a Unix-like environment (WSL/Git Bash/MSYS2)"
read -p "Continue? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 0
fi
fi
# Detect OS
OS=""
ARCH=""
BINARY_NAME=""
EXTENSION=""
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
OS="linux"
EXTENSION=".tar.gz"
BINARY_NAME="popcorn-cli"
elif [[ "$OSTYPE" == "darwin"* ]]; then
OS="macos"
EXTENSION=".tar.gz"
BINARY_NAME="popcorn-cli"
elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]] || [[ "$OSTYPE" == "cygwin" ]]; then
OS="windows"
EXTENSION=".zip"
BINARY_NAME="popcorn-cli.exe"
else
echo "β Unsupported operating system: $OSTYPE"
exit 1
fi
echo "β
Detected OS: $OS"
# Download URL
DOWNLOAD_URL="https://github.com/gpu-mode/popcorn-cli/releases/latest/download/popcorn-cli-${OS}${EXTENSION}"
TEMP_DIR="/tmp/popcorn-cli-install"
INSTALL_DIR="$HOME/.local/bin"
# Create directories
mkdir -p "$TEMP_DIR"
mkdir -p "$INSTALL_DIR"
echo "π₯ Downloading from: $DOWNLOAD_URL"
# Download the binary
if command -v curl >/dev/null 2>&1; then
curl -L -o "$TEMP_DIR/popcorn-cli${EXTENSION}" "$DOWNLOAD_URL"
elif command -v wget >/dev/null 2>&1; then
wget -O "$TEMP_DIR/popcorn-cli${EXTENSION}" "$DOWNLOAD_URL"
else
echo "β Neither curl nor wget found. Please install one of them."
exit 1
fi
echo "π¦ Extracting binary..."
# Extract the binary
cd "$TEMP_DIR"
if [[ "$EXTENSION" == ".tar.gz" ]]; then
tar -xzf "popcorn-cli${EXTENSION}"
elif [[ "$EXTENSION" == ".zip" ]]; then
unzip "popcorn-cli${EXTENSION}"
fi
# Find and move the binary
if [[ -f "$BINARY_NAME" ]]; then
chmod +x "$BINARY_NAME"
mv "$BINARY_NAME" "$INSTALL_DIR/"
echo "β
Binary installed to $INSTALL_DIR/$BINARY_NAME"
else
echo "β Binary not found after extraction"
exit 1
fi
# Add to PATH
SHELL_RC=""
if [[ -n "$ZSH_VERSION" ]]; then
SHELL_RC="$HOME/.zshrc"
elif [[ -n "$BASH_VERSION" ]]; then
SHELL_RC="$HOME/.bashrc"
else
# Try to detect shell
case "$SHELL" in
*/zsh)
SHELL_RC="$HOME/.zshrc"
;;
*/bash)
SHELL_RC="$HOME/.bashrc"
;;
*)
SHELL_RC="$HOME/.profile"
;;
esac
fi
# Check if PATH already contains the directory
if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
echo "π§ Adding $INSTALL_DIR to PATH in $SHELL_RC"
echo "" >> "$SHELL_RC"
echo "# Added by Popcorn CLI installer" >> "$SHELL_RC"
echo "export PATH=\"$INSTALL_DIR:\$PATH\"" >> "$SHELL_RC"
export PATH="$INSTALL_DIR:$PATH"
else
echo "β
$INSTALL_DIR already in PATH"
fi
# Cleanup
rm -rf "$TEMP_DIR"
echo ""
echo "π Popcorn CLI installed and ready for hackathon!"
echo ""
echo "π Quick Start:"
echo " 1. Restart your terminal or run: source $SHELL_RC"
echo " 2. Register with GitHub: popcorn-cli register github"
echo " 3. Submit your solution: popcorn-cli submit --gpu MI300 --leaderboard amd-fp8-mm --mode test <your-file>"
echo ""
echo "π Hackathon mode features:"
echo " - β
API URL pre-configured"
echo " - β
GitHub authentication (no Discord setup needed)"
echo " - β
All modes available: test, benchmark, leaderboard, profile"
echo " - β
Clean user identification"
echo ""
echo "π‘ Need help? Run: popcorn-cli --help"
echo "π Example: popcorn-cli submit --gpu MI300 --leaderboard amd-fp8-mm --mode test example.py"