Add install.sh for easy installation and recommend in README.md#384
Add install.sh for easy installation and recommend in README.md#384canercidam merged 2 commits intomainfrom
Conversation
|
Claude finished @canercidam's task in 1m 17s —— View job PR Review: Add install.sh for easy installation
Found 3 issues (1 critical bug, 1 bug, 1 improvement). Inline comments posted on the relevant lines. Critical: Bug: Improvement: Use a temp directory ( |
| fi | ||
| else | ||
| echo "Fetching latest release..." | ||
| TAG=$(curl -sSfL "$API" | grep -oP '"tag_name": "\K(.*)(?=")') |
There was a problem hiding this comment.
Bug: grep -oP uses Perl-compatible regex which is not available on macOS (BSD grep). This will fail on darwin even though the script explicitly supports it at line 11.
A portable alternative:
| TAG=$(curl -sSfL "$API" | grep -oP '"tag_name": "\K(.*)(?=")') | |
| TAG=$(curl -sSfL "$API" | grep '"tag_name"' | sed 's/.*"tag_name": *"\([^"]*\)".*/\1/') |
Or using awk:
TAG=$(curl -sSfL "$API" | awk -F'"' '/"tag_name"/{print $4}')
| curl -sSfL "$URL" -o "$ASSET" | ||
|
|
||
| echo "Extracting..." | ||
| unzip -o "$ASSET" |
There was a problem hiding this comment.
The script downloads and extracts into the user's current working directory. This can pollute the CWD with the zip and extracted binary, and will fail if the CWD is read-only. Consider using a temp directory:
TMP=$(mktemp -d)
trap 'rm -rf "$TMP"' EXIT
curl -sSfL "$URL" -o "$TMP/$ASSET"
unzip -o "$TMP/$ASSET" -d "$TMP"
chmod +x "$TMP/$BIN"
sudo mv "$TMP/$BIN" /usr/local/bin/Also, unzip is not guaranteed to be installed on all systems (e.g., minimal Docker images, some Linux distros). A check or fallback to jar / python3 -m zipfile would be more robust.
| If you need to install a specific version, you can use the `VERSION` env var in the beginning like: | ||
| ```bash | ||
| VERSION=1.2.3 curl -sSfL https://raw.githubusercontent.com/flashbots/builder-playground/main/install.sh | bash | ||
| ``` |
There was a problem hiding this comment.
Bug: VERSION=1.2.3 curl ... | bash sets VERSION as an environment variable only for the curl process, not for the bash process on the right side of the pipe. The script will never see VERSION.
Should be:
| ``` | |
| curl -sSfL https://raw.githubusercontent.com/flashbots/builder-playground/main/install.sh | VERSION=1.2.3 bash |
Or:
export VERSION=1.2.3 && curl -sSfL https://raw.githubusercontent.com/flashbots/builder-playground/main/install.sh | bash
This PR introduces a widely known type of installation script for builder-playground and rearranges the README.md for clarity.