diff --git a/scripts/sandbox-common-setup.sh b/scripts/sandbox-common-setup.sh index cf4d2787e..c24d3b2dc 100755 --- a/scripts/sandbox-common-setup.sh +++ b/scripts/sandbox-common-setup.sh @@ -3,10 +3,12 @@ set -euo pipefail BASE_IMAGE="${BASE_IMAGE:-clawdis-sandbox:bookworm-slim}" TARGET_IMAGE="${TARGET_IMAGE:-clawdis-sandbox-common:bookworm-slim}" -PACKAGES="${PACKAGES:-curl wget jq coreutils grep nodejs npm python3 git ca-certificates golang-go rustc cargo unzip pkg-config libasound2-dev}" +PACKAGES="${PACKAGES:-curl wget jq coreutils grep nodejs npm python3 git ca-certificates golang-go rustc cargo unzip pkg-config libasound2-dev build-essential file}" INSTALL_PNPM="${INSTALL_PNPM:-1}" INSTALL_BUN="${INSTALL_BUN:-1}" BUN_INSTALL_DIR="${BUN_INSTALL_DIR:-/opt/bun}" +INSTALL_BREW="${INSTALL_BREW:-1}" +BREW_INSTALL_DIR="${BREW_INSTALL_DIR:-/home/linuxbrew/.linuxbrew}" if ! docker image inspect "${BASE_IMAGE}" >/dev/null 2>&1; then echo "Base image missing: ${BASE_IMAGE}" @@ -21,14 +23,21 @@ docker build \ --build-arg INSTALL_PNPM="${INSTALL_PNPM}" \ --build-arg INSTALL_BUN="${INSTALL_BUN}" \ --build-arg BUN_INSTALL_DIR="${BUN_INSTALL_DIR}" \ + --build-arg INSTALL_BREW="${INSTALL_BREW}" \ + --build-arg BREW_INSTALL_DIR="${BREW_INSTALL_DIR}" \ - </dev/null 2>&1; then useradd -m -s /bin/bash linuxbrew; fi; \\ + mkdir -p "\${BREW_INSTALL_DIR}"; \\ + chown -R linuxbrew:linuxbrew "\$(dirname "\${BREW_INSTALL_DIR}")"; \\ + su - linuxbrew -c "NONINTERACTIVE=1 CI=1 /bin/bash -c '\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)'"; \\ + if [ ! -e "\${BREW_INSTALL_DIR}/Library" ]; then ln -s "\${BREW_INSTALL_DIR}/Homebrew/Library" "\${BREW_INSTALL_DIR}/Library"; fi; \\ + if [ ! -x "\${BREW_INSTALL_DIR}/bin/brew" ]; then echo "brew install failed"; exit 1; fi; \\ + ln -sf "\${BREW_INSTALL_DIR}/bin/brew" /usr/local/bin/brew; \\ +fi EOF cat <