Skip to content

Commit d2251fb

Browse files
author
techartdev
committed
Add brew wrapper script and install sudo in Dockerfile; update version to 0.5.30
1 parent 2dec26b commit d2251fb

3 files changed

Lines changed: 33 additions & 6 deletions

File tree

openclaw_assistant/Dockerfile

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
2121
nginx \
2222
gnupg \
2323
build-essential \
24+
sudo \
2425
&& apt-get clean \
2526
&& rm -rf /var/lib/apt/lists/*
2627

@@ -51,21 +52,28 @@ RUN useradd -m -s /bin/bash linuxbrew \
5152
&& chown -R linuxbrew:linuxbrew /home/linuxbrew
5253

5354
USER linuxbrew
54-
RUN /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
55+
RUN /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" \
56+
&& cd /home/linuxbrew/.linuxbrew/Homebrew \
57+
&& git config --global --add safe.directory /home/linuxbrew/.linuxbrew/Homebrew \
58+
&& /home/linuxbrew/.linuxbrew/bin/brew update --force
5559
USER root
5660

57-
# Add Homebrew to PATH for all users
58-
ENV PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:${PATH}"
61+
# Add Homebrew to PATH for all users (wrapper comes first to intercept root calls)
62+
ENV PATH="/usr/local/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:${PATH}"
63+
64+
# Copy brew wrapper that allows root to run brew by delegating to linuxbrew user
65+
COPY brew-wrapper.sh /usr/local/bin/brew
66+
RUN chmod +x /usr/local/bin/brew
5967

6068
# Verify brew is available and install gcc (needed for compiling some brew packages)
6169
# Must run as linuxbrew user - Homebrew refuses to run as root
6270
USER linuxbrew
63-
RUN brew --version && brew install gcc
71+
RUN /home/linuxbrew/.linuxbrew/bin/brew --version && /home/linuxbrew/.linuxbrew/bin/brew install gcc
6472
USER root
6573

6674
# Install OpenClaw globally
6775
RUN npm config set fund false && npm config set audit false \
68-
&& npm install -g openclaw@2026.1.30
76+
&& npm install -g openclaw@2026.2.1
6977

7078
COPY run.sh /run.sh
7179
COPY oc_config_helper.py /oc_config_helper.py

openclaw_assistant/brew-wrapper.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
# Wrapper script for brew that runs as linuxbrew user when called by root
3+
# This is needed because Homebrew refuses to run as root
4+
5+
REAL_BREW="/home/linuxbrew/.linuxbrew/bin/brew"
6+
7+
if [ "$(id -u)" = "0" ]; then
8+
# Running as root - use sudo to run as linuxbrew user
9+
# Preserve necessary environment variables and properly pass all arguments
10+
exec sudo -u linuxbrew \
11+
HOMEBREW_NO_AUTO_UPDATE="${HOMEBREW_NO_AUTO_UPDATE:-1}" \
12+
HOMEBREW_NO_ANALYTICS="${HOMEBREW_NO_ANALYTICS:-1}" \
13+
HOME="/home/linuxbrew" \
14+
PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH" \
15+
"$REAL_BREW" "$@"
16+
else
17+
# Not root - run directly
18+
exec "$REAL_BREW" "$@"
19+
fi

openclaw_assistant/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: OpenClaw Assistant
2-
version: "0.5.29"
2+
version: "0.5.30"
33
slug: openclaw_assistant
44
description: Run OpenClaw Assistant (OpenClaw-compatible) as a Home Assistant add-on.
55
url: https://github.com/techartdev/OpenClawHomeAssistant

0 commit comments

Comments
 (0)