Skip to content

Commit c62f36d

Browse files
committed
refactor: migrate Homebrew from RPM to systemd services
1 parent 36893d9 commit c62f36d

File tree

18 files changed

+193
-6
lines changed

18 files changed

+193
-6
lines changed

build_files/base/04-packages.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ copr_install_isolated "ublue-os/packages" \
122122
"bluefin-schemas" \
123123
"bluefin-fastfetch" \
124124
"ublue-bling" \
125-
"ublue-brew" \
126125
"ublue-fastfetch" \
127126
"ublue-motd" \
128127
"ublue-polkit-rules" \
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/bash
2+
3+
echo "::group:: ===$(basename "$0")==="
4+
5+
set -eoux pipefail
6+
7+
# Download official Homebrew install script
8+
echo "Downloading official Homebrew installer script..."
9+
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh \
10+
-o /usr/share/ublue-os/homebrew-install.sh
11+
12+
# Make script executable
13+
chmod +x /usr/share/ublue-os/homebrew-install.sh
14+
15+
# Verify the script was downloaded
16+
if [ -f /usr/share/ublue-os/homebrew-install.sh ]; then
17+
echo "Homebrew installer downloaded successfully"
18+
ls -lh /usr/share/ublue-os/homebrew-install.sh
19+
else
20+
echo "Error: Failed to download Homebrew installer"
21+
exit 1
22+
fi
23+
24+
echo "::endgroup::"

build_files/base/17-cleanup.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ systemctl enable tailscaled.service
1616
systemctl enable dconf-update.service
1717
systemctl enable ublue-guest-user.service
1818
systemctl --global enable bazaar.service
19-
systemctl enable brew-setup.service
20-
systemctl enable brew-upgrade.timer
21-
systemctl enable brew-update.timer
2219
systemctl enable ublue-fix-hostname.service
2320
systemctl enable ublue-system-setup.service
2421
systemctl --global enable ublue-user-setup.service

build_files/base/20-tests.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,42 @@ for unit in "${IMPORTANT_UNITS[@]}"; do
7777
fi
7878
done
7979

80+
# Test Homebrew installation files
81+
echo "Testing Homebrew installation files..."
82+
83+
# Test that the homebrew installer script exists and is executable
84+
test -f /usr/share/ublue-os/homebrew-install.sh || { echo "Missing homebrew installer script"; exit 1; }
85+
test -x /usr/share/ublue-os/homebrew-install.sh || { echo "Homebrew installer script is not executable"; exit 1; }
86+
87+
# Test that all systemd service files exist
88+
HOMEBREW_SYSTEMD_FILES=(
89+
/usr/lib/systemd/system/brew-setup.service
90+
/usr/lib/systemd/system/brew-update.service
91+
/usr/lib/systemd/system/brew-update.timer
92+
/usr/lib/systemd/system/brew-upgrade.service
93+
/usr/lib/systemd/system/brew-upgrade.timer
94+
/usr/lib/systemd/system-preset/01-homebrew.preset
95+
)
96+
97+
for file in "${HOMEBREW_SYSTEMD_FILES[@]}"; do
98+
test -f "$file" || { echo "Missing systemd file: ${file}"; exit 1; }
99+
done
100+
101+
# Test that shell integration files exist
102+
HOMEBREW_SHELL_FILES=(
103+
/etc/profile.d/brew.sh
104+
/etc/profile.d/brew-bash-completion.sh
105+
/usr/share/fish/vendor_conf.d/ublue-brew.fish
106+
)
107+
108+
for file in "${HOMEBREW_SHELL_FILES[@]}"; do
109+
test -f "$file" || { echo "Missing shell integration file: ${file}"; exit 1; }
110+
done
111+
112+
# Test that system configuration files exist
113+
test -f /usr/lib/tmpfiles.d/homebrew.conf || { echo "Missing tmpfiles.d/homebrew.conf"; exit 1; }
114+
test -f /etc/security/limits.d/30-brew-limits.conf || { echo "Missing limits.d/30-brew-limits.conf"; exit 1; }
115+
116+
echo "All Homebrew installation files present and valid"
117+
80118
echo "::endgroup::"

build_files/shared/build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ echo "::endgroup::"
3434
# Install Overrides and Fetch Install
3535
/ctx/build_files/base/05-override-install.sh
3636

37+
# Install Homebrew
38+
/ctx/build_files/base/06-install-homebrew.sh
39+
3740
# Build GNOME Extensions from Git Submodules
3841
/ctx/build_files/shared/build-gnome-extensions.sh
3942

iso_files/configure_iso_anaconda.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ sbkey='https://github.com/ublue-os/akmods/raw/main/certs/public_key.der'
1111
# Configure Live Environment
1212

1313
# Remove packages from liveCD to save space
14-
dnf remove -y ublue-brew ublue-motd || true
14+
dnf remove -y ublue-motd || true
1515

1616
# Setup dock
1717
tee /usr/share/glib-2.0/schemas/zz2-org.gnome.shell.gschema.override <<EOF

iso_files/configure_lts_iso_anaconda.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ IMAGE_REF="${IMAGE_REF##*://}"
1111
# Configure Live Environment
1212

1313
# Remove packages from liveCD to save space
14-
dnf remove -y google-noto-fonts-all ublue-brew ublue-motd yaru-theme || true
14+
dnf remove -y google-noto-fonts-all ublue-motd yaru-theme || true
1515

1616
# Setup dock
1717
tee /usr/share/glib-2.0/schemas/zz2-org.gnome.shell.gschema.override <<EOF
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/sh
2+
# shellcheck shell=sh disable=SC1091,SC2039,SC2166
3+
# Check for interactive bash and that we haven't already been sourced.
4+
if [ "x${BASH_VERSION-}" != x -a "x${PS1-}" != x -a "x${BREW_BASH_COMPLETION-}" = x ]; then
5+
6+
# Check for recent enough version of bash.
7+
if [ "${BASH_VERSINFO[0]}" -gt 4 ] ||
8+
[ "${BASH_VERSINFO[0]}" -eq 4 -a "${BASH_VERSINFO[1]}" -ge 2 ]; then
9+
if [ -w /home/linuxbrew/.linuxbrew ]; then
10+
if ! test -L /home/linuxbrew/.linuxbrew/etc/bash_completion.d/brew; then
11+
/home/linuxbrew/.linuxbrew/bin/brew completions link > /dev/null
12+
fi
13+
fi
14+
if test -d /home/linuxbrew/.linuxbrew/etc/bash_completion.d; then
15+
for rc in /home/linuxbrew/.linuxbrew/etc/bash_completion.d/*; do
16+
if test -r "$rc"; then
17+
. "$rc"
18+
fi
19+
done
20+
unset rc
21+
fi
22+
fi
23+
BREW_BASH_COMPLETION=1
24+
export BREW_BASH_COMPLETION
25+
fi
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
[[ -d /home/linuxbrew/.linuxbrew && $- == *i* ]] && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#This file sets the resource limits for the users logged in via PAM,
2+
#more specifically, users logged in on via SSH or tty (console).
3+
#Limits related to terminals in Wayland/Xorg sessions depend on a
4+
#change to /etc/systemd/user.conf.
5+
#This does not affect resource limits of the system services.
6+
#This file overrides defaults set in /etc/security/limits.conf
7+
8+
* soft nofile 4096
9+
root soft nofile 4096

0 commit comments

Comments
 (0)