Add brew wrapper script and install sudo in Dockerfile; update version to 0.5.30

This commit is contained in:
techartdev
2026-02-03 10:19:42 +02:00
parent 2dec26b243
commit d2251fb4d8
3 changed files with 33 additions and 6 deletions
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Wrapper script for brew that runs as linuxbrew user when called by root
# This is needed because Homebrew refuses to run as root
REAL_BREW="/home/linuxbrew/.linuxbrew/bin/brew"
if [ "$(id -u)" = "0" ]; then
# Running as root - use sudo to run as linuxbrew user
# Preserve necessary environment variables and properly pass all arguments
exec sudo -u linuxbrew \
HOMEBREW_NO_AUTO_UPDATE="${HOMEBREW_NO_AUTO_UPDATE:-1}" \
HOMEBREW_NO_ANALYTICS="${HOMEBREW_NO_ANALYTICS:-1}" \
HOME="/home/linuxbrew" \
PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH" \
"$REAL_BREW" "$@"
else
# Not root - run directly
exec "$REAL_BREW" "$@"
fi