Skip to content

Commit 6659dc3

Browse files
authored
Merge branch 'main' into dnf-module
2 parents 7163c19 + 9038422 commit 6659dc3

8 files changed

Lines changed: 61 additions & 59 deletions

File tree

.github/workflows/build-individual.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1515

16-
- uses: hustcer/setup-nu@0000000ae6a4e242e802c943f465373b70b07469 # v3.17
16+
- uses: hustcer/setup-nu@9859855d6c1dfcd6d53ee7480b8e86c8c45298cb # v3.19
1717
with:
1818
version: v0.93
1919

2020
- uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
2121

2222
- name: Login to GitHub Container Registry
23-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
23+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
2424
with:
2525
registry: ghcr.io
2626
username: ${{ github.actor }}

.github/workflows/build-unified.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1515

16-
- uses: hustcer/setup-nu@0000000ae6a4e242e802c943f465373b70b07469 # v3.17
16+
- uses: hustcer/setup-nu@9859855d6c1dfcd6d53ee7480b8e86c8c45298cb # v3.19
1717
with:
1818
version: v0.93
1919

2020
- uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
2121

2222
- name: Login to GitHub Container Registry
23-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
23+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
2424
with:
2525
registry: ghcr.io
2626
username: ${{ github.actor }}

.github/workflows/reviewdog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
steps:
1010
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1111
- name: shellcheck
12-
uses: reviewdog/action-shellcheck@6e0e63d1750d02d761b3df0f2c5ba9f9ac4a9ed7 # v1.29.0
12+
uses: reviewdog/action-shellcheck@5ebd09ddbe2ebb471646ce234c6c8dd18663ca7c # v1.30.0
1313
with:
1414
github_token: ${{ github.token }}
1515
reporter: github-pr-review

modules/brew/README.md

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,30 @@
33
The brew module installs [Homebrew / Linuxbrew](https://brew.sh/) on your system and ensures the package manager remains updated and maintained. This module also sets up systemd services to periodically update the installed Brew packages.
44

55
## Features
6-
- Installs Brew at build-time.
6+
- Downloads Brew in build-time & installs it in run-time.
77
- Sets up systemd services to automatically update Brew to the latest version.
88
- Sets up systemd services to automatically upgrade Brew packages.
99
- Sets up bash and fish completions for Brew.
1010

1111
## How it works
1212

13-
### Directory paths glossary:
14-
- `/home/` is a symlink to `/var/home/`
15-
- `/root/` is a symlink to `/var/roothome/`
16-
1713
### Build-time:
1814

19-
- Necessary Brew package dependency `gcc` is installed if not present in the base image
20-
- Directories `/home/` & `/root/` are created
21-
- Empty `.dockerenv` file is created in the root of the image-builder, to convince official Brew installation script that we are **not** running as root
22-
- Official brew installation script is downloaded & executed
23-
- Brew is extracted to `/home/linuxbrew/` by the official script (`/root/` is needed, since image-builds are running as root)
24-
- Brew in `/home/linuxbrew/` is compressed in tar, copied to `/usr/share/homebrew/` & permissions to it are set to default user (UID 1000)
25-
- `brew-update` & `brew-upgrade` SystemD service timers are enabled (by default)
15+
- Necessary Brew package dependency `gcc` & `zstd` is installed if not present in the base image.
16+
- Brew tarball is downloaded from [Universal Blue 'packages' GitHub releases](https://github.com/ublue-os/packages/releases).
17+
- Brew tarball is extracted to `/usr/share/homebrew/`.
18+
- `/usr/share/homebrew/` permissions are set to the default user (UID/GID 1000).
19+
- `brew-update` & `brew-upgrade` SystemD service timers are enabled (by default).
2620
- A fix for path conflicts between system & brew packages with the same name is applied by adding Brew to path only in interactive shells, unlike what Brew does by default.
27-
- Brew bash & fish shell completions are copied to `/etc/profile.d/brew-bash-completions.sh` & `/usr/share/fish/vendor_conf.d/brew-fish-completions.fish`
21+
- Set option that Brew's shell environment can't be ran as root, respecting Homebrew's recommendation that only user with UID/GID 1000 can manage Brew.
22+
- Brew bash & fish shell completions are copied to `/etc/profile.d/brew-bash-completions.sh` & `/usr/share/fish/vendor_conf.d/brew-fish-completions.fish`.
2823
- `tmpfiles.d` configuration `homebrew.conf` is written with these directory locations:
2924
- `/var/lib/homebrew/`
3025
- `/var/cache/homebrew/`
3126
- `/home/linuxbrew/`
32-
- `brew-setup` service is enabled
27+
- `brew-setup` service is enabled.
3328

34-
### Boot-time:
29+
### Run-time:
3530

3631
**`tmpfiles.d homebrew.conf`:**
3732
- This configuration is telling SystemD to: automatically create these necessary directories on every system boot if not available & to give them permissions of the default user (UID 1000):
@@ -40,16 +35,16 @@ The brew module installs [Homebrew / Linuxbrew](https://brew.sh/) on your system
4035
- `/home/linuxbrew/`
4136

4237
**`brew-setup`:**
43-
- `brew-setup` SystemD service checks if main directory used by Brew exists (`/home/linuxbrew/.linuxbrew/`)
44-
& if `brew-setup` state file exists (`/etc/.linuxbrew`)
45-
- If one of those paths don't exist, then Homebrew tar is extracted from `/usr/share/homebrew/homebrew.tar.zst` to `/tmp/homebrew/`
46-
- Extracted Homebrew is then copied from `/tmp/homebrew/` to `/home/linuxbrew/` & permissions to it are set to default user (UID 1000)
47-
- Temporary directory `/tmp/homebrew/` is removed
48-
- Empty file `/etc/.linuxbrew` is created, which indicates that brew-setup (installation) is successful & which allows setup to run again on next boot when removed
38+
- `brew-setup` installs `brew` in runtime.
39+
SystemD service checks if main directory used by Brew exists (`/home/linuxbrew/.linuxbrew/`) & if `brew-setup` state file exists (`/etc/.linuxbrew`).
40+
- If one of those paths don't exist, then extracted Brew tarball is copied from `/usr/share/homebrew/` to `/home/linuxbrew/`.
41+
- Permissions to `/home/linuxbrew/` are set to the default user (UID/GID 1000).
42+
- Empty file `/etc/.linuxbrew` is created, which indicates that brew-setup (installation) is successful & which allows setup to run again on next boot when removed.
4943

5044
**Rest of the setup:**
51-
- `brew-update` runs at the specified time to update Brew to the latest version
52-
- `brew-upgrade` runs at the specified time to upgrade Brew packages
45+
- `brew-update` runs at the specified time to update Brew to the latest version.
46+
- `brew-upgrade` runs at the specified time to upgrade Brew packages.
47+
It additionally unlinks conflicting Brew dependencies if installed, like systemd & dbus, to prevent crucial system programs being preferred by Brew.
5348

5449
## Development
5550
Setting `DEBUG=true` inside `brew.sh` will enable additional output for debugging purposes during development.

modules/brew/brew.sh

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -85,24 +85,18 @@ if [[ -z "${BREW_ANALYTICS}" || "${BREW_ANALYTICS}" == "null" ]]; then
8585
BREW_ANALYTICS=true
8686
fi
8787

88-
# Create necessary directories
89-
mkdir -p /var/home
90-
mkdir -p /var/roothome
91-
92-
# Convince the installer that we are in CI
93-
touch /.dockerenv
94-
95-
# Always install Brew
96-
echo "Downloading and installing Brew..."
97-
curl -fLs --create-dirs https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh -o /tmp/brew-install
98-
echo "Downloaded Brew install script"
99-
chmod +x /tmp/brew-install
100-
/tmp/brew-install
101-
102-
# Move Brew installation and set ownership to default user (UID 1000)
103-
tar --zstd -cvf /usr/share/homebrew.tar.zst /home/linuxbrew/.linuxbrew
104-
cp -R /home/linuxbrew /usr/share/homebrew
105-
chown -R 1000:1000 /usr/share/homebrew
88+
# Download Brew
89+
BREW_TARBALL_LINK="$(curl -fLs https://api.github.com/repos/ublue-os/packages/releases | jq -r '.[] | .assets[] | select(.name? | match("homebrew-x86_64.tar.zst")) | .browser_download_url' | head -n 1)"
90+
echo "Downloading Brew tarball..."
91+
curl -fLs --create-dirs "${BREW_TARBALL_LINK}" -o "/tmp/homebrew-tarball.tar.zst"
92+
echo "Downloaded Brew tarball"
93+
94+
# Extract Brew tarball to /usr/share/homebrew/ and set ownership to default user (UID 1000)
95+
echo "Extracting Brew tarball to '/usr/share/homebrew/'"
96+
mkdir -p "/usr/share/homebrew/"
97+
tar -I zstd --preserve-permissions -xf "/tmp/homebrew-tarball.tar.zst" -C "/usr/share/homebrew/"
98+
echo "Setting '/usr/share/homebrew/' permissions to UID/GID 1000"
99+
chown -R 1000:1000 "/usr/share/homebrew/"
106100

107101
# Write systemd service files dynamically
108102
echo "Writing brew-setup service"
@@ -116,11 +110,8 @@ ConditionPathExists=!/var/home/linuxbrew/.linuxbrew
116110
117111
[Service]
118112
Type=oneshot
119-
ExecStart=/usr/bin/mkdir -p /tmp/homebrew
120-
ExecStart=/usr/bin/tar --zstd -xvf /usr/share/homebrew.tar.zst -C /tmp/homebrew
121-
ExecStart=/usr/bin/cp -R -n /tmp/homebrew/home/linuxbrew/.linuxbrew /var/home/linuxbrew
113+
ExecStart=/usr/bin/cp -R --update=none /usr/share/homebrew/home/linuxbrew/.linuxbrew /var/home/linuxbrew
122114
ExecStart=/usr/bin/chown -R 1000:1000 /var/home/linuxbrew
123-
ExecStart=/usr/bin/rm -rf /tmp/homebrew
124115
ExecStart=/usr/bin/touch /etc/.linuxbrew
125116
126117
[Install]
@@ -159,6 +150,7 @@ Environment=HOMEBREW_CELLAR=/home/linuxbrew/.linuxbrew/Cellar
159150
Environment=HOMEBREW_PREFIX=/home/linuxbrew/.linuxbrew
160151
Environment=HOMEBREW_REPOSITORY=/home/linuxbrew/.linuxbrew/Homebrew
161152
ExecStart=/usr/bin/bash -c "/home/linuxbrew/.linuxbrew/bin/brew upgrade"
153+
ExecStartPost=/usr/bin/bash -c "/home/linuxbrew/.linuxbrew/bin/brew unlink systemd dbus || true"
162154
EOF
163155

164156
# Write systemd timer files dynamically
@@ -236,7 +228,7 @@ d /var/home/linuxbrew 0755 1000 1000 - -
236228
EOF
237229

238230
# Enable the setup service
239-
echo "Enabling brew-setup service"
231+
echo "Enabling brew-setup service to install Brew in run-time"
240232
systemctl enable brew-setup.service
241233

242234
# Always enable or disable update and upgrade services for consistency

modules/gnome-extensions/gnome-extensions.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,13 @@ if [[ ${#INSTALL[@]} -gt 0 ]]; then
115115
# Locale is not crucial for extensions to work, as they will fallback to gschema.xml
116116
# Some of them might not have any locale at the moment
117117
# So that's why I made a check for directory
118+
# I made an additional check if language files are available, in case if extension is packaged with an empty folder, like with Default Workspace extension
118119
if [[ -d "${TMP_DIR}/locale" ]]; then
119-
echo "Installing language extension files"
120-
install -d -m 0755 "/usr/share/locale/"
121-
cp -r "${TMP_DIR}/locale"/* "/usr/share/locale/"
120+
if ls "${TMP_DIR}/locale/"*.mo 1> /dev/null 2>&1; then
121+
echo "Installing language extension files"
122+
install -d -m 0755 "/usr/share/locale/"
123+
cp -r "${TMP_DIR}/locale"/* "/usr/share/locale/"
124+
fi
122125
fi
123126
# Delete the temporary directory
124127
echo "Cleaning up the temporary directory"
@@ -221,10 +224,13 @@ if [[ ${#INSTALL[@]} -gt 0 ]] && ! "${LEGACY}"; then
221224
# Locale is not crucial for extensions to work, as they will fallback to gschema.xml
222225
# Some of them might not have any locale at the moment
223226
# So that's why I made a check for directory
227+
# I made an additional check if language files are available, in case if extension is packaged with an empty folder, like with Default Workspace extension
224228
if [[ -d "${TMP_DIR}/locale" ]]; then
225-
echo "Installing language extension files"
226-
install -d -m 0755 "/usr/share/locale/"
227-
cp -r "${TMP_DIR}/locale"/* "/usr/share/locale/"
229+
if ls "${TMP_DIR}/locale/"*.mo 1> /dev/null 2>&1; then
230+
echo "Installing language extension files"
231+
install -d -m 0755 "/usr/share/locale/"
232+
cp -r "${TMP_DIR}/locale"/* "/usr/share/locale/"
233+
fi
228234
fi
229235
# Delete the temporary directory
230236
echo "Cleaning up the temporary directory"

modules/yafti/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,12 @@ Also Yafti's dependencies, `python3-pip` and `libadwaita` are installed.
77
Optionally, a list of Flatpak names and IDs can be included under `custom-flatpaks:`. These will be enabled by default under their own section on the Flatpak installation screen of `yafti`.
88

99
A default version of the `yafti` configuration file, `yafti.yml`, is supplied by this module. To make your own, create the file at `/usr/share/ublue-os/firstboot/yafti.yml`. The default version of the file can be found [here](https://github.com/blue-build/modules/blob/main/modules/yafti/yafti.yml).
10+
11+
## Known issues
12+
13+
Yafti autostart doesn't work on WMs (Window Managers) like Sway or Hyprland due to them not implementing XDG-Autostart specification.
14+
15+
https://github.com/swaywm/sway/issues/1423
16+
https://github.com/hyprwm/Hyprland/issues/5169
17+
18+
Usage of [dex](https://github.com/jceb/dex) in the affected WMs can be considered to mitigate this issue.

modules/yafti/yafti.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ FIRSTBOOT_DATA="/usr/share/ublue-os/firstboot"
99

1010
mkdir -p "$FIRSTBOOT_DATA/launcher/"
1111

12-
# doesn't overwrite user's yafti.yml (ignores error)
13-
cp -n "$MODULE_DIRECTORY/yafti/yafti.yml" "$FIRSTBOOT_DATA/yafti.yml" || true
12+
# doesn't overwrite user's yafti.yml
13+
cp --update=none "$MODULE_DIRECTORY/yafti/yafti.yml" "$FIRSTBOOT_DATA/yafti.yml"
1414
cp -r "$MODULE_DIRECTORY/yafti/launcher/" "$FIRSTBOOT_DATA"
1515

1616
FIRSTBOOT_SCRIPT="${FIRSTBOOT_DATA}/launcher/login-profile.sh"

0 commit comments

Comments
 (0)