From b7db5fc71bd5ad9bdc73fac87fabc0cc30c1aef1 Mon Sep 17 00:00:00 2001 From: m2Giles <69128853+m2Giles@users.noreply.github.com> Date: Sun, 12 May 2024 19:12:02 +0000 Subject: [PATCH 01/18] feat: homebrew on image --- Containerfile | 8 +++++--- .../lib/systemd/system/cleanup-homebrew.service | 16 ++++++++++++++++ .../lib/systemd/system/var-home-linuxbrew.mount | 16 ++++++++++++++++ .../shared/usr/lib/tmpfiles.d/homebrew.conf | 3 +++ 4 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 system_files/shared/usr/lib/systemd/system/cleanup-homebrew.service create mode 100644 system_files/shared/usr/lib/systemd/system/var-home-linuxbrew.mount create mode 100644 system_files/shared/usr/lib/tmpfiles.d/homebrew.conf diff --git a/Containerfile b/Containerfile index 980d91cc226..9a756235ce3 100644 --- a/Containerfile +++ b/Containerfile @@ -6,11 +6,12 @@ ARG BASE_IMAGE="ghcr.io/ublue-os/${SOURCE_IMAGE}" ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-40}" ARG TARGET_BASE="${TARGET_BASE:-bluefin}" -# KMODs +# FROM's for copying ARG KMOD_SOURCE_COMMON="ghcr.io/ublue-os/akmods:${AKMODS_FLAVOR}-${FEDORA_MAJOR_VERSION}" ARG KMOD_SOURCE_EXTRA="ghcr.io/ublue-os/akmods-extra:${AKMODS_FLAVOR}-${FEDORA_MAJOR_VERSION}" FROM ${KMOD_SOURCE_COMMON} as akmod-common FROM ${KMOD_SOURCE_EXTRA} as akmod-extra +FROM ghcr.io/ublue-os/bluefin-cli as bluefin-cli ## bluefin image section FROM ${BASE_IMAGE}:${FEDORA_MAJOR_VERSION} AS base @@ -31,8 +32,9 @@ COPY packages.json /tmp/packages.json # Copy ublue-update.toml to tmp first, to avoid being overwritten. COPY /system_files/shared/usr/etc/ublue-update/ublue-update.toml /tmp/ublue-update.toml # Copy Bluefin CLI packages -COPY --from=ghcr.io/ublue-os/bluefin-cli /usr/bin/atuin /usr/bin/atuin -COPY --from=ghcr.io/ublue-os/bluefin-cli /usr/share/bash-prexec /usr/share/bash-prexec +COPY --from=bluefin-cli /usr/bin/atuin /usr/bin/atuin +COPY --from=bluefin-cli /usr/share/bash-prexec /usr/share/bash-prexec +COPY --from=bluefin-cli /home/homebrew /usr/share/homebrew # COPY ublue kmods, add needed negativo17 repo and then immediately disable due to incompatibility with RPMFusion COPY --from=akmod-common /rpms /tmp/akmods-rpms diff --git a/system_files/shared/usr/lib/systemd/system/cleanup-homebrew.service b/system_files/shared/usr/lib/systemd/system/cleanup-homebrew.service new file mode 100644 index 00000000000..94a34db3abb --- /dev/null +++ b/system_files/shared/usr/lib/systemd/system/cleanup-homebrew.service @@ -0,0 +1,16 @@ +[Unit] +Description=Cleanup Homebrew workdir +After=var.mount +Before=var-home-linuxbrew.mount +ConditionPathIsDirectory=%C/homebrew + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=-/usr/bin/rm -rf %C/homebrew/.* +ExecStart=-/usr/bin/rm -rf %C/homebrew/* +ExecStop=-/usr/bin/rm -rf %C/homebrew/.* +ExecStop=-/usr/bin/rm -rf %C/homebrew/* + +[Install] +WantedBy=default.target multi-user.target \ No newline at end of file diff --git a/system_files/shared/usr/lib/systemd/system/var-home-linuxbrew.mount b/system_files/shared/usr/lib/systemd/system/var-home-linuxbrew.mount new file mode 100644 index 00000000000..3b3f6847e02 --- /dev/null +++ b/system_files/shared/usr/lib/systemd/system/var-home-linuxbrew.mount @@ -0,0 +1,16 @@ +[Unit] +Description=Homebrew overlay mount +Wants=cleanup-homebrew.service +After=cleanup-homebrew.service +After=var-mount.mount +ConditionPathIsDirectory=%S/homebrew +ConditionPathIsDirectory=%C/homebrew + +[Mount] +Type=overlay +What=overlay +Options=lowerdir=/usr/share/homebrew,upperdir=%S/homebrew,workdir=%C/homebrew +Where=/var/home/linuxbrew + +[Install] +WantedBy=local-fs.target diff --git a/system_files/shared/usr/lib/tmpfiles.d/homebrew.conf b/system_files/shared/usr/lib/tmpfiles.d/homebrew.conf new file mode 100644 index 00000000000..92cd2fd8a66 --- /dev/null +++ b/system_files/shared/usr/lib/tmpfiles.d/homebrew.conf @@ -0,0 +1,3 @@ +d /var/lib/homebrew 0755 1000 1000 - - +d /var/cache/homebrew 0755 1000 1000 - - +d /var/home/linuxbrew 0755 1000 1000 - - From 4496b90db86e80ec3ac15277e72248a0982d78b9 Mon Sep 17 00:00:00 2001 From: m2Giles <69128853+m2Giles@users.noreply.github.com> Date: Mon, 13 May 2024 10:18:20 -0400 Subject: [PATCH 02/18] chore: use brew install script --- Containerfile | 2 +- build_files/base/brew.sh | 23 +++++++++++++++++++ build_files/base/build-base.sh | 1 + .../systemd/system/var-home-linuxbrew.mount | 1 + 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 build_files/base/brew.sh diff --git a/Containerfile b/Containerfile index 2d466608990..f4c02dad8d0 100644 --- a/Containerfile +++ b/Containerfile @@ -32,7 +32,7 @@ COPY /system_files/shared/usr/etc/ublue-update/ublue-update.toml /tmp/ublue-upda # Copy Bluefin CLI packages COPY --from=bluefin-cli /usr/bin/atuin /usr/bin/atuin COPY --from=bluefin-cli /usr/share/bash-prexec /usr/share/bash-prexec -COPY --from=bluefin-cli /home/homebrew /usr/share/homebrew +# COPY --from=bluefin-cli /home/homebrew /usr/share/homebrew # COPY ublue kmods, add needed negativo17 repo and then immediately disable due to incompatibility with RPMFusion COPY --from=akmods /rpms /tmp/akmods-rpms diff --git a/build_files/base/brew.sh b/build_files/base/brew.sh new file mode 100644 index 00000000000..abccb585616 --- /dev/null +++ b/build_files/base/brew.sh @@ -0,0 +1,23 @@ +#!/usr/bin/bash + +set -xeou pipefail + +curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh > /tmp/brew.sh +chmod +x /tmp/brew.sh + +# Convince the installer we are in CI +if [[ ! -f /.dockerenv ]]; then + touch /.dockerenv +fi + +# Make these so script will work +mkdir -p /var/home +mkdir -p /var/roothome + +# Install brew, Get portable Ruby +/tmp/brew.sh +/home/linuxbrew/.linuxbrew/bin/brew update + +# Copy to image and own by UID 1000 +cp -R /home/linuxbrew /usr/share/homebrew +chown -R 1000:1000 /usr/share/homebrew \ No newline at end of file diff --git a/build_files/base/build-base.sh b/build_files/base/build-base.sh index 17ec29c4481..d81399d7b67 100644 --- a/build_files/base/build-base.sh +++ b/build_files/base/build-base.sh @@ -9,6 +9,7 @@ set -ouex pipefail . /tmp/build/nvidia.sh . /tmp/build/image-info.sh . /tmp/build/fetch-install.sh +. /tmp/build/brew.sh . /tmp/build/fetch-quadlets.sh . /tmp/build/font-install.sh . /tmp/build/systemd.sh diff --git a/system_files/shared/usr/lib/systemd/system/var-home-linuxbrew.mount b/system_files/shared/usr/lib/systemd/system/var-home-linuxbrew.mount index 3b3f6847e02..bd10ff01821 100644 --- a/system_files/shared/usr/lib/systemd/system/var-home-linuxbrew.mount +++ b/system_files/shared/usr/lib/systemd/system/var-home-linuxbrew.mount @@ -5,6 +5,7 @@ After=cleanup-homebrew.service After=var-mount.mount ConditionPathIsDirectory=%S/homebrew ConditionPathIsDirectory=%C/homebrew +ConditionPathExists=!/var/home/linuxbrew/.linuxbrew [Mount] Type=overlay From 34d3d8457c53fd67ae3ea7cca52c36c3359135db Mon Sep 17 00:00:00 2001 From: m2Giles <69128853+m2Giles@users.noreply.github.com> Date: Mon, 13 May 2024 11:20:05 -0400 Subject: [PATCH 03/18] feat: auto update/upgrade for brew --- .github/workflows/reusable-build.yml | 11 +++++++++++ .../shared/usr/etc/profile.d/brew-on-image.sh | 6 ++++++ system_files/shared/usr/etc/profile.d/brew.sh | 1 + .../lib/systemd/system-preset/01-homebrew.preset | 3 +++ .../usr/lib/systemd/system/brew-update.service | 12 ++++++++++++ .../usr/lib/systemd/system/brew-update.timer | 14 ++++++++++++++ .../usr/lib/systemd/system/brew-upgade.timer | 13 +++++++++++++ .../usr/lib/systemd/system/brew-upgrade.service | 12 ++++++++++++ .../shared/usr/share/fish/vendor_conf.d/brew.fish | 8 +++++++- 9 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 system_files/shared/usr/etc/profile.d/brew-on-image.sh create mode 100644 system_files/shared/usr/lib/systemd/system-preset/01-homebrew.preset create mode 100644 system_files/shared/usr/lib/systemd/system/brew-update.service create mode 100644 system_files/shared/usr/lib/systemd/system/brew-update.timer create mode 100644 system_files/shared/usr/lib/systemd/system/brew-upgade.timer create mode 100644 system_files/shared/usr/lib/systemd/system/brew-upgrade.service diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index fa23fa41363..e5732e805d4 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -101,6 +101,17 @@ jobs: - name: Check just syntax uses: ublue-os/just-action@v1 + + - name: Update podman + run: | + # from https://askubuntu.com/questions/1414446/whats-the-recommended-way-of-installing-podman-4-in-ubuntu-22-04 + ubuntu_version='22.04' + key_url="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key" + sources_url="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}" + echo "deb $sources_url/ /" | sudo tee /etc/apt/sources.list.d/devel-kubic-libcontainers-unstable.list + curl -fsSL $key_url | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_kubic_libcontainers_unstable.gpg > /dev/null + sudo apt update + sudo apt install -y podman - name: Generate tags id: generate-tags diff --git a/system_files/shared/usr/etc/profile.d/brew-on-image.sh b/system_files/shared/usr/etc/profile.d/brew-on-image.sh new file mode 100644 index 00000000000..1fd3ad6fc9e --- /dev/null +++ b/system_files/shared/usr/etc/profile.d/brew-on-image.sh @@ -0,0 +1,6 @@ +#!/usr/bin/bash + +if systemctl --quiet is-active var-home-linuxbrew.mount; then + HOMEBREW_NO_AUTO_UPDATE=1 + export HOMEBREW_NO_AUTO_UPDATE +fi \ No newline at end of file diff --git a/system_files/shared/usr/etc/profile.d/brew.sh b/system_files/shared/usr/etc/profile.d/brew.sh index 33726e5c43e..c49ba9bc4dd 100644 --- a/system_files/shared/usr/etc/profile.d/brew.sh +++ b/system_files/shared/usr/etc/profile.d/brew.sh @@ -1 +1,2 @@ +#!/usr/bin/bash [[ -d /home/linuxbrew/.linuxbrew && $- == *i* ]] && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" \ No newline at end of file diff --git a/system_files/shared/usr/lib/systemd/system-preset/01-homebrew.preset b/system_files/shared/usr/lib/systemd/system-preset/01-homebrew.preset new file mode 100644 index 00000000000..5671b75d935 --- /dev/null +++ b/system_files/shared/usr/lib/systemd/system-preset/01-homebrew.preset @@ -0,0 +1,3 @@ +enable var-home-linuxbrew.mount +enable brew-update.timer +enable brew-upgrade.timer \ No newline at end of file diff --git a/system_files/shared/usr/lib/systemd/system/brew-update.service b/system_files/shared/usr/lib/systemd/system/brew-update.service new file mode 100644 index 00000000000..06d7bff1954 --- /dev/null +++ b/system_files/shared/usr/lib/systemd/system/brew-update.service @@ -0,0 +1,12 @@ +[Unit] +Description=Auto update brew for mutable brew installs +After=local-fs.target +ConditionPathIsMountPoint=!/var/home/linuxbrew +ConditionPathExists=/home/linuxbrew/.linuxbrew/bin/brew + +[Service] +# Override the user if different UID/User +User=1000 +Type=oneshot +ExecStart=/home/linuxbrew/.linuxbrew/bin/brew update +StandardOutput=journal diff --git a/system_files/shared/usr/lib/systemd/system/brew-update.timer b/system_files/shared/usr/lib/systemd/system/brew-update.timer new file mode 100644 index 00000000000..025ccc6c2f6 --- /dev/null +++ b/system_files/shared/usr/lib/systemd/system/brew-update.timer @@ -0,0 +1,14 @@ +[Unit] +Description=Timer for brew update for mutable brew +Wants=network-online.target +After=local-fs.target +ConditionPathIsMountPoint=!/var/home/linuxbrew +ConditionPathExists=/home/linuxbrew/.linuxbrew/bin/brew + +[Timer] +OnBootSec=20min +OnUnitInactiveSec=6h +Persistent=true + +[Install] +WantedBy=timers.target \ No newline at end of file diff --git a/system_files/shared/usr/lib/systemd/system/brew-upgade.timer b/system_files/shared/usr/lib/systemd/system/brew-upgade.timer new file mode 100644 index 00000000000..336a4b4521c --- /dev/null +++ b/system_files/shared/usr/lib/systemd/system/brew-upgade.timer @@ -0,0 +1,13 @@ +[Unit] +Description=Timer for brew upgrade for on image brew +Wants=network-online.target +After=local-fs.target +ConditionPathExists=/home/linuxbrew/.linuxbrew/bin/brew + +[Timer] +OnBootSec=20min +OnUnitInactiveSec=6h +Persistent=true + +[Install] +WantedBy=timers.target diff --git a/system_files/shared/usr/lib/systemd/system/brew-upgrade.service b/system_files/shared/usr/lib/systemd/system/brew-upgrade.service new file mode 100644 index 00000000000..21d0b2e8f87 --- /dev/null +++ b/system_files/shared/usr/lib/systemd/system/brew-upgrade.service @@ -0,0 +1,12 @@ +[Unit] +Description=Upgrade Brew packages +After=local-fs.target +ConditionPathExists=/home/linuxbrew/.linuxbrew/bin/brew + +[Service] +# Override the user if different UID/User +User=1000 +Type=oneshot +Environment=HOMEBREW_NO_AUTO_UPDATE=1 +ExecStart=/home/linuxbrew/.linuxbrew/bin/brew upgrade +StandardOutput=journal diff --git a/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish b/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish index 19123959406..8e0389438c4 100644 --- a/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish +++ b/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish @@ -1 +1,7 @@ -[ -d /home/linuxbrew/.linuxbrew ] && status --is-interactive && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" \ No newline at end of file +#!/usr/bin/fish +if status --is-interactive + [ -d /home/linuxbrew/.linuxbrew ] && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" + if systemctl --quiet is-active var-home-linuxbrew.mount + set -x HOMEBREW_NO_AUTO_UPDATE 1 + end +end \ No newline at end of file From 268b206059efbf1b3f3fe6ada4edac9de5a742fc Mon Sep 17 00:00:00 2001 From: m2Giles <69128853+m2Giles@users.noreply.github.com> Date: Mon, 13 May 2024 11:37:34 -0400 Subject: [PATCH 04/18] chore: don't download brew twice --- build_files/base/brew.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/build_files/base/brew.sh b/build_files/base/brew.sh index abccb585616..4a735f33f8b 100644 --- a/build_files/base/brew.sh +++ b/build_files/base/brew.sh @@ -2,9 +2,6 @@ set -xeou pipefail -curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh > /tmp/brew.sh -chmod +x /tmp/brew.sh - # Convince the installer we are in CI if [[ ! -f /.dockerenv ]]; then touch /.dockerenv @@ -15,7 +12,7 @@ mkdir -p /var/home mkdir -p /var/roothome # Install brew, Get portable Ruby -/tmp/brew.sh +/usr/libexec/brew-install /home/linuxbrew/.linuxbrew/bin/brew update # Copy to image and own by UID 1000 From 8342ca73dac134ebd27582c46a2ef52d7da915ed Mon Sep 17 00:00:00 2001 From: m2Giles <69128853+m2Giles@users.noreply.github.com> Date: Mon, 13 May 2024 16:38:20 +0000 Subject: [PATCH 05/18] fix: enable services as part of build. fix(dev): fish shebangs to disable shellcheck --- build_files/base/systemd.sh | 3 +++ .../kinoite/usr/share/fish/vendor_conf.d/aurora-fastfetch.fish | 2 ++ .../systemd/system/{brew-upgade.timer => brew-upgrade.timer} | 0 system_files/shared/usr/share/fish/vendor_conf.d/brew.fish | 1 + system_files/shared/usr/share/fish/vendor_conf.d/neofetch.fish | 1 + .../usr/share/fish/vendor_functions.d/fish_greeting.fish | 3 +++ .../usr/share/fish/vendor_conf.d/bluefin-fastfetch.fish | 2 ++ 7 files changed, 12 insertions(+) rename system_files/shared/usr/lib/systemd/system/{brew-upgade.timer => brew-upgrade.timer} (100%) diff --git a/build_files/base/systemd.sh b/build_files/base/systemd.sh index 910cc12327f..db8b44c3260 100644 --- a/build_files/base/systemd.sh +++ b/build_files/base/systemd.sh @@ -10,5 +10,8 @@ systemctl enable ublue-update.timer systemctl enable ublue-system-setup.service systemctl enable ublue-etc-merge.service systemctl enable ublue-guest-user.service +systemctl enable var-home-linuxbrew.mount +systemctl enable brew-upgrade.timer +systemctl enable brew-update.timer systemctl --global enable ublue-user-setup.service systemctl --global enable podman-auto-update.timer \ No newline at end of file diff --git a/system_files/kinoite/usr/share/fish/vendor_conf.d/aurora-fastfetch.fish b/system_files/kinoite/usr/share/fish/vendor_conf.d/aurora-fastfetch.fish index 9050d7d29d5..f0e51f72be4 100644 --- a/system_files/kinoite/usr/share/fish/vendor_conf.d/aurora-fastfetch.fish +++ b/system_files/kinoite/usr/share/fish/vendor_conf.d/aurora-fastfetch.fish @@ -1 +1,3 @@ +#!/usr/bin/fish +#shellcheck disable=all alias fastfetch="/usr/bin/fastfetch --file /usr/share/ublue-os/aurora-logo.txt --logo-type file --logo-color-1 94 --logo-color-2 95 --logo-color-3 91 --logo-color-4 97 -c /usr/share/ublue-os/ublue-os.jsonc" \ No newline at end of file diff --git a/system_files/shared/usr/lib/systemd/system/brew-upgade.timer b/system_files/shared/usr/lib/systemd/system/brew-upgrade.timer similarity index 100% rename from system_files/shared/usr/lib/systemd/system/brew-upgade.timer rename to system_files/shared/usr/lib/systemd/system/brew-upgrade.timer diff --git a/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish b/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish index 8e0389438c4..075308b4f56 100644 --- a/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish +++ b/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish @@ -1,4 +1,5 @@ #!/usr/bin/fish +#shellcheck disable=all if status --is-interactive [ -d /home/linuxbrew/.linuxbrew ] && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" if systemctl --quiet is-active var-home-linuxbrew.mount diff --git a/system_files/shared/usr/share/fish/vendor_conf.d/neofetch.fish b/system_files/shared/usr/share/fish/vendor_conf.d/neofetch.fish index c98dbe94ec6..32cec0bf0da 100644 --- a/system_files/shared/usr/share/fish/vendor_conf.d/neofetch.fish +++ b/system_files/shared/usr/share/fish/vendor_conf.d/neofetch.fish @@ -1,3 +1,4 @@ #!/usr/bin/fish +#shellcheck disable=all alias neofetch=fastfetch \ No newline at end of file diff --git a/system_files/shared/usr/share/fish/vendor_functions.d/fish_greeting.fish b/system_files/shared/usr/share/fish/vendor_functions.d/fish_greeting.fish index 42676df7f33..b58908138cc 100644 --- a/system_files/shared/usr/share/fish/vendor_functions.d/fish_greeting.fish +++ b/system_files/shared/usr/share/fish/vendor_functions.d/fish_greeting.fish @@ -1,3 +1,6 @@ +#!/usr/bin/fish +#shellcheck disable=all + function fish_greeting if test -d "$HOME" if test ! -e "$HOME"/.config/no-show-user-motd diff --git a/system_files/silverblue/usr/share/fish/vendor_conf.d/bluefin-fastfetch.fish b/system_files/silverblue/usr/share/fish/vendor_conf.d/bluefin-fastfetch.fish index 12f24684dbe..ce3d48e727e 100644 --- a/system_files/silverblue/usr/share/fish/vendor_conf.d/bluefin-fastfetch.fish +++ b/system_files/silverblue/usr/share/fish/vendor_conf.d/bluefin-fastfetch.fish @@ -1 +1,3 @@ +#!/usr/bin/fish +#shellcheck disable=all alias fastfetch="/usr/bin/fastfetch --logo /usr/share/ublue-os/bluefin-logos/symbols/dolly -c /usr/share/ublue-os/ublue-os.jsonc" From e24fc354f7e8954dbc3909cc9233a6986c907d50 Mon Sep 17 00:00:00 2001 From: m2Giles <69128853+m2Giles@users.noreply.github.com> Date: Mon, 13 May 2024 18:09:16 +0000 Subject: [PATCH 06/18] chore: completions, timer conditions --- .../usr/etc/profile.d/brew-bash-completion.sh | 25 +++++++++++++++++++ .../shared/usr/etc/profile.d/brew-on-image.sh | 4 +-- .../usr/lib/systemd/system/brew-update.timer | 3 --- .../usr/lib/systemd/system/brew-upgrade.timer | 2 -- .../usr/share/fish/vendor_conf.d/brew.fish | 11 ++++++-- 5 files changed, 36 insertions(+), 9 deletions(-) create mode 100644 system_files/shared/usr/etc/profile.d/brew-bash-completion.sh diff --git a/system_files/shared/usr/etc/profile.d/brew-bash-completion.sh b/system_files/shared/usr/etc/profile.d/brew-bash-completion.sh new file mode 100644 index 00000000000..2a164b7798d --- /dev/null +++ b/system_files/shared/usr/etc/profile.d/brew-bash-completion.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# shellcheck shell=sh disable=SC1091,SC2039,SC2166 +# Check for interactive bash and that we haven't already been sourced. +if [ "x${BASH_VERSION-}" != x -a "x${PS1-}" != x -a "x${BREW_BASH_COMPLETION}" = x ]; then + + # Check for recent enough version of bash. + if [ "${BASH_VERSINFO[0]}" -gt 4 ] || + [ "${BASH_VERSINFO[0]}" -eq 4 -a "${BASH_VERSINFO[1]}" -ge 2 ]; then + if [ -w /home/linuxbrew/.linuxbrew ]; then + if ! test -L /home/linuxbrew/.linuxbrew/etc/bash_completion.d/brew; then + /home/linuxbrew/.linuxbrew/bin/brew completions link > /dev/null + fi + if test -d /home/linuxbrew/.linuxbrew/etc/bash_completion.d; then + for rc in /home/linuxbrew/.linuxbrew/etc/bash_completion.d/*; do + if test -r "$rc"; then + . "$rc" + fi + done + unset rc + fi + fi + fi + BREW_BASH_COMPLETION=1 + export BREW_BASH_COMPLETION +fi diff --git a/system_files/shared/usr/etc/profile.d/brew-on-image.sh b/system_files/shared/usr/etc/profile.d/brew-on-image.sh index 1fd3ad6fc9e..52baa0eb9fc 100644 --- a/system_files/shared/usr/etc/profile.d/brew-on-image.sh +++ b/system_files/shared/usr/etc/profile.d/brew-on-image.sh @@ -1,6 +1,6 @@ -#!/usr/bin/bash +#!/bin/sh if systemctl --quiet is-active var-home-linuxbrew.mount; then HOMEBREW_NO_AUTO_UPDATE=1 export HOMEBREW_NO_AUTO_UPDATE -fi \ No newline at end of file +fi diff --git a/system_files/shared/usr/lib/systemd/system/brew-update.timer b/system_files/shared/usr/lib/systemd/system/brew-update.timer index 025ccc6c2f6..34d6584e4dc 100644 --- a/system_files/shared/usr/lib/systemd/system/brew-update.timer +++ b/system_files/shared/usr/lib/systemd/system/brew-update.timer @@ -1,9 +1,6 @@ [Unit] Description=Timer for brew update for mutable brew Wants=network-online.target -After=local-fs.target -ConditionPathIsMountPoint=!/var/home/linuxbrew -ConditionPathExists=/home/linuxbrew/.linuxbrew/bin/brew [Timer] OnBootSec=20min diff --git a/system_files/shared/usr/lib/systemd/system/brew-upgrade.timer b/system_files/shared/usr/lib/systemd/system/brew-upgrade.timer index 336a4b4521c..20f7cacd16d 100644 --- a/system_files/shared/usr/lib/systemd/system/brew-upgrade.timer +++ b/system_files/shared/usr/lib/systemd/system/brew-upgrade.timer @@ -1,8 +1,6 @@ [Unit] Description=Timer for brew upgrade for on image brew Wants=network-online.target -After=local-fs.target -ConditionPathExists=/home/linuxbrew/.linuxbrew/bin/brew [Timer] OnBootSec=20min diff --git a/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish b/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish index 075308b4f56..5cf1e4153a6 100644 --- a/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish +++ b/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish @@ -1,8 +1,15 @@ #!/usr/bin/fish #shellcheck disable=all if status --is-interactive - [ -d /home/linuxbrew/.linuxbrew ] && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" + if [ -d /home/linuxbrew/.linuxbrew ] + if [ -w /home/linuxbrew/.linuxbrew ] + if [ ! -L /home/linuxbrew/.linuxbrew/share/fish/vendor_completions.d/brew] + /home/linuxbrew/.linuxbrew/bin/brew completions link > /dev/null + end + end + set -p fish_complete_path /home/linuxbrew/.linuxbrew/share/fish/vendor_completions.d + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" if systemctl --quiet is-active var-home-linuxbrew.mount - set -x HOMEBREW_NO_AUTO_UPDATE 1 + set -gx HOMEBREW_NO_AUTO_UPDATE 1 end end \ No newline at end of file From f8a74dacaa8e83646a07df30481ae590e299121d Mon Sep 17 00:00:00 2001 From: m2Giles <69128853+m2Giles@users.noreply.github.com> Date: Mon, 13 May 2024 18:25:57 +0000 Subject: [PATCH 07/18] fix: missing end and newlines --- build_files/base/brew.sh | 2 +- system_files/shared/usr/etc/profile.d/brew.sh | 2 +- .../shared/usr/lib/systemd/system-preset/01-homebrew.preset | 2 +- system_files/shared/usr/lib/systemd/system/brew-update.timer | 2 +- .../shared/usr/lib/systemd/system/cleanup-homebrew.service | 2 +- system_files/shared/usr/share/fish/vendor_conf.d/brew.fish | 3 ++- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/build_files/base/brew.sh b/build_files/base/brew.sh index 4a735f33f8b..125e1eed389 100644 --- a/build_files/base/brew.sh +++ b/build_files/base/brew.sh @@ -17,4 +17,4 @@ mkdir -p /var/roothome # Copy to image and own by UID 1000 cp -R /home/linuxbrew /usr/share/homebrew -chown -R 1000:1000 /usr/share/homebrew \ No newline at end of file +chown -R 1000:1000 /usr/share/homebrew diff --git a/system_files/shared/usr/etc/profile.d/brew.sh b/system_files/shared/usr/etc/profile.d/brew.sh index c49ba9bc4dd..73905be7d2f 100644 --- a/system_files/shared/usr/etc/profile.d/brew.sh +++ b/system_files/shared/usr/etc/profile.d/brew.sh @@ -1,2 +1,2 @@ #!/usr/bin/bash -[[ -d /home/linuxbrew/.linuxbrew && $- == *i* ]] && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" \ No newline at end of file +[[ -d /home/linuxbrew/.linuxbrew && $- == *i* ]] && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" diff --git a/system_files/shared/usr/lib/systemd/system-preset/01-homebrew.preset b/system_files/shared/usr/lib/systemd/system-preset/01-homebrew.preset index 5671b75d935..0babf050dde 100644 --- a/system_files/shared/usr/lib/systemd/system-preset/01-homebrew.preset +++ b/system_files/shared/usr/lib/systemd/system-preset/01-homebrew.preset @@ -1,3 +1,3 @@ enable var-home-linuxbrew.mount enable brew-update.timer -enable brew-upgrade.timer \ No newline at end of file +enable brew-upgrade.timer diff --git a/system_files/shared/usr/lib/systemd/system/brew-update.timer b/system_files/shared/usr/lib/systemd/system/brew-update.timer index 34d6584e4dc..d0226f33006 100644 --- a/system_files/shared/usr/lib/systemd/system/brew-update.timer +++ b/system_files/shared/usr/lib/systemd/system/brew-update.timer @@ -8,4 +8,4 @@ OnUnitInactiveSec=6h Persistent=true [Install] -WantedBy=timers.target \ No newline at end of file +WantedBy=timers.target diff --git a/system_files/shared/usr/lib/systemd/system/cleanup-homebrew.service b/system_files/shared/usr/lib/systemd/system/cleanup-homebrew.service index 94a34db3abb..006f4021a6d 100644 --- a/system_files/shared/usr/lib/systemd/system/cleanup-homebrew.service +++ b/system_files/shared/usr/lib/systemd/system/cleanup-homebrew.service @@ -13,4 +13,4 @@ ExecStop=-/usr/bin/rm -rf %C/homebrew/.* ExecStop=-/usr/bin/rm -rf %C/homebrew/* [Install] -WantedBy=default.target multi-user.target \ No newline at end of file +WantedBy=default.target multi-user.target diff --git a/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish b/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish index 5cf1e4153a6..f910a8f8bf0 100644 --- a/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish +++ b/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish @@ -9,7 +9,8 @@ if status --is-interactive end set -p fish_complete_path /home/linuxbrew/.linuxbrew/share/fish/vendor_completions.d eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" + end if systemctl --quiet is-active var-home-linuxbrew.mount set -gx HOMEBREW_NO_AUTO_UPDATE 1 end -end \ No newline at end of file +end From 39deb3f206d4252b97b6d4109efd4807011b7a98 Mon Sep 17 00:00:00 2001 From: m2Giles <69128853+m2Giles@users.noreply.github.com> Date: Mon, 13 May 2024 19:07:26 +0000 Subject: [PATCH 08/18] chore: add brewfile remove ujust brew from motd --- .../kinoite/usr/share/ublue-os/motd/bluefin.md | 1 - .../usr/share/ublue-os/homebrew/bluefin-cli.Brewfile | 11 +++++++++++ .../silverblue/usr/share/ublue-os/motd/bluefin.md | 1 - 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 system_files/shared/usr/share/ublue-os/homebrew/bluefin-cli.Brewfile diff --git a/system_files/kinoite/usr/share/ublue-os/motd/bluefin.md b/system_files/kinoite/usr/share/ublue-os/motd/bluefin.md index 312f115f9e5..dbaba83d8d0 100644 --- a/system_files/kinoite/usr/share/ublue-os/motd/bluefin.md +++ b/system_files/kinoite/usr/share/ublue-os/motd/bluefin.md @@ -6,7 +6,6 @@ Let's trace the stars. | ------- | ----------- | | `ujust --choose` | Display available commands with search | | `ujust toggle-user-motd` | Toggle this banner on/off | -| `ujust brew` | Install Homebrew (Strongly Recommended) | %TIP% diff --git a/system_files/shared/usr/share/ublue-os/homebrew/bluefin-cli.Brewfile b/system_files/shared/usr/share/ublue-os/homebrew/bluefin-cli.Brewfile new file mode 100644 index 00000000000..7560aa833b8 --- /dev/null +++ b/system_files/shared/usr/share/ublue-os/homebrew/bluefin-cli.Brewfile @@ -0,0 +1,11 @@ +brew "atuin" +brew "bat" +brew "direnv" +brew "eza" +brew "fd" +brew "gh" +brew "glab" +brew "rg" +brew "ugrep" +brew "yq" +brew "zoxide" diff --git a/system_files/silverblue/usr/share/ublue-os/motd/bluefin.md b/system_files/silverblue/usr/share/ublue-os/motd/bluefin.md index 74123300a30..8f88474dc26 100644 --- a/system_files/silverblue/usr/share/ublue-os/motd/bluefin.md +++ b/system_files/silverblue/usr/share/ublue-os/motd/bluefin.md @@ -5,7 +5,6 @@ | ------- | ----------- | | `ujust --choose` | Display available commands with search | | `ujust toggle-user-motd` | Toggle this banner on/off | -| `ujust brew` | Install Homebrew (Strongly Recommended) | %TIP% From 9a486dc47b59e93f5ebf9de8731410a935c3effb Mon Sep 17 00:00:00 2001 From: m2Giles <69128853+m2Giles@users.noreply.github.com> Date: Mon, 13 May 2024 19:29:07 +0000 Subject: [PATCH 09/18] chore: add brewfile ujust --- Justfile | 6 ++++-- just/bluefin-system.just | 9 +++++++-- system_files/kinoite/usr/share/ublue-os/motd/bluefin.md | 1 + .../silverblue/usr/share/ublue-os/motd/bluefin.md | 1 + 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Justfile b/Justfile index 4c1e2d9c7b3..7ab3d8abcf5 100644 --- a/Justfile +++ b/Justfile @@ -21,9 +21,10 @@ just-check: #!/usr/bin/bash find "${project_root}" -type f -name "*.just" | while read -r file; do echo "Checking syntax: $file" - just --unstable --fmt --check -f $file || { exit 1; } + just --unstable --fmt --check -f $file done - just --unstable --fmt --check -f ${project_root}/Justfile || { exit 1; } + echo "Checking syntax: ${project_root}/Justfile" + just --unstable --fmt --check -f ${project_root}/Justfile # Fix Just Syntax [private] @@ -33,6 +34,7 @@ just-fix: echo "Checking syntax: $file" just --unstable --fmt -f $file || { exit 1; } done + echo "Checking syntax: ${project_root}/Justfile" just --unstable --fmt -f ${project_root}/Justfile || { exit 1; } # Build Image diff --git a/just/bluefin-system.just b/just/bluefin-system.just index 47a46680b19..f5d5879900c 100644 --- a/just/bluefin-system.just +++ b/just/bluefin-system.just @@ -15,8 +15,13 @@ benchmark: echo 'Running a 1 minute benchmark ...' cd /tmp && stress-ng --matrix 0 -t 1m --times -# Configure Bluefin-CLI Terminal Experience +# Configure Bluefin-CLI Terminal Experience with Brew bluefin-cli: + brew bundle --file /usr/share/ublue-os/homebrew/bluefin-cli.Brewfile + +# Configure Bluefin-CLI Terminal Experience +[private] +bluefin-cli-container: @/usr/libexec/enable-bluefin-cli.sh # Configure Terminal Experience @@ -283,7 +288,7 @@ install-system-flatpaks: FLATPAKS="aurora_flatpaks/flatpaks" fi FLATPAK_LIST="$(curl https://raw.githubusercontent.com/ublue-os/bluefin/main/${FLATPAKS} | tr '\n' ' ')" - flatpak --system -y install ${FLATPAK_LIST} + flatpak --system -y install --or-update ${FLATPAK_LIST} # Configure grub bootmenu visibility configure-grub: diff --git a/system_files/kinoite/usr/share/ublue-os/motd/bluefin.md b/system_files/kinoite/usr/share/ublue-os/motd/bluefin.md index dbaba83d8d0..339fb81e278 100644 --- a/system_files/kinoite/usr/share/ublue-os/motd/bluefin.md +++ b/system_files/kinoite/usr/share/ublue-os/motd/bluefin.md @@ -6,6 +6,7 @@ Let's trace the stars. | ------- | ----------- | | `ujust --choose` | Display available commands with search | | `ujust toggle-user-motd` | Toggle this banner on/off | +| `ujust bluefin-cli` | Install Terminal Bling w/ Brew | %TIP% diff --git a/system_files/silverblue/usr/share/ublue-os/motd/bluefin.md b/system_files/silverblue/usr/share/ublue-os/motd/bluefin.md index 8f88474dc26..a3420d1b7c1 100644 --- a/system_files/silverblue/usr/share/ublue-os/motd/bluefin.md +++ b/system_files/silverblue/usr/share/ublue-os/motd/bluefin.md @@ -5,6 +5,7 @@ | ------- | ----------- | | `ujust --choose` | Display available commands with search | | `ujust toggle-user-motd` | Toggle this banner on/off | +| `ujust bluefin-cli` | Install Terminal Bling w/ Brew | %TIP% From 949a96bc0226c0df738f2fa95c782371c2d5c82b Mon Sep 17 00:00:00 2001 From: m2Giles <69128853+m2Giles@users.noreply.github.com> Date: Mon, 13 May 2024 20:15:47 +0000 Subject: [PATCH 10/18] fix: brew completions --- .../usr/etc/profile.d/brew-bash-completion.sh | 2 +- system_files/shared/usr/etc/zsh/zshrc | 18 +++++++++++++----- .../usr/share/fish/vendor_conf.d/brew.fish | 13 +++++++++---- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/system_files/shared/usr/etc/profile.d/brew-bash-completion.sh b/system_files/shared/usr/etc/profile.d/brew-bash-completion.sh index 2a164b7798d..44313da193f 100644 --- a/system_files/shared/usr/etc/profile.d/brew-bash-completion.sh +++ b/system_files/shared/usr/etc/profile.d/brew-bash-completion.sh @@ -1,7 +1,7 @@ #!/bin/sh # shellcheck shell=sh disable=SC1091,SC2039,SC2166 # Check for interactive bash and that we haven't already been sourced. -if [ "x${BASH_VERSION-}" != x -a "x${PS1-}" != x -a "x${BREW_BASH_COMPLETION}" = x ]; then +if [ "x${BASH_VERSION-}" != x -a "x${PS1-}" != x -a "x${BREW_BASH_COMPLETION-}" = x ]; then # Check for recent enough version of bash. if [ "${BASH_VERSINFO[0]}" -gt 4 ] || diff --git a/system_files/shared/usr/etc/zsh/zshrc b/system_files/shared/usr/etc/zsh/zshrc index 15fb175b8d8..2e9531018a2 100644 --- a/system_files/shared/usr/etc/zsh/zshrc +++ b/system_files/shared/usr/etc/zsh/zshrc @@ -13,6 +13,19 @@ # # zmodload zsh/zprof +# Brew needs to be loaded before compinit is called +if [[ -o interactive ]] && [[ -d /home/linuxbrew/.linuxbrew ]]; then + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" + if [[ -w /home/linuxbrew/.linuxbrew ]]; then + if type brew &>/dev/null; then + if [[ ! -L "$(brew --prefix)/share/zsh/site-functions/_brew" ]]; then + brew completions link + fi + FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" + fi + fi +fi + # Load and initialize the completion system ignoring insecure directories with a # cache time of 20 hours, so it should almost always regenerate the first time a # shell is opened each day. @@ -195,11 +208,6 @@ colors # Sourcing ##################### -# Brew -if [[ -o interactive ]] && [[ -d /home/linuxbrew/.linuxbrew ]]; then - eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" -fi - # Starship if type "starship" > /dev/null; then eval "$(starship init zsh)" diff --git a/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish b/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish index f910a8f8bf0..86f7bc11380 100644 --- a/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish +++ b/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish @@ -2,13 +2,18 @@ #shellcheck disable=all if status --is-interactive if [ -d /home/linuxbrew/.linuxbrew ] + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" if [ -w /home/linuxbrew/.linuxbrew ] - if [ ! -L /home/linuxbrew/.linuxbrew/share/fish/vendor_completions.d/brew] - /home/linuxbrew/.linuxbrew/bin/brew completions link > /dev/null + if [ ! -L (brew --prefix)/share/fish/vendor_completions.d/brew] + brew completions link > /dev/null end end - set -p fish_complete_path /home/linuxbrew/.linuxbrew/share/fish/vendor_completions.d - eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" + if test -d (brew --prefix)/share/fish/completions + set -p fish_complete_path (brew --prefix)/share/fish/completions + end + if test -d (brew --prefix)/share/fish/vendor_completions.d + set -p fish_complete_path (brew --prefix)/share/fish/vendor_completions.d + end end if systemctl --quiet is-active var-home-linuxbrew.mount set -gx HOMEBREW_NO_AUTO_UPDATE 1 From 9dce7a951efaabccdf0fa5be87cd1b92a4c75dbd Mon Sep 17 00:00:00 2001 From: m2Giles <69128853+m2Giles@users.noreply.github.com> Date: Mon, 13 May 2024 20:19:44 +0000 Subject: [PATCH 11/18] fix: source completions even if not brew user --- .../usr/etc/profile.d/brew-bash-completion.sh | 16 ++++++++-------- system_files/shared/usr/etc/zsh/zshrc | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/system_files/shared/usr/etc/profile.d/brew-bash-completion.sh b/system_files/shared/usr/etc/profile.d/brew-bash-completion.sh index 44313da193f..424ac4ad1bc 100644 --- a/system_files/shared/usr/etc/profile.d/brew-bash-completion.sh +++ b/system_files/shared/usr/etc/profile.d/brew-bash-completion.sh @@ -10,14 +10,14 @@ if [ "x${BASH_VERSION-}" != x -a "x${PS1-}" != x -a "x${BREW_BASH_COMPLETION-}" if ! test -L /home/linuxbrew/.linuxbrew/etc/bash_completion.d/brew; then /home/linuxbrew/.linuxbrew/bin/brew completions link > /dev/null fi - if test -d /home/linuxbrew/.linuxbrew/etc/bash_completion.d; then - for rc in /home/linuxbrew/.linuxbrew/etc/bash_completion.d/*; do - if test -r "$rc"; then - . "$rc" - fi - done - unset rc - fi + fi + if test -d /home/linuxbrew/.linuxbrew/etc/bash_completion.d; then + for rc in /home/linuxbrew/.linuxbrew/etc/bash_completion.d/*; do + if test -r "$rc"; then + . "$rc" + fi + done + unset rc fi fi BREW_BASH_COMPLETION=1 diff --git a/system_files/shared/usr/etc/zsh/zshrc b/system_files/shared/usr/etc/zsh/zshrc index 2e9531018a2..89da0d7c1c8 100644 --- a/system_files/shared/usr/etc/zsh/zshrc +++ b/system_files/shared/usr/etc/zsh/zshrc @@ -16,13 +16,13 @@ # Brew needs to be loaded before compinit is called if [[ -o interactive ]] && [[ -d /home/linuxbrew/.linuxbrew ]]; then eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" - if [[ -w /home/linuxbrew/.linuxbrew ]]; then - if type brew &>/dev/null; then + if type brew &>/dev/null; then + if [[ -w /home/linuxbrew/.linuxbrew ]]; then if [[ ! -L "$(brew --prefix)/share/zsh/site-functions/_brew" ]]; then brew completions link fi - FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" fi + FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" fi fi From 45039eaa9a53f3e8cee39732d8e012ca2ae34861 Mon Sep 17 00:00:00 2001 From: m2Giles <69128853+m2Giles@users.noreply.github.com> Date: Mon, 13 May 2024 20:56:24 +0000 Subject: [PATCH 12/18] chore: zsh brew sourcing --- system_files/shared/usr/etc/zsh/zshrc | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/system_files/shared/usr/etc/zsh/zshrc b/system_files/shared/usr/etc/zsh/zshrc index 89da0d7c1c8..eb4dec6f2ab 100644 --- a/system_files/shared/usr/etc/zsh/zshrc +++ b/system_files/shared/usr/etc/zsh/zshrc @@ -13,19 +13,6 @@ # # zmodload zsh/zprof -# Brew needs to be loaded before compinit is called -if [[ -o interactive ]] && [[ -d /home/linuxbrew/.linuxbrew ]]; then - eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" - if type brew &>/dev/null; then - if [[ -w /home/linuxbrew/.linuxbrew ]]; then - if [[ ! -L "$(brew --prefix)/share/zsh/site-functions/_brew" ]]; then - brew completions link - fi - fi - FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" - fi -fi - # Load and initialize the completion system ignoring insecure directories with a # cache time of 20 hours, so it should almost always regenerate the first time a # shell is opened each day. @@ -208,6 +195,18 @@ colors # Sourcing ##################### +# Brew +if [[ -o interactive ]] && [[ -d /home/linuxbrew/.linuxbrew ]]; then + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" + if type brew &>/dev/null; then + if [[ -w /home/linuxbrew/.linuxbrew ]]; then + if [[ ! -L "$(brew --prefix)/share/zsh/site-functions/_brew" ]]; then + brew completions link + fi + fi + fi +fi + # Starship if type "starship" > /dev/null; then eval "$(starship init zsh)" From 6b3aee31f5f803b9e577930bb1aa334e25879333 Mon Sep 17 00:00:00 2001 From: m2 <69128853+m2Giles@users.noreply.github.com> Date: Tue, 14 May 2024 16:03:42 -0400 Subject: [PATCH 13/18] chore(ci): use 24.04 builder --- .github/workflows/reusable-build.yml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index e5732e805d4..c1d0183c4da 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -24,7 +24,7 @@ concurrency: jobs: build_container: name: image - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 continue-on-error: false outputs: image_full: ${{ steps.generate-outputs.outputs.image }} @@ -102,17 +102,6 @@ jobs: - name: Check just syntax uses: ublue-os/just-action@v1 - - name: Update podman - run: | - # from https://askubuntu.com/questions/1414446/whats-the-recommended-way-of-installing-podman-4-in-ubuntu-22-04 - ubuntu_version='22.04' - key_url="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key" - sources_url="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}" - echo "deb $sources_url/ /" | sudo tee /etc/apt/sources.list.d/devel-kubic-libcontainers-unstable.list - curl -fsSL $key_url | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_kubic_libcontainers_unstable.gpg > /dev/null - sudo apt update - sudo apt install -y podman - - name: Generate tags id: generate-tags shell: bash From 3ef407cb210d929cbbbb4cb54e5ac6f7ea7848c6 Mon Sep 17 00:00:00 2001 From: m2Giles <69128853+m2Giles@users.noreply.github.com> Date: Wed, 15 May 2024 14:10:05 -0400 Subject: [PATCH 14/18] chore: improve wording --- just/bluefin-system.just | 2 +- system_files/kinoite/usr/share/ublue-os/motd/bluefin.md | 2 +- system_files/silverblue/usr/share/ublue-os/motd/bluefin.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/just/bluefin-system.just b/just/bluefin-system.just index f5d5879900c..8a384e6eeaf 100644 --- a/just/bluefin-system.just +++ b/just/bluefin-system.just @@ -18,7 +18,7 @@ benchmark: # Configure Bluefin-CLI Terminal Experience with Brew bluefin-cli: brew bundle --file /usr/share/ublue-os/homebrew/bluefin-cli.Brewfile - + echo 'Installation complete ... please close and reopen your terminal!' # Configure Bluefin-CLI Terminal Experience [private] bluefin-cli-container: diff --git a/system_files/kinoite/usr/share/ublue-os/motd/bluefin.md b/system_files/kinoite/usr/share/ublue-os/motd/bluefin.md index 339fb81e278..0fcf438c164 100644 --- a/system_files/kinoite/usr/share/ublue-os/motd/bluefin.md +++ b/system_files/kinoite/usr/share/ublue-os/motd/bluefin.md @@ -6,7 +6,7 @@ Let's trace the stars. | ------- | ----------- | | `ujust --choose` | Display available commands with search | | `ujust toggle-user-motd` | Toggle this banner on/off | -| `ujust bluefin-cli` | Install Terminal Bling w/ Brew | +| `ujust bluefin-cli` | Enable terminal bling | %TIP% diff --git a/system_files/silverblue/usr/share/ublue-os/motd/bluefin.md b/system_files/silverblue/usr/share/ublue-os/motd/bluefin.md index a3420d1b7c1..1eece88b2eb 100644 --- a/system_files/silverblue/usr/share/ublue-os/motd/bluefin.md +++ b/system_files/silverblue/usr/share/ublue-os/motd/bluefin.md @@ -5,7 +5,7 @@ | ------- | ----------- | | `ujust --choose` | Display available commands with search | | `ujust toggle-user-motd` | Toggle this banner on/off | -| `ujust bluefin-cli` | Install Terminal Bling w/ Brew | +| `ujust bluefin-cli` | Enable terminal bling | %TIP% From adf42fa730de1ab0f13399e7482a59dac3e36855 Mon Sep 17 00:00:00 2001 From: m2Giles <69128853+m2Giles@users.noreply.github.com> Date: Wed, 15 May 2024 14:25:36 -0400 Subject: [PATCH 15/18] fix: remove brew update for image based updates --- build_files/base/brew.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build_files/base/brew.sh b/build_files/base/brew.sh index 125e1eed389..8c617aeca7b 100644 --- a/build_files/base/brew.sh +++ b/build_files/base/brew.sh @@ -18,3 +18,7 @@ mkdir -p /var/roothome # Copy to image and own by UID 1000 cp -R /home/linuxbrew /usr/share/homebrew chown -R 1000:1000 /usr/share/homebrew + +# Remove update functions to prevent user +rm -f /usr/share/homebrew/.linuxbrew/Homebrew/Library/Homebrew/cmd/update.sh +rm -f /usr/share/homebrew/.linuxbrew/Homebrew/Library/Homebrew/cmd/update-reset.sh From c37697b34fbaf6ff2d4002e3302087b2a476962d Mon Sep 17 00:00:00 2001 From: m2Giles <69128853+m2Giles@users.noreply.github.com> Date: Wed, 15 May 2024 15:17:26 -0400 Subject: [PATCH 16/18] fix: don't use lock file for image brew bundle --- just/bluefin-system.just | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/just/bluefin-system.just b/just/bluefin-system.just index 8a384e6eeaf..08051f420b8 100644 --- a/just/bluefin-system.just +++ b/just/bluefin-system.just @@ -17,7 +17,7 @@ benchmark: # Configure Bluefin-CLI Terminal Experience with Brew bluefin-cli: - brew bundle --file /usr/share/ublue-os/homebrew/bluefin-cli.Brewfile + @brew bundle --file /usr/share/ublue-os/homebrew/bluefin-cli.Brewfile --no-lock echo 'Installation complete ... please close and reopen your terminal!' # Configure Bluefin-CLI Terminal Experience [private] From 5d64dd98a964c301c1fd85e10eb3001d04f42661 Mon Sep 17 00:00:00 2001 From: m2Giles <69128853+m2Giles@users.noreply.github.com> Date: Wed, 15 May 2024 16:13:56 -0400 Subject: [PATCH 17/18] fix: just syntax --- just/bluefin-system.just | 1 + 1 file changed, 1 insertion(+) diff --git a/just/bluefin-system.just b/just/bluefin-system.just index 08051f420b8..fad28865517 100644 --- a/just/bluefin-system.just +++ b/just/bluefin-system.just @@ -19,6 +19,7 @@ benchmark: bluefin-cli: @brew bundle --file /usr/share/ublue-os/homebrew/bluefin-cli.Brewfile --no-lock echo 'Installation complete ... please close and reopen your terminal!' + # Configure Bluefin-CLI Terminal Experience [private] bluefin-cli-container: From a52e715e83af0af013e2e92c8313aa889f437c22 Mon Sep 17 00:00:00 2001 From: m2Giles <69128853+m2Giles@users.noreply.github.com> Date: Thu, 16 May 2024 00:52:34 +0000 Subject: [PATCH 18/18] chore: simplify brew install --- build_files/base/brew.sh | 8 +------- build_files/base/systemd.sh | 2 +- .../shared/usr/etc/profile.d/brew-on-image.sh | 6 ------ system_files/shared/usr/etc/profile.d/brew.sh | 2 -- .../systemd/system-preset/01-homebrew.preset | 2 +- .../usr/lib/systemd/system/brew-setup.service | 13 +++++++++++++ .../usr/lib/systemd/system/brew-update.service | 2 +- .../usr/lib/systemd/system/brew-upgrade.service | 2 +- .../lib/systemd/system/cleanup-homebrew.service | 16 ---------------- .../lib/systemd/system/var-home-linuxbrew.mount | 17 ----------------- .../usr/share/fish/vendor_conf.d/brew.fish | 3 --- 11 files changed, 18 insertions(+), 55 deletions(-) delete mode 100644 system_files/shared/usr/etc/profile.d/brew-on-image.sh delete mode 100644 system_files/shared/usr/etc/profile.d/brew.sh create mode 100644 system_files/shared/usr/lib/systemd/system/brew-setup.service delete mode 100644 system_files/shared/usr/lib/systemd/system/cleanup-homebrew.service delete mode 100644 system_files/shared/usr/lib/systemd/system/var-home-linuxbrew.mount diff --git a/build_files/base/brew.sh b/build_files/base/brew.sh index 8c617aeca7b..a1a70bf7924 100644 --- a/build_files/base/brew.sh +++ b/build_files/base/brew.sh @@ -11,14 +11,8 @@ fi mkdir -p /var/home mkdir -p /var/roothome -# Install brew, Get portable Ruby +# Install brew /usr/libexec/brew-install -/home/linuxbrew/.linuxbrew/bin/brew update # Copy to image and own by UID 1000 cp -R /home/linuxbrew /usr/share/homebrew -chown -R 1000:1000 /usr/share/homebrew - -# Remove update functions to prevent user -rm -f /usr/share/homebrew/.linuxbrew/Homebrew/Library/Homebrew/cmd/update.sh -rm -f /usr/share/homebrew/.linuxbrew/Homebrew/Library/Homebrew/cmd/update-reset.sh diff --git a/build_files/base/systemd.sh b/build_files/base/systemd.sh index 9409126f006..cc91e93e047 100644 --- a/build_files/base/systemd.sh +++ b/build_files/base/systemd.sh @@ -10,7 +10,7 @@ systemctl enable ublue-update.timer systemctl enable ublue-system-setup.service systemctl enable ublue-etc-merge.service systemctl enable ublue-guest-user.service -systemctl enable var-home-linuxbrew.mount +systemctl enable brew-setup.service systemctl enable brew-upgrade.timer systemctl enable brew-update.timer systemctl --global enable ublue-user-setup.service diff --git a/system_files/shared/usr/etc/profile.d/brew-on-image.sh b/system_files/shared/usr/etc/profile.d/brew-on-image.sh deleted file mode 100644 index 52baa0eb9fc..00000000000 --- a/system_files/shared/usr/etc/profile.d/brew-on-image.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -if systemctl --quiet is-active var-home-linuxbrew.mount; then - HOMEBREW_NO_AUTO_UPDATE=1 - export HOMEBREW_NO_AUTO_UPDATE -fi diff --git a/system_files/shared/usr/etc/profile.d/brew.sh b/system_files/shared/usr/etc/profile.d/brew.sh deleted file mode 100644 index 73905be7d2f..00000000000 --- a/system_files/shared/usr/etc/profile.d/brew.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/bash -[[ -d /home/linuxbrew/.linuxbrew && $- == *i* ]] && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" diff --git a/system_files/shared/usr/lib/systemd/system-preset/01-homebrew.preset b/system_files/shared/usr/lib/systemd/system-preset/01-homebrew.preset index 0babf050dde..0d29503e589 100644 --- a/system_files/shared/usr/lib/systemd/system-preset/01-homebrew.preset +++ b/system_files/shared/usr/lib/systemd/system-preset/01-homebrew.preset @@ -1,3 +1,3 @@ -enable var-home-linuxbrew.mount +enable brew-setup.service enable brew-update.timer enable brew-upgrade.timer diff --git a/system_files/shared/usr/lib/systemd/system/brew-setup.service b/system_files/shared/usr/lib/systemd/system/brew-setup.service new file mode 100644 index 00000000000..f68e06fd29d --- /dev/null +++ b/system_files/shared/usr/lib/systemd/system/brew-setup.service @@ -0,0 +1,13 @@ +[Unit] +Description=Setup Brew +ConditionPathExists=!/etc/.linuxbrew +ConditionPathExists=!/var/home/linuxbrew/.linuxbrew + +[Service] +Type=oneshot +ExecStart=/usr/bin/cp -R -n /usr/share/homebrew /var/home/linuxbrew +ExecStart=/usr/bin/chown -R 1000:1000 /var/home/linuxbrew +ExecStart=/usr/bin/touch /etc/.linuxbrew + +[Install] +WantedBy=default.target multi-user.target diff --git a/system_files/shared/usr/lib/systemd/system/brew-update.service b/system_files/shared/usr/lib/systemd/system/brew-update.service index 06d7bff1954..f0af0d11a2d 100644 --- a/system_files/shared/usr/lib/systemd/system/brew-update.service +++ b/system_files/shared/usr/lib/systemd/system/brew-update.service @@ -1,7 +1,7 @@ [Unit] Description=Auto update brew for mutable brew installs After=local-fs.target -ConditionPathIsMountPoint=!/var/home/linuxbrew +After=network-online.target ConditionPathExists=/home/linuxbrew/.linuxbrew/bin/brew [Service] diff --git a/system_files/shared/usr/lib/systemd/system/brew-upgrade.service b/system_files/shared/usr/lib/systemd/system/brew-upgrade.service index 21d0b2e8f87..1adeab2544a 100644 --- a/system_files/shared/usr/lib/systemd/system/brew-upgrade.service +++ b/system_files/shared/usr/lib/systemd/system/brew-upgrade.service @@ -1,12 +1,12 @@ [Unit] Description=Upgrade Brew packages After=local-fs.target +After=network-online.target ConditionPathExists=/home/linuxbrew/.linuxbrew/bin/brew [Service] # Override the user if different UID/User User=1000 Type=oneshot -Environment=HOMEBREW_NO_AUTO_UPDATE=1 ExecStart=/home/linuxbrew/.linuxbrew/bin/brew upgrade StandardOutput=journal diff --git a/system_files/shared/usr/lib/systemd/system/cleanup-homebrew.service b/system_files/shared/usr/lib/systemd/system/cleanup-homebrew.service deleted file mode 100644 index 006f4021a6d..00000000000 --- a/system_files/shared/usr/lib/systemd/system/cleanup-homebrew.service +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=Cleanup Homebrew workdir -After=var.mount -Before=var-home-linuxbrew.mount -ConditionPathIsDirectory=%C/homebrew - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=-/usr/bin/rm -rf %C/homebrew/.* -ExecStart=-/usr/bin/rm -rf %C/homebrew/* -ExecStop=-/usr/bin/rm -rf %C/homebrew/.* -ExecStop=-/usr/bin/rm -rf %C/homebrew/* - -[Install] -WantedBy=default.target multi-user.target diff --git a/system_files/shared/usr/lib/systemd/system/var-home-linuxbrew.mount b/system_files/shared/usr/lib/systemd/system/var-home-linuxbrew.mount deleted file mode 100644 index bd10ff01821..00000000000 --- a/system_files/shared/usr/lib/systemd/system/var-home-linuxbrew.mount +++ /dev/null @@ -1,17 +0,0 @@ -[Unit] -Description=Homebrew overlay mount -Wants=cleanup-homebrew.service -After=cleanup-homebrew.service -After=var-mount.mount -ConditionPathIsDirectory=%S/homebrew -ConditionPathIsDirectory=%C/homebrew -ConditionPathExists=!/var/home/linuxbrew/.linuxbrew - -[Mount] -Type=overlay -What=overlay -Options=lowerdir=/usr/share/homebrew,upperdir=%S/homebrew,workdir=%C/homebrew -Where=/var/home/linuxbrew - -[Install] -WantedBy=local-fs.target diff --git a/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish b/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish index 86f7bc11380..e50f5250a2f 100644 --- a/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish +++ b/system_files/shared/usr/share/fish/vendor_conf.d/brew.fish @@ -15,7 +15,4 @@ if status --is-interactive set -p fish_complete_path (brew --prefix)/share/fish/vendor_completions.d end end - if systemctl --quiet is-active var-home-linuxbrew.mount - set -gx HOMEBREW_NO_AUTO_UPDATE 1 - end end