Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ curl -fsSL https://raw.githubusercontent.com/gpu-mode/popcorn-cli/main/install.s
powershell -ExecutionPolicy Bypass -Command "iwr -UseBasicParsing https://raw.githubusercontent.com/gpu-mode/popcorn-cli/main/install.ps1 | iex"
```

After installation, restart your terminal (or run `source ~/.bashrc` / `source ~/.zshrc`).
After installation, restart your terminal (or run `source ~/.bashrc` / `source ~/.zshrc` / `source ~/.config/fish/config.fish`).
The release binary is named `popcorn-cli`; the one-line installers also add a
`popcorn` alias, and the examples below use that shorter command.

Expand Down Expand Up @@ -90,8 +90,9 @@ tag.

**Command not found after installation:**
- Restart your terminal
- Check if the install directory is in your PATH:
- Linux/macOS: `echo $PATH`
- Check if `~/.local/bin` is in your PATH (`echo $PATH`)
- fish: `fish_add_path ~/.local/bin` (the installer writes this to `~/.config/fish/config.fish`)
- bash/zsh: `export PATH="$HOME/.local/bin:$PATH"`
- Windows: `echo $env:PATH`
- Check if POPCORN_API_URL is set to https://site--bot--dxfjds728w5v.code.run
- Linux/macOS: `echo $POPCORN_API_URL`
Expand Down
2 changes: 1 addition & 1 deletion docs/AMD_workshop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ powershell -ExecutionPolicy Bypass -Command "iwr -UseBasicParsing https://raw.gi

## 📋 Quick Start After Installation

1. **Restart your terminal** (or run `source ~/.bashrc` / `source ~/.zshrc`)
1. **Restart your terminal** (or run `source ~/.bashrc` / `source ~/.zshrc` / `source ~/.config/fish/config.fish`)

2. **Register with GitHub** (one-time setup):
```bash
Expand Down
91 changes: 65 additions & 26 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,36 +104,75 @@ else
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"
# Add ~/.local/bin to the user's login-shell PATH.
#
# This installer is almost always invoked as `curl | bash`, so BASH_VERSION is
# set even when the user actually uses fish/zsh/nushell. Detect the login
# shell from $SHELL instead, write the matching rc snippet, and skip if the
# rc file already references INSTALL_DIR (re-running used to duplicate lines).
CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
login_shell_name="$(basename "${SHELL:-/bin/sh}")"

case "$login_shell_name" in
zsh)
SHELL_RC="$HOME/.zshrc"
PATH_SNIPPET="export PATH=\"$INSTALL_DIR:\$PATH\""
RELOAD_HINT="source $SHELL_RC"
;;
bash)
SHELL_RC="$HOME/.bashrc"
PATH_SNIPPET="export PATH=\"$INSTALL_DIR:\$PATH\""
RELOAD_HINT="source $SHELL_RC"
;;
fish)
SHELL_RC="$CONFIG_HOME/fish/config.fish"
PATH_SNIPPET="fish_add_path \"$INSTALL_DIR\""
RELOAD_HINT="source $SHELL_RC"
;;
nu|nushell)
SHELL_RC="$CONFIG_HOME/nushell/env.nu"
PATH_SNIPPET="\$env.PATH = (\$env.PATH | prepend \"$INSTALL_DIR\")"
RELOAD_HINT="restart your terminal"
;;
tcsh)
SHELL_RC="$HOME/.tcshrc"
PATH_SNIPPET="setenv PATH $INSTALL_DIR:\$PATH"
RELOAD_HINT="source $SHELL_RC"
;;
csh)
SHELL_RC="$HOME/.cshrc"
PATH_SNIPPET="setenv PATH $INSTALL_DIR:\$PATH"
RELOAD_HINT="source $SHELL_RC"
;;
ksh|mksh|ksh93)
SHELL_RC="$HOME/.kshrc"
PATH_SNIPPET="export PATH=\"$INSTALL_DIR:\$PATH\""
RELOAD_HINT="source $SHELL_RC"
;;
*)
SHELL_RC="$HOME/.profile"
PATH_SNIPPET="export PATH=\"$INSTALL_DIR:\$PATH\""
RELOAD_HINT="source $SHELL_RC"
;;
esac

echo "🐚 Login shell: $login_shell_name (from \$SHELL)"

if [[ -f "$SHELL_RC" ]] && grep -F -q "$INSTALL_DIR" "$SHELL_RC"; then
echo "✅ $INSTALL_DIR already configured in $SHELL_RC"
else
# Try to detect shell
case "$SHELL" in
*/zsh)
SHELL_RC="$HOME/.zshrc"
;;
*/bash)
SHELL_RC="$HOME/.bashrc"
;;
*)
SHELL_RC="$HOME/.profile"
;;
esac
echo "🔧 Adding $INSTALL_DIR to PATH in $SHELL_RC"
mkdir -p "$(dirname "$SHELL_RC")"
{
echo ""
echo "# Added by Popcorn CLI installer"
echo "$PATH_SNIPPET"
} >> "$SHELL_RC"
fi

# Check if PATH already contains the directory
# Available inside this installer process; the parent shell still needs a reload.
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
Expand All @@ -143,7 +182,7 @@ echo ""
echo "🎉 Popcorn CLI installed and ready for hackathon!"
echo ""
echo "📋 Quick Start:"
echo " 1. Restart your terminal or run: source $SHELL_RC"
echo " 1. Restart your terminal or run: $RELOAD_HINT"
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 ""
Expand Down