diff --git a/docs/contribute/locally.md b/docs/contribute/locally.md index 09d491bbb..be8e7aadb 100644 --- a/docs/contribute/locally.md +++ b/docs/contribute/locally.md @@ -40,6 +40,8 @@ This guide uses the first option. If you'd like to clone the repository and buil This downloads the latest binary, makes it executable, and installs it to your user PATH. + To download and install the binary file manually, refer to [Releases](https://github.com/elastic/docs-builder/releases) on GitHub. + 2. **Run docs-builder from a docs folder** Use the `serve` command from any docs folder to start serving the documentation at http://localhost:3000. The path to the `docset.yml` file that you want to build can be specified with `-p`: @@ -66,6 +68,8 @@ If you get a `Permission denied` error, make sure that you aren't trying to run This downloads the latest binary, makes it executable, and installs it to your user PATH. + To download and install the binary file manually, refer to [Releases](https://github.com/elastic/docs-builder/releases) on GitHub. + 2. **Run docs-builder from a docs folder** Use the `serve` command from any docs folder to start serving the documentation at http://localhost:3000. The path to the `docset.yml` file that you want to build can be specified with `-p`: @@ -73,9 +77,7 @@ If you get a `Permission denied` error, make sure that you aren't trying to run ```sh docs-builder serve ``` - -To download and install the binary file manually, refer to [Releases](https://github.com/elastic/docs-builder/releases) on GitHub. - + ::: :::: diff --git a/install.sh b/install.sh index 544b67ab5..163ce3279 100755 --- a/install.sh +++ b/install.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e +set -euo pipefail # Determine OS type and architecture OS=$(uname -s | tr '[:upper:]' '[:lower:]') @@ -56,11 +56,22 @@ fi echo "Downloading docs-builder for $OS/$ARCH..." # Download the appropriate binary -curl -LO "https://github.com/elastic/docs-builder/releases/latest/download/$BINARY" +if ! curl -LO "https://github.com/elastic/docs-builder/releases/latest/download/$BINARY"; then + echo "Error: Failed to download $BINARY. Please check your internet connection." + exit 1 +fi + +# Validate the downloaded file +if [ ! -s "$BINARY" ]; then + echo "Error: Downloaded file $BINARY is missing or empty." + exit 1 +fi # Extract only the docs-builder file to /tmp directory -# Use -o flag to always overwrite files without prompting -unzip -j -o "$BINARY" docs-builder -d /tmp +if ! unzip -j -o "$BINARY" docs-builder -d /tmp; then + echo "Error: Failed to extract docs-builder from $BINARY." + exit 1 +fi # Ensure the binary is executable chmod +x /tmp/docs-builder