Skip to content

Commit 5f13d9d

Browse files
authored
Merge branch 'main' into nu-flatpaks
2 parents 832041a + 8ceb728 commit 5f13d9d

17 files changed

+242
-41
lines changed

build-individual.nu

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ let images = ls modules | each { |moduleDir|
6666
let latest = ($versioned | last)
6767
($versioned
6868
| update (($versioned | length) - 1) # update the last / latest item in list
69-
($latest | update "tags" ($latest.tags | append latest_tag)) # append tag which should only be given to the latest version
69+
($latest | update "tags" ($latest.tags | append $latest_tag)) # append tag which should only be given to the latest version
7070
)
7171

7272
}
@@ -94,4 +94,4 @@ $images | par-each { |img|
9494

9595
}
9696

97-
print $"(ansi green_bold)DONE!(ansi reset)"
97+
print $"(ansi green_bold)DONE!(ansi reset)"

modules.json

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"https://raw.githubusercontent.com/blue-build/modules/main/modules/gschema-overrides/module.yml",
1111
"https://raw.githubusercontent.com/blue-build/modules/main/modules/justfiles/module.yml",
1212
"https://raw.githubusercontent.com/blue-build/modules/main/modules/rpm-ostree/module.yml",
13+
"https://raw.githubusercontent.com/blue-build/modules/main/modules/initramfs/module.yml",
1314
"https://raw.githubusercontent.com/blue-build/modules/main/modules/script/module.yml",
1415
"https://raw.githubusercontent.com/blue-build/modules/main/modules/signing/module.yml",
1516
"https://raw.githubusercontent.com/blue-build/modules/main/modules/systemd/module.yml",

modules/akmods/akmods.tsp

+8-4
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,19 @@ model AkmodsModule {
99
type: "akmods";
1010

1111
/** The kernel your images uses.
12-
* - main: stock kernel / main and nvidia images
12+
* - main: stock Fedora kernel / main and nvidia images
1313
* - asus: asus kernel / asus images
14-
* - fsync: fsync kernel / bazzite images
14+
* - fsync: fsync kernel / not used in any Universal Blue images
15+
* - fsync-ba: fsync kernel, stable version / not used in any Universal Blue images
1516
* - surface: surface kernel / surface images
17+
* - coreos-stable: stock CoreOS kernel / uCore stable images
18+
* - coreos-testing: stock CoreOS Testing kernel / uCore testing images
19+
* - bazzite: Bazzite's kernel / bazzite images
1620
*/
17-
base?: "main" | "asus" | "fsync" | "surface" = "main";
21+
base?: "main" | "asus" | "fsync" | "fsync-ba" | "surface" | "coreos-stable" | "coreos-testing" | "bazzite" = "main";
1822

1923
/** List of akmods to install.
2024
* See all available akmods here: https://github.com/ublue-os/akmods#kmod-packages
2125
*/
2226
install: Array<string>;
23-
}
27+
}

modules/bling/installers/negativo17.sh

+16-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,29 @@
44
set -euo pipefail
55

66
# Check if rpmfusion is installed before running
7-
if rpm -q rpmfusion-free-release &>/dev/null || rpm -q rpmfusion-nonfree-release &>/dev/null; then
8-
echo "Uninstalling RPMFusion repo..."
7+
if rpm -q rpmfusion-free-release &>/dev/null || rpm -q rpmfusion-nonfree-release &>/dev/null || rpm -q rpmfusion-free-release-tainted &>/dev/null || rpm -q rpmfusion-nonfree-release-tainted &>/dev/null; then
8+
if rpm -q rpmfusion-free-release &>/dev/null || rpm -q rpmfusion-nonfree-release &>/dev/null; then
9+
echo "Uninstalling RPMFusion repos..."
10+
fi
911
if rpm -q rpmfusion-free-release &>/dev/null && rpm -q rpmfusion-nonfree-release &>/dev/null; then
1012
rpm-ostree uninstall rpmfusion-free-release rpmfusion-nonfree-release
1113
elif rpm -q rpmfusion-free-release &>/dev/null; then
1214
rpm-ostree uninstall rpmfusion-free-release
1315
elif rpm -q rpmfusion-nonfree-release &>/dev/null; then
1416
rpm-ostree uninstall rpmfusion-nonfree-release
1517
fi
18+
if rpm -q rpmfusion-free-release &>/dev/null || rpm -q rpmfusion-nonfree-release &>/dev/null; then
19+
echo "Uninstalling tainted RPMFusion repos..."
20+
fi
21+
if rpm -q rpmfusion-free-release-tainted &>/dev/null && rpm -q rpmfusion-nonfree-release-tainted &>/dev/null; then
22+
rpm-ostree uninstall rpmfusion-free-release-tainted rpmfusion-nonfree-release-tainted
23+
elif rpm -q rpmfusion-free-release-tainted &>/dev/null; then
24+
rpm-ostree uninstall rpmfusion-free-release-tainted
25+
elif rpm -q rpmfusion-nonfree-release-tainted &>/dev/null; then
26+
rpm-ostree uninstall rpmfusion-nonfree-release-tainted
27+
fi
28+
else
29+
echo "All RPMFusion repos are already uninstalled"
1630
fi
1731

1832
NEGATIVO_REPO_FILE="$(awk -F'=' '$1 == "name" && $2 == "negativo17 - Multimedia" {print FILENAME}' /etc/yum.repos.d/*)"

modules/bling/installers/rpmfusion.sh

+20-4
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,40 @@ set -euo pipefail
66
NEGATIVO_REPO_FILE="$(awk -F'=' '$1 == "name" && $2 == "negativo17 - Multimedia" {print FILENAME}' /etc/yum.repos.d/*)"
77

88
# Check if rpmfusion is already installed before running
9-
if ! rpm -q rpmfusion-free-release &>/dev/null || ! rpm -q rpmfusion-nonfree-release &>/dev/null; then
10-
echo "Running RPMFusion repo install..."
9+
if ! rpm -q rpmfusion-free-release &>/dev/null || ! rpm -q rpmfusion-nonfree-release &>/dev/null || ! rpm -q rpmfusion-free-release-tainted &>/dev/null || ! rpm -q rpmfusion-nonfree-release-tainted &>/dev/null; then
10+
if ! rpm -q rpmfusion-free-release &>/dev/null || ! rpm -q rpmfusion-nonfree-release &>/dev/null; then
11+
echo "Running RPMFusion repos install..."
12+
fi
1113
if ! rpm -q rpmfusion-free-release &>/dev/null && ! rpm -q rpmfusion-nonfree-release &>/dev/null; then
1214
rpm-ostree install \
1315
"https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-${OS_VERSION}.noarch.rpm" \
1416
"https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-${OS_VERSION}.noarch.rpm"
1517
elif ! rpm -q rpmfusion-free-release &>/dev/null; then
1618
rpm-ostree install \
17-
"https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-free-release-${OS_VERSION}.noarch.rpm"
19+
"https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-${OS_VERSION}.noarch.rpm"
1820
elif ! rpm -q rpmfusion-nonfree-release &>/dev/null; then
1921
rpm-ostree install \
2022
"https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-${OS_VERSION}.noarch.rpm"
2123
fi
24+
if ! rpm -q rpmfusion-free-release-tainted &>/dev/null || ! rpm -q rpmfusion-nonfree-release-tainted &>/dev/null; then
25+
echo "Installing tainted RPMFusion repos"
26+
fi
27+
if ! rpm -q rpmfusion-free-release-tainted &>/dev/null && ! rpm -q rpmfusion-nonfree-release-tainted &>/dev/null; then
28+
rpm-ostree install \
29+
rpmfusion-free-release-tainted \
30+
rpmfusion-nonfree-release-tainted
31+
elif ! rpm -q rpmfusion-free-release-tainted &>/dev/null; then
32+
rpm-ostree install \
33+
rpmfusion-free-release-tainted
34+
elif ! rpm -q rpmfusion-nonfree-release-tainted &>/dev/null; then
35+
rpm-ostree install \
36+
rpmfusion-nonfree-release-tainted
37+
fi
2238
# check if negativo17 repo is installed
2339
if [[ -n "${NEGATIVO_REPO_FILE}" ]]; then
2440
echo "Making sure that Negativo17 repo is disabled"
2541
sed -i 's@enabled=1@enabled=0@g' "${NEGATIVO_REPO_FILE}"
2642
fi
2743
else
28-
echo "RPMFusion repo is already installed"
44+
echo "RPMFusion repos are already installed"
2945
fi

modules/bling/module.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ shortdesc: The bling module can be used to pull in small "bling" into your image
33
example: |
44
type: bling
55
install:
6-
- rpmfusion # install RPMFusion repos, disable negativo17 repos if installed
6+
- rpmfusion # install RPMFusion repos, including tainted repos & disable negativo17 repos if installed
77
- negativo17 # install negativo17 repos and set priority to 90, uninstall RPMFusion repos if installed
88
- ublue-update # https://github.com/ublue-os/ublue-update
99
- 1password # install 1Password (stable) and `op` CLI tool

modules/gnome-extensions/gnome-extensions.tsp

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ model GnomeExtensionsModule {
1111
/** List of GNOME extensions to install.
1212
* (case sensitive extension names or extension IDs from https://extensions.gnome.org/)
1313
*/
14-
install?: Array<string>;
14+
install?: Array<string | integer>;
1515

1616
/** List of system GNOME extensions to uninstall.
1717
* Only use this to remove extensions not installed by your package manager. Those extensions should be uninstalled using the package manager instead.

modules/initramfs/README.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# `initramfs`
2+
3+
:::caution
4+
This module is only supported for Fedora 41+ images.
5+
:::
6+
7+
The `initramfs` module is used to regenerate initramfs, which is the temporary file system loaded into RAM, as part of the early Linux startup process, used by many things happening during boot.
8+
9+
If you are trying to modify something related to the kernel or boot sequence (such as plymouth), but you don't see any changes applied to the system, you'll likely need to use this module.
10+
11+
You need to regenerate initramfs at least when doing any of the following:
12+
- modifying `modprobe.d` config files
13+
- modifying `modules-load.d` config files
14+
- modifying `dracut.conf.d` config files
15+
- customizing `plymouth` theming
16+
- other unknown modifications
17+
18+
You only need to run the regeneration once per build, not separately for each modification requiring it. It is recommended to set this module as one of the last in your recipe, to ensure that initramfs regeneration will cover all the modifications done before it.
19+
20+
:::note
21+
Client-side initramfs regeneration like `rpm-ostree initramfs` & `rpm-ostree initramfs-etc` are for local-users only & not to be confused with this module's build-time initramfs regeneration.
22+
This module regenerates the system initramfs during the build process, while `rpm-ostree initramfs` & `rpm-ostree initramfs-etc` regenerate the local initramfs on top of the system one every update on the local-user's system.
23+
:::

modules/initramfs/initramfs.sh

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
if ! command -v rpm-ostree &> /dev/null || ! command -v bootc &> /dev/null; then
6+
echo "This module is only compatible with Fedora Atomic images"
7+
exit 1
8+
fi
9+
10+
if [[ "${OS_VERSION}" -le 40 ]]; then
11+
echo "This module is only compatible with Fedora 41+ images."
12+
exit 1
13+
fi
14+
15+
# If images already installed cliwrap, use it. Only used in transition period, so it should be removed when base images like Ublue remove cliwrap
16+
if [[ -f "/usr/libexec/rpm-ostree/wrapped/dracut" ]]; then
17+
DRACUT="/usr/libexec/rpm-ostree/wrapped/dracut"
18+
else
19+
DRACUT="/usr/bin/dracut"
20+
fi
21+
22+
# NOTE!
23+
# This won't work when Fedora starts to utilize UKIs (Unified Kernel Images).
24+
# UKIs will contain kernel + initramfs + bootloader.
25+
# Refactor the module to support UKIs once they are starting to be used, if possible.
26+
# That won't be soon, so this module should work for good period of time
27+
28+
KERNEL_MODULES_PATH="/usr/lib/modules"
29+
readarray -t QUALIFIED_KERNEL < <(find "${KERNEL_MODULES_PATH}" -mindepth 1 -maxdepth 1 -type d -printf "%f\n")
30+
31+
if [[ "${#QUALIFIED_KERNEL[@]}" -gt 1 ]]; then
32+
echo "ERROR: There are several versions of kernel's initramfs."
33+
echo " Cannot determine which one to regenerate."
34+
echo " There is a possibility that you have multiple kernels installed in the image."
35+
echo " Please only include 1 kernel in the image to solve this issue."
36+
exit 1
37+
fi
38+
39+
INITRAMFS_IMAGE="${KERNEL_MODULES_PATH}/${QUALIFIED_KERNEL[*]}/initramfs.img"
40+
41+
echo "Starting initramfs regeneration for kernel version: ${QUALIFIED_KERNEL[*]}"
42+
43+
"${DRACUT}" --no-hostonly --kver "${QUALIFIED_KERNEL[*]}" --reproducible -v --add ostree -f "${INITRAMFS_IMAGE}"
44+
chmod 0600 "${INITRAMFS_IMAGE}"

modules/initramfs/initramfs.tsp

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import "@typespec/json-schema";
2+
using TypeSpec.JsonSchema;
3+
4+
@jsonSchema("/modules/initramfs.json")
5+
model InitramfsModule {
6+
/** The initramfs module is used to regenerate initramfs, needed to apply some modifications early in the Linux startup process.
7+
* https://blue-build.org/reference/modules/initramfs/
8+
*/
9+
type: "initramfs";
10+
}

modules/initramfs/module.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
name: initramfs
2+
shortdesc: The `initramfs` module is used to regenerate initramfs, needed to apply some modifications early in the Linux startup process
3+
example: |
4+
type: initramfs

modules/rpm-ostree/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The module can also replace base RPM packages with packages from COPR repo. Unde
2626
[Removed packages are still present in the underlying ostree repository](https://coreos.github.io/rpm-ostree/administrator-handbook/#removing-a-base-package), what `remove` does is kind of like hiding them from the system, it doesn't free up storage space.
2727
:::
2828

29-
Additionally, the `rpm-ostree` module supports a temporary (waiting for `rpm-ostree` issue [#233](https://github.com/coreos/rpm-ostree/issues/233)) fix for packages that install into `/opt/`. Installation for packages that install into folder names declared under `optfix:` are fixed using some symlinks.
29+
Additionally, the `rpm-ostree` module supports a temporary (waiting for `rpm-ostree` issue [#233](https://github.com/coreos/rpm-ostree/issues/233)) fix for packages that install into `/opt/`. Installation for packages that install into folder names declared under `optfix:` are fixed using some symlinks. Directory path in `/opt/` for those packages should be provided in recipe, like in Example Configuration.
3030

3131
## Known issues
3232

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[Unit]
2+
Description=Create symbolic links for directories in /usr/lib/opt/ to /var/opt/
3+
After=multi-user.target
4+
5+
[Service]
6+
Type=oneshot
7+
ExecStart=/usr/libexec/bluebuild/optfix.sh
8+
RemainAfterExit=no
9+
10+
[Install]
11+
WantedBy=default.target

modules/rpm-ostree/module.yml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ example: |
99
- https://brave-browser-rpm-release.s3.brave.com/brave-core.asc
1010
optfix:
1111
- Tabby # needed because tabby installs into /opt/Tabby
12+
- brave.com
1213
install:
1314
- starship
1415
- brave-browser

modules/rpm-ostree/optfix.sh

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
SOURCE_DIR="/usr/lib/opt/"
6+
TARGET_DIR="/var/opt/"
7+
8+
# Ensure the target directory exists
9+
mkdir -p "$TARGET_DIR"
10+
11+
# Loop through directories in the source directory
12+
for dir in "$SOURCE_DIR"*/; do
13+
if [ -d "$dir" ]; then
14+
# Get the base name of the directory
15+
dir_name=$(basename "$dir")
16+
17+
# Check if the symlink already exists in the target directory
18+
if [ -L "$TARGET_DIR/$dir_name" ]; then
19+
echo "Symlink already exists for $dir_name, skipping."
20+
continue
21+
fi
22+
23+
# Create the symlink
24+
ln -s "$dir" "$TARGET_DIR/$dir_name"
25+
echo "Created symlink for $dir_name"
26+
fi
27+
done

modules/rpm-ostree/rpm-ostree.sh

+30-4
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,32 @@ fi
4242
# Create symlinks to fix packages that create directories in /opt
4343
get_json_array OPTFIX 'try .["optfix"][]' "$1"
4444
if [[ ${#OPTFIX[@]} -gt 0 ]]; then
45+
LIB_EXEC_DIR="/usr/libexec/bluebuild"
46+
SYSTEMD_DIR="/etc/systemd/system"
47+
MODULE_DIR="/tmp/modules/rpm-ostree"
48+
49+
if ! [ -x "${LIB_EXEC_DIR}/optfix.sh" ]; then
50+
mkdir -p "${LIB_EXEC_DIR}"
51+
cp "${MODULE_DIR}/optfix.sh" "${LIB_EXEC_DIR}/"
52+
chmod +x "${LIB_EXEC_DIR}/optfix.sh"
53+
fi
54+
55+
if ! [ -f "${SYSTEMD_DIR}/bluebuild-optfix.service" ]; then
56+
cp "${MODULE_DIR}/bluebuild-optfix.service" "${SYSTEMD_DIR}/"
57+
systemctl enable bluebuild-optfix.service
58+
fi
59+
4560
echo "Creating symlinks to fix packages that install to /opt"
4661
# Create symlink for /opt to /var/opt since it is not created in the image yet
4762
mkdir -p "/var/opt"
48-
ln -s "/var/opt" "/opt"
63+
ln -fs "/var/opt" "/opt"
64+
4965
# Create symlinks for each directory specified in recipe.yml
5066
for OPTPKG in "${OPTFIX[@]}"; do
5167
OPTPKG="${OPTPKG%\"}"
5268
OPTPKG="${OPTPKG#\"}"
5369
mkdir -p "/usr/lib/opt/${OPTPKG}"
54-
ln -s "../../usr/lib/opt/${OPTPKG}" "/var/opt/${OPTPKG}"
70+
ln -fs "/usr/lib/opt/${OPTPKG}" "/var/opt/${OPTPKG}"
5571
echo "Created symlinks for ${OPTPKG}"
5672
done
5773
fi
@@ -73,8 +89,9 @@ if [[ ${#INSTALL_PKGS[@]} -gt 0 ]]; then
7389
HTTPS_INSTALL=true
7490
HTTPS_PKGS+=("${INSTALL_PKGS[$i]}")
7591
elif [[ ! "${PKG}" =~ ^https?:\/\/.* ]] && [[ -f "${CONFIG_DIRECTORY}/rpm-ostree/${PKG}" ]]; then
92+
INSTALL_PKGS[$i]="${CONFIG_DIRECTORY}/rpm-ostree/${PKG}"
7693
LOCAL_INSTALL=true
77-
LOCAL_PKGS+=("${CONFIG_DIRECTORY}/rpm-ostree/${PKG}")
94+
LOCAL_PKGS+=("${INSTALL_PKGS[$i]}")
7895
else
7996
CLASSIC_INSTALL=true
8097
CLASSIC_PKGS+=("${PKG}")
@@ -116,12 +133,21 @@ if [[ ${#INSTALL_PKGS[@]} -gt 0 && ${#REMOVE_PKGS[@]} -gt 0 ]]; then
116133
elif ${CLASSIC_INSTALL} && ${HTTPS_INSTALL} && ! ${LOCAL_INSTALL}; then
117134
rpm-ostree override remove "${REMOVE_PKGS[@]}" $(printf -- "--install=%s " "${CLASSIC_PKGS[@]}")
118135
rpm-ostree install "${HTTPS_PKGS[@]}"
119-
elif ${CLASSIC_INSTALL} && ! ${HTTPS_INSTALL} && ! ${LOCAL_INSTALL}; then
136+
elif ${CLASSIC_INSTALL} && ! ${HTTPS_INSTALL} && ${LOCAL_INSTALL}; then
120137
rpm-ostree override remove "${REMOVE_PKGS[@]}" $(printf -- "--install=%s " "${CLASSIC_PKGS[@]}")
121138
rpm-ostree install "${LOCAL_PKGS[@]}"
122139
elif ${CLASSIC_INSTALL} && ${HTTPS_INSTALL} && ${LOCAL_INSTALL}; then
123140
rpm-ostree override remove "${REMOVE_PKGS[@]}" $(printf -- "--install=%s " "${CLASSIC_PKGS[@]}")
124141
rpm-ostree install "${HTTPS_PKGS[@]}" "${LOCAL_PKGS[@]}"
142+
elif ! ${CLASSIC_INSTALL} && ! ${HTTPS_INSTALL} && ${LOCAL_INSTALL}; then
143+
rpm-ostree override remove "${REMOVE_PKGS[@]}"
144+
rpm-ostree install "${LOCAL_PKGS[@]}"
145+
elif ! ${CLASSIC_INSTALL} && ${HTTPS_INSTALL} && ! ${LOCAL_INSTALL}; then
146+
rpm-ostree override remove "${REMOVE_PKGS[@]}"
147+
rpm-ostree install "${HTTPS_PKGS[@]}"
148+
elif ! ${CLASSIC_INSTALL} && ${HTTPS_INSTALL} && ${LOCAL_INSTALL}; then
149+
rpm-ostree override remove "${REMOVE_PKGS[@]}"
150+
rpm-ostree install "${HTTPS_PKGS[@]}" "${LOCAL_PKGS[@]}"
125151
fi
126152
elif [[ ${#INSTALL_PKGS[@]} -gt 0 ]]; then
127153
echo "Installing RPMs"

0 commit comments

Comments
 (0)