mirror of
https://github.com/ublue-os/bazzite.git
synced 2025-03-12 04:14:06 +00:00
feat: homebrew on image
This commit is contained in:
parent
d0c226005c
commit
2dbf29701b
@ -538,6 +538,20 @@ RUN rpm-ostree install \
|
|||||||
sed -i~ -E 's/=.\$\(command -v (nft|ip6?tables-legacy).*/=/g' /usr/lib/waydroid/data/scripts/waydroid-net.sh && \
|
sed -i~ -E 's/=.\$\(command -v (nft|ip6?tables-legacy).*/=/g' /usr/lib/waydroid/data/scripts/waydroid-net.sh && \
|
||||||
ostree container commit
|
ostree container commit
|
||||||
|
|
||||||
|
# Install Homebrew on Image
|
||||||
|
RUN touch /.dockerenv && \
|
||||||
|
mkdir -p /var/home && \
|
||||||
|
mkdir -p /var/roothome && \
|
||||||
|
curl -Lo /tmp/brew-install https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh && \
|
||||||
|
chmod +x /tmp/brew-install && \
|
||||||
|
/tmp/brew-install && \
|
||||||
|
/home/linuxbrew/.linuxbrew/bin/brew update && \
|
||||||
|
cp -R /home/linuxbrew /usr/share/homebrew && \
|
||||||
|
chown -R 1000:1000 /usr/share/homebrew && \
|
||||||
|
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 && \
|
||||||
|
ostree container commit
|
||||||
|
|
||||||
# Cleanup & Finalize
|
# Cleanup & Finalize
|
||||||
COPY system_files/overrides /
|
COPY system_files/overrides /
|
||||||
RUN /usr/libexec/containerbuild/build-initramfs && \
|
RUN /usr/libexec/containerbuild/build-initramfs && \
|
||||||
@ -599,6 +613,9 @@ RUN /usr/libexec/containerbuild/build-initramfs && \
|
|||||||
sed -i 's/#DefaultTimeoutStopSec.*/DefaultTimeoutStopSec=15s/' /usr/lib/systemd/system.conf && \
|
sed -i 's/#DefaultTimeoutStopSec.*/DefaultTimeoutStopSec=15s/' /usr/lib/systemd/system.conf && \
|
||||||
mkdir -p /usr/etc/flatpak/remotes.d && \
|
mkdir -p /usr/etc/flatpak/remotes.d && \
|
||||||
curl -Lo /usr/etc/flatpak/remotes.d/flathub.flatpakrepo https://dl.flathub.org/repo/flathub.flatpakrepo && \
|
curl -Lo /usr/etc/flatpak/remotes.d/flathub.flatpakrepo https://dl.flathub.org/repo/flathub.flatpakrepo && \
|
||||||
|
systemctl enable var-home-linuxbrew.mount && \
|
||||||
|
systemctl enable brew-upgrade.timer && \
|
||||||
|
systemctl enable brew-update.timer && \
|
||||||
systemctl enable com.system76.Scheduler.service && \
|
systemctl enable com.system76.Scheduler.service && \
|
||||||
systemctl enable btrfs-dedup@var-home.timer && \
|
systemctl enable btrfs-dedup@var-home.timer && \
|
||||||
systemctl enable displaylink.service && \
|
systemctl enable displaylink.service && \
|
||||||
|
@ -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
|
||||||
|
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
|
||||||
|
export BREW_BASH_COMPLETION
|
||||||
|
fi
|
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if systemctl --quiet is-active var-home-linuxbrew.mount; then
|
||||||
|
HOMEBREW_NO_AUTO_UPDATE=1
|
||||||
|
export HOMEBREW_NO_AUTO_UPDATE
|
||||||
|
fi
|
@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Auto update brew for mutable brew installs
|
||||||
|
After=local-fs.target
|
||||||
|
After=network-online.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
|
@ -0,0 +1,11 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Timer for brew update for mutable brew
|
||||||
|
Wants=network-online.target
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnBootSec=20min
|
||||||
|
OnUnitInactiveSec=6h
|
||||||
|
Persistent=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
@ -0,0 +1,13 @@
|
|||||||
|
[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
|
@ -0,0 +1,11 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Timer for brew upgrade for on image brew
|
||||||
|
Wants=network-online.target
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnBootSec=20min
|
||||||
|
OnUnitInactiveSec=6h
|
||||||
|
Persistent=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
@ -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
|
@ -0,0 +1,17 @@
|
|||||||
|
[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
|
@ -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 - -
|
@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/fish
|
||||||
|
#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 (brew --prefix)/share/fish/vendor_completions.d/brew]
|
||||||
|
brew completions link > /dev/null
|
||||||
|
end
|
||||||
|
end
|
||||||
|
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
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user