From 22c2c8902fc2cf1eff63be6263a4295dacf563fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Garc=C3=ADa?= <4411661+GarciaLnk@users.noreply.github.com> Date: Thu, 18 Dec 2025 16:01:01 +0100 Subject: [PATCH 1/4] fix: simplify brew PATH append after system's This restores compatibility with upstream changes in shellenv.sh that don't affect the PATH Credits: https://github.com/orgs/Homebrew/discussions/2560#discussioncomment-1716820 --- system_files/etc/profile.d/brew.sh | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/system_files/etc/profile.d/brew.sh b/system_files/etc/profile.d/brew.sh index f55f63c..fa08444 100755 --- a/system_files/etc/profile.d/brew.sh +++ b/system_files/etc/profile.d/brew.sh @@ -3,13 +3,6 @@ # Prioritize system binaries to prevent brew overriding things like dbus # See: https://github.com/ublue-os/brew/blob/54b30cc07d3211fca65ca5cc724e9812c8c79b77/system_files/usr/lib/systemd/system/brew-upgrade.service#L17-L22 if [[ -d /home/linuxbrew/.linuxbrew && $- == *i* ]] ; then - export HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew" - export HOMEBREW_CELLAR="/home/linuxbrew/.linuxbrew/Cellar" - export HOMEBREW_REPOSITORY="/home/linuxbrew/.linuxbrew/Homebrew" - [ -z "${MANPATH-}" ] || export MANPATH="${MANPATH#:}:" - export INFOPATH="${INFOPATH}:/home/linuxbrew/.linuxbrew/share/info" - export PATH="${PATH}:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" - if [ "$(basename $(readlink /proc/$$/exe))" == "zsh" ] ; then - fpath[1,0]="/home/linuxbrew/.linuxbrew/share/zsh/site-functions" - fi + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv | egrep -v '\bPATH=')" + export PATH="${PATH}:${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/sbin" fi From 72f27fa0dc81572d27a8483197bdcb88a56640e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Garc=C3=ADa?= <4411661+GarciaLnk@users.noreply.github.com> Date: Thu, 18 Dec 2025 16:06:18 +0100 Subject: [PATCH 2/4] chore: use `grep -E` instead of `egrep` --- system_files/etc/profile.d/brew.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system_files/etc/profile.d/brew.sh b/system_files/etc/profile.d/brew.sh index fa08444..4518d7c 100755 --- a/system_files/etc/profile.d/brew.sh +++ b/system_files/etc/profile.d/brew.sh @@ -3,6 +3,6 @@ # Prioritize system binaries to prevent brew overriding things like dbus # See: https://github.com/ublue-os/brew/blob/54b30cc07d3211fca65ca5cc724e9812c8c79b77/system_files/usr/lib/systemd/system/brew-upgrade.service#L17-L22 if [[ -d /home/linuxbrew/.linuxbrew && $- == *i* ]] ; then - eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv | egrep -v '\bPATH=')" + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv | grep -Ev '\bPATH=')" export PATH="${PATH}:${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/sbin" fi From 2b8dd0f3d60385ed30a8a08fffb57f12baf469c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Garc=C3=ADa?= <4411661+GarciaLnk@users.noreply.github.com> Date: Thu, 18 Dec 2025 16:09:37 +0100 Subject: [PATCH 3/4] chore: add `HOMEBREW_PREFIX` fallback --- system_files/etc/profile.d/brew.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/system_files/etc/profile.d/brew.sh b/system_files/etc/profile.d/brew.sh index 4518d7c..b485ca1 100755 --- a/system_files/etc/profile.d/brew.sh +++ b/system_files/etc/profile.d/brew.sh @@ -4,5 +4,6 @@ # See: https://github.com/ublue-os/brew/blob/54b30cc07d3211fca65ca5cc724e9812c8c79b77/system_files/usr/lib/systemd/system/brew-upgrade.service#L17-L22 if [[ -d /home/linuxbrew/.linuxbrew && $- == *i* ]] ; then eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv | grep -Ev '\bPATH=')" + HOMEBREW_PREFIX="${HOMEBREW_PREFIX:-/home/linuxbrew/.linuxbrew}" export PATH="${PATH}:${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/sbin" fi From bbb1ae8dc46be252c03b93ef826f4fb21b83d99e Mon Sep 17 00:00:00 2001 From: "Jorge O. Castro" Date: Thu, 18 Dec 2025 10:43:11 -0500 Subject: [PATCH 4/4] fix: remove advanced Homebrew installation example Ain't no one testing this, remove it to set expectations. --- README.md | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/README.md b/README.md index 9d5190d..f8ee8bd 100644 --- a/README.md +++ b/README.md @@ -35,26 +35,6 @@ On first boot, `brew-setup.service` will automatically: 2. Set up proper permissions 3. Make Homebrew ready to use -### Advanced Example with Pre-installed Packages - -If you want to pre-install Homebrew packages in your image: - -```dockerfile -# Copy Homebrew files -COPY --from=ghcr.io/ublue-os/brew:latest /system_files / - -# Install Homebrew packages during image build -RUN mkdir -p /var/home/linuxbrew && \ - tar --zstd -xvf /usr/share/homebrew.tar.zst -C /tmp && \ - mv /tmp/home/linuxbrew/.linuxbrew /var/home/linuxbrew/ && \ - eval "$(/var/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && \ - brew install gcc neovim ripgrep && \ - brew cleanup && \ - tar --zstd -cvf /usr/share/homebrew.tar.zst /var/home/linuxbrew/.linuxbrew && \ - rm -rf /var/home/linuxbrew/.linuxbrew /tmp/home -``` - - ## Systemd Services ### `brew-setup.service`