-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ublue, brew): add universal blue homebrew integration scripts (#95)
* feat(ublue, brew): add universal blue homebrew integration scripts This should just add all the integrations we need, sadly it still doesnt install homebrew directly. * feat(ublue, brew): add fish configuration hooks
- Loading branch information
1 parent
dfccad8
commit c4f6307
Showing
8 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env bash | ||
[[ -d /home/linuxbrew/.linuxbrew && $- == *i* ]] && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#This file sets the resource limits for the users logged in via PAM, | ||
#more specifically, users logged in on via SSH or tty (console). | ||
#Limits related to terminals in Wayland/Xorg sessions depend on a | ||
#change to /etc/systemd/user.conf. | ||
#This does not affect resource limits of the system services. | ||
#This file overrides defaults set in /etc/security/limits.conf | ||
|
||
* soft nofile 4096 | ||
root soft nofile 4096 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
enable brew-setup.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[Unit] | ||
Description=Setup Brew | ||
Wants=network-online.target | ||
After=network-online.target | ||
ConditionPathExists=!/etc/.linuxbrew | ||
ConditionPathExists=!/var/home/linuxbrew/.linuxbrew | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/bin/mkdir -p /tmp/homebrew | ||
ExecStart=/usr/bin/tar --zstd -xvf /usr/share/homebrew.tar.zst -C /tmp/homebrew | ||
ExecStart=/usr/bin/cp -R -n /tmp/homebrew/home/linuxbrew/.linuxbrew /var/home/linuxbrew | ||
ExecStart=/usr/bin/chown -R 1000:1000 /var/home/linuxbrew | ||
ExecStart=/usr/bin/rm -rf /tmp/homebrew | ||
ExecStart=/usr/bin/touch /etc/.linuxbrew | ||
|
||
[Install] | ||
WantedBy=default.target multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 - - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/fish | ||
#shellcheck disable=all | ||
if status --is-interactive | ||
if [ -d /home/linuxbrew/.linuxbrew ] | ||
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 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
%global debug_package %{nil} | ||
|
||
Name: ublue-brew | ||
Version: 0.1.0 | ||
Release: 1%{?dist} | ||
Summary: Homebrew integration for Universal Blue systems | ||
|
||
License: Apache-2.0 | ||
URL: https://github.com/ublue-os/packages | ||
VCS: {{{ git_dir_vcs }}} | ||
Source: {{{ git_dir_pack }}} | ||
|
||
BuildRequires: systemd-rpm-macros | ||
|
||
%description | ||
Homebrew integration for Universal Blue systems | ||
|
||
%prep | ||
{{{ git_dir_setup_macro }}} | ||
|
||
%install | ||
mkdir -p %{buildroot}{%{_unitdir},%{_prefix}/lib/systemd/system-preset,%{_sysconfdir}} | ||
install -Dpm0755 src/systemd/*.service %{buildroot}%{_unitdir} | ||
install -Dpm0755 src/systemd/*.preset %{buildroot}%{_prefix}/lib/systemd/system-preset | ||
install -Dm0755 ./src/vendor.fish %{buildroot}%{_datadir}/fish/vendor_conf.d/%{name}.fish | ||
cp -rp src/security %{buildroot}%{_sysconfdir} | ||
cp -rp src/profile.d %{buildroot}%{_sysconfdir} | ||
cp -rp src/tmpfiles.d %{buildroot}%{_prefix}/lib | ||
|
||
%post | ||
%systemd_post brew-setup.service | ||
|
||
%preun | ||
%systemd_preun brew-setup.service | ||
|
||
%files | ||
%{_sysconfdir}/profile.d/brew* | ||
%{_datadir}/fish/vendor_conf.d/%{name}.fish | ||
%{_sysconfdir}/security/limits.d/*brew*.conf | ||
%{_unitdir}/brew-setup.service | ||
%{_prefix}/lib/systemd/system-preset/01-homebrew.preset | ||
%{_prefix}/lib/tmpfiles.d/*brew.conf | ||
|
||
%changelog | ||
%autochangelog |