Skip to content

Commit

Permalink
chore: un-cliwrap and use dnf5 instead of rpm-ostree (#174)
Browse files Browse the repository at this point in the history
* chore: un-cliwrap and use dnf5 instead of rpm-ostree

I've been tinkering with and testing dnf5 for a while.

Key items are:
- ensuring cliwrap is properly unwound (checked rpm-ostree Rust code)
- using normal (not wrapped) binaries, eg for dracut
- and the more obvious, replacing "rpm-ostree install" with "dnf5
  install", etc

Relates: #1946

* remove build-fix since not needed with dnf5

* convert a few more commands from rpm-ostree to dnf5

the nvidia script from hwe repo had been missed before
the logo swap is new

* Update 03-install-kernel-akmods.sh

* Update 03-install-kernel-akmods.sh

* Update 03-install-kernel-akmods.sh

* Update 02-install-kernel-akmods-dx.sh

* Update 09-hwe-additions.sh

* Appease the linter

* fix: Install kernel-devel

* Update 05-override-install.sh

* Update 07-base-image-changes.sh

* Update 03-install-kernel-akmods.sh

* Delete build_files/base/01-build-fix.sh

* Update 05-override-install.sh

* Update 05-override-install.sh

---------

Co-authored-by: Benjamin Sherman <[email protected]>
Co-authored-by: m2 <[email protected]>
Co-authored-by: Niklas <[email protected]>
  • Loading branch information
4 people authored Feb 5, 2025
1 parent d81321e commit 6fcdce4
Show file tree
Hide file tree
Showing 16 changed files with 131 additions and 160 deletions.
6 changes: 4 additions & 2 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ ARG UBLUE_IMAGE_TAG="stable"
ARG VERSION=""

# Build, cleanup, commit.
RUN --mount=type=cache,dst=/var/cache/rpm-ostree \
RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=ctx,source=/,target=/ctx \
/ctx/build_files/shared/build-base.sh

Expand All @@ -38,6 +39,7 @@ ARG UBLUE_IMAGE_TAG="stable"
ARG VERSION=""

# Build, Clean-up, Commit
RUN --mount=type=cache,dst=/var/cache/rpm-ostree \
RUN --mount=type=cache,dst=/var/cache/libdnf5 \
--mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=ctx,source=/,target=/ctx \
/ctx/build_files/shared/build-dx.sh
60 changes: 0 additions & 60 deletions build_files/base/01-build-fix.sh

This file was deleted.

15 changes: 7 additions & 8 deletions build_files/base/02-install-copr-repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@ echo "::group:: ===$(basename "$0")==="
set -eoux pipefail

# Add Staging repo
curl --retry 3 -Lo /etc/yum.repos.d/ublue-os-staging-fedora-"$(rpm -E %fedora)".repo \
https://copr.fedorainfracloud.org/coprs/ublue-os/staging/repo/fedora-"$(rpm -E %fedora)"/ublue-os-staging-fedora-"$(rpm -E %fedora)".repo
dnf5 -y copr enable ublue-os/staging

# Add Switcheroo Repo
curl --retry 3 -Lo /etc/yum.repos.d/_copr_sentry-switcheroo-control_discrete.repo \
https://copr.fedorainfracloud.org/coprs/sentry/switcheroo-control_discrete/repo/fedora-"$(rpm -E %fedora)"/sentry-switcheroo-control_discrete-fedora-"$(rpm -E %fedora)".repo

# Add Nerd Fonts Repo
curl --retry 3 -Lo /etc/yum.repos.d/_copr_che-nerd-fonts-"$(rpm -E %fedora)".repo https://copr.fedorainfracloud.org/coprs/che/nerd-fonts/repo/fedora-"$(rpm -E %fedora)"/che-nerd-fonts-fedora-"$(rpm -E %fedora)".repo
dnf5 -y copr enable sentry/switcheroo-control_discrete

# Add openrazer repo
curl -Lo /etc/yum.repos.d/hardware:razer.repo https://openrazer.github.io/hardware:razer.repo

echo "::endgroup::"
# Enable Nerd fonts repo
dnf5 -y copr enable che/nerd-fonts


echo "::endgroup::"
27 changes: 17 additions & 10 deletions build_files/base/03-install-kernel-akmods.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,40 @@ tar -xvzf /tmp/kernel-rpms/"$KERNEL_TARGZ" -C /
mv /tmp/rpms/* /tmp/kernel-rpms/

# Install Kernel
rpm-ostree install \
dnf5 -y install \
/tmp/kernel-rpms/kernel-[0-9]*.rpm \
/tmp/kernel-rpms/kernel-core-*.rpm \
/tmp/kernel-rpms/kernel-modules-*.rpm

# TODO: Figure out why akmods cache is pulling in akmods/kernel-devel
dnf5 -y install \
/tmp/kernel-rpms/kernel-devel-*.rpm

dnf5 versionlock add kernel kernel-devel kernel-devel-matched kernel-core kernel-modules kernel-modules-core kernel-modules-extra

# Fetch Common AKMODS
skopeo copy --retry-times 3 docker://ghcr.io/ublue-os/akmods:"${AKMODS_FLAVOR}"-"$(rpm -E %fedora)"-"${KERNEL}" dir:/tmp/akmods
AKMODS_TARGZ=$(jq -r '.layers[].digest' < /tmp/akmods/manifest.json | cut -d : -f 2)
tar -xvzf /tmp/akmods/"$AKMODS_TARGZ" -C /tmp/
mv /tmp/rpms/* /tmp/akmods/

# Everyone
# NOTE: we won't use dnf5 copr plugin for ublue-os/akmods until our upstream provides the COPR standard naming
sed -i 's@enabled=0@enabled=1@g' /etc/yum.repos.d/_copr_ublue-os-akmods.repo
rpm-ostree install \
dnf5 -y install \
/tmp/akmods/kmods/*xone*.rpm \
/tmp/akmods/kmods/*xpadneo*.rpm \
/tmp/akmods/kmods/*openrazer*.rpm \
/tmp/akmods/kmods/*framework-laptop*.rpm

# RPMFUSION Dependent AKMODS
rpm-ostree install \
https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-"$(rpm -E %fedora)".noarch.rpm \
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-"$(rpm -E %fedora)".noarch.rpm
rpm-ostree install \
dnf5 -y install \
https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
dnf5 -y install \
broadcom-wl /tmp/akmods/kmods/*wl*.rpm \
v4l2loopback /tmp/akmods/kmods/*v4l2loopback*.rpm
rpm-ostree uninstall rpmfusion-free-release rpmfusion-nonfree-release
dnf5 -y remove rpmfusion-free-release rpmfusion-nonfree-release

# Nvidia AKMODS
if [[ "${IMAGE_NAME}" =~ nvidia ]]; then
Expand All @@ -58,7 +65,7 @@ if [[ "${IMAGE_NAME}" =~ nvidia ]]; then
mv /tmp/rpms/* /tmp/akmods-rpms/

# Install Nvidia RPMs
curl -Lo /tmp/nvidia-install.sh https://raw.githubusercontent.com/ublue-os/hwe/main/nvidia-install.sh
curl -Lo /tmp/nvidia-install.sh https://raw.githubusercontent.com/ublue-os/hwe/main/nvidia-install.sh # Change when nvidia-install.sh updates
chmod +x /tmp/nvidia-install.sh
IMAGE_NAME="${BASE_IMAGE_NAME}" RPMFUSION_MIRROR="" /tmp/nvidia-install.sh
rm -f /usr/share/vulkan/icd.d/nouveau_icd.*.json
Expand Down Expand Up @@ -86,11 +93,11 @@ if [[ ${AKMODS_FLAVOR} =~ coreos ]]; then
)

# Install
rpm-ostree install "${ZFS_RPMS[@]}"
dnf5 -y install "${ZFS_RPMS[@]}"

# Depmod and autoload
depmod -a -v "${KERNEL}"
echo "zfs" > /usr/lib/modules-load.d/zfs.conf
fi

echo "::endgroup::"
echo "::endgroup::"
11 changes: 6 additions & 5 deletions build_files/base/04-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ fi

# simple case to install where no packages need excluding
if [[ "${#INCLUDED_PACKAGES[@]}" -gt 0 && "${#INSTALLED_EXCLUDED_PACKAGES[@]}" -eq 0 ]]; then
rpm-ostree install \
dnf5 -y install \
${INCLUDED_PACKAGES[@]}

# install/excluded packages both at same time
elif [[ "${#INCLUDED_PACKAGES[@]}" -gt 0 && "${#INSTALLED_EXCLUDED_PACKAGES[@]}" -gt 0 ]]; then
rpm-ostree override remove \
${INSTALLED_EXCLUDED_PACKAGES[@]} \
$(printf -- "--install=%s " ${INCLUDED_PACKAGES[@]})
dnf5 -y remove \
${INSTALLED_EXCLUDED_PACKAGES[@]} && \
dnf5 -y install \
${INCLUDED_PACKAGES[@]}
else
echo "No packages to install."
fi
Expand All @@ -48,7 +49,7 @@ fi

# remove any excluded packages which are still present on image
if [[ "${#INSTALLED_EXCLUDED_PACKAGES[@]}" -gt 0 ]]; then
rpm-ostree override remove \
dnf5 -y remove \
${INSTALLED_EXCLUDED_PACKAGES[@]}
fi

Expand Down
49 changes: 21 additions & 28 deletions build_files/base/05-override-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@ echo "::group:: ===$(basename "$0")==="

set -eoux pipefail


# Patched shell
rpm-ostree override replace \
--experimental \
--from repo=copr:copr.fedorainfracloud.org:ublue-os:staging \
kf6-kio-doc \
kf6-kio-widgets-libs \
kf6-kio-core-libs \
kf6-kio-widgets \
kf6-kio-file-widgets \
kf6-kio-core \
kf6-kio-gui
dnf5 -y swap \
--repo=copr:copr.fedorainfracloud.org:ublue-os:staging \
kf6-kio kf6-kio


# Make sure KDE Frameworks and our kf6-kio are on the same version
kf6_version=$(rpm -qi kf6-kcoreaddons | awk '/^Version/ {print $3}')
Expand All @@ -26,29 +21,27 @@ if [[ "$kf6_version" != "$kf6_kio_version" ]]; then
fi

# Fix for ID in fwupd
rpm-ostree override replace \
--experimental \
--from repo=copr:copr.fedorainfracloud.org:ublue-os:staging \
fwupd \
fwupd-plugin-flashrom \
fwupd-plugin-modem-manager \
fwupd-plugin-uefi-capsule-data
dnf5 -y swap \
--repo=copr:copr.fedorainfracloud.org:ublue-os:staging \
fwupd fwupd

# Switcheroo patch
rpm-ostree override replace \
--experimental \
--from repo=copr:copr.fedorainfracloud.org:sentry:switcheroo-control_discrete \
switcheroo-control
dnf5 -y swap \
--repo=copr:copr.fedorainfracloud.org:sentry:switcheroo-control_discrete \
switcheroo-control switcheroo-control

rm /etc/yum.repos.d/_copr_sentry-switcheroo-control_discrete.repo
dnf5 -y copr remove sentry/switcheroo-control_discrete

# TODO: Fedora 41 specific -- re-evaluate with Fedora 42
# negativo's libheif is broken somehow on older Intel machines
# https://github.com/ublue-os/aurora/issues/8
rpm-ostree override replace \
--experimental \
--from repo=fedora \
libheif heif-pixbuf-loader
dnf5 -y swap \
--repo=fedora \
libheif libheif

dnf5 -y swap \
--repo=fedora \
heif-pixbuf-loader heif-pixbuf-loader

# Starship Shell Prompt
curl --retry 3 -Lo /tmp/starship.tar.gz "https://github.com/starship/starship/releases/latest/download/starship-x86_64-unknown-linux-gnu.tar.gz"
Expand All @@ -64,7 +57,7 @@ curl --retry 3 -Lo /usr/share/bash-prexec https://raw.githubusercontent.com/rcal
pip install --prefix=/usr topgrade

# Install ublue-update -- breaks with packages.json due to missing topgrade
rpm-ostree install ublue-update
dnf5 -y install ublue-update

# Consolidate Just Files
find /tmp/just -iname '*.just' -exec printf "\n\n" \; -exec cat {} \; >> /usr/share/ublue-os/just/60-custom.just
Expand All @@ -79,4 +72,4 @@ fc-cache -f /usr/share/fonts/inter
# Caps
setcap 'cap_net_raw+ep' /usr/libexec/ksysguard/ksgrd_network_helper

echo "::endgroup::"
echo "::endgroup::"
11 changes: 7 additions & 4 deletions build_files/base/07-base-image-changes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ echo "::group:: ===$(basename "$0")==="

set -ouex pipefail

# Restore x11 for Nvidia Images
if [[ "${FEDORA_MAJOR_VERSION}" -eq "40" ]]; then
rpm-ostree install plasma-workspace-x11
# Remove desktop entries
if [[ -f /usr/share/applications/gnome-system-monitor.desktop ]]; then
sed -i 's@\[Desktop Entry\]@\[Desktop Entry\]\nHidden=true@g' /usr/share/applications/gnome-system-monitor.desktop
fi
if [[ -f /usr/share/applications/org.gnome.SystemMonitor.desktop ]]; then
sed -i 's@\[Desktop Entry\]@\[Desktop Entry\]\nHidden=true@g' /usr/share/applications/org.gnome.SystemMonitor.desktop
fi

# Branding for Images
Expand Down Expand Up @@ -45,4 +48,4 @@ glib-compile-schemas /usr/share/glib-2.0/schemas &>/dev/null
# Watermark for Plymouth
cp /usr/share/plymouth/themes/spinner/{"$BASE_IMAGE_NAME"-,}watermark.png

echo "::endgroup::"
echo "::endgroup::"
8 changes: 7 additions & 1 deletion build_files/base/09-hwe-additions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,16 @@ SURFACE_PACKAGES=(
pipewire-plugin-libcamera
)

rpm-ostree install \
dnf5 -y install \
"${ASUS_PACKAGES[@]}" \
"${SURFACE_PACKAGES[@]}"

dnf5 -y swap \
libwacom-data libwacom-surface-data

dnf5 -y swap \
libwacom libwacom-surface

tee /usr/lib/modules-load.d/ublue-surface.conf << EOF
# Only on AMD models
pinctrl_amd
Expand Down
6 changes: 4 additions & 2 deletions build_files/base/17-cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ sed -i 's@\[Desktop Entry\]@\[Desktop Entry\]\nHidden=true@g' /usr/share/applica
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/negativo17-fedora-multimedia.repo
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/tailscale.repo
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/charm.repo
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/ublue-os-staging-fedora-"${FEDORA_MAJOR_VERSION}".repo
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_che-nerd-fonts-"${FEDORA_MAJOR_VERSION}".repo
dnf5 -y copr disable ublue-os/staging
dnf5 -y copr disable che/nerd-fonts
dnf5 -y copr disable phracek/PyCharm
# NOTE: we won't use dnf5 copr plugin for ublue-os/akmods until our upstream provides the COPR standard naming
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_ublue-os-akmods.repo
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/fedora-cisco-openh264.repo
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/hardware:razer.repo
Expand Down
2 changes: 1 addition & 1 deletion build_files/base/19-initramfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ else
fi

QUALIFIED_KERNEL="$(rpm -qa | grep -P 'kernel-(|'"$KERNEL_SUFFIX"'-)(\d+\.\d+\.\d+)' | sed -E 's/kernel-(|'"$KERNEL_SUFFIX"'-)//')"
/usr/libexec/rpm-ostree/wrapped/dracut --no-hostonly --kver "$QUALIFIED_KERNEL" --reproducible -v --add ostree -f "/lib/modules/$QUALIFIED_KERNEL/initramfs.img"
/usr/bin/dracut --no-hostonly --kver "$QUALIFIED_KERNEL" --reproducible -v --add ostree -f "/lib/modules/$QUALIFIED_KERNEL/initramfs.img"
chmod 0600 "/lib/modules/$QUALIFIED_KERNEL/initramfs.img"

echo "::endgroup::"
23 changes: 9 additions & 14 deletions build_files/dx/01-install-copr-repos-dx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,28 @@ echo "::group:: ===$(basename "$0")==="
set -eoux pipefail

#incus, lxc, lxd

if [[ "${FEDORA_MAJOR_VERSION}" -lt "42" ]]; then
curl -Lo /etc/yum.repos.d/ganto-lxc4-fedora-"${FEDORA_MAJOR_VERSION}".repo \
https://copr.fedorainfracloud.org/coprs/ganto/lxc4/repo/fedora-"${FEDORA_MAJOR_VERSION}"/ganto-lxc4-fedora-"${FEDORA_MAJOR_VERSION}".repo
dnf5 -y copr enable ganto/lxc4
fi

#umoci
curl --retry 3 -Lo /etc/yum.repos.d/ganto-umoci-fedora-"${FEDORA_MAJOR_VERSION}".repo \
https://copr.fedorainfracloud.org/coprs/ganto/umoci/repo/fedora-"${FEDORA_MAJOR_VERSION}"/ganto-umoci-fedora-"${FEDORA_MAJOR_VERSION}".repo
dnf5 -y copr enable ganto/umoci

#ublue-os staging
curl --retry 3 -Lo /etc/yum.repos.d/ublue-os-staging-fedora-"${FEDORA_MAJOR_VERSION}".repo \
https://copr.fedorainfracloud.org/coprs/ublue-os/staging/repo/fedora-"${FEDORA_MAJOR_VERSION}"/ublue-os-staging-fedora-"${FEDORA_MAJOR_VERSION}".repo
dnf5 -y copr enable ublue-os/staging

#karmab-kcli
curl --retry 3 -Lo /etc/yum.repos.d/karmab-kcli-fedora-"${FEDORA_MAJOR_VERSION}".repo \
https://copr.fedorainfracloud.org/coprs/karmab/kcli/repo/fedora-"${FEDORA_MAJOR_VERSION}"/karmab-kcli-fedora-"${FEDORA_MAJOR_VERSION}".repo
dnf5 -y copr enable karmab/kcli

# Fonts
curl --retry 3 -Lo /etc/yum.repos.d/atim-ubuntu-fonts-fedora-"${FEDORA_MAJOR_VERSION}".repo \
https://copr.fedorainfracloud.org/coprs/atim/ubuntu-fonts/repo/fedora-"${FEDORA_MAJOR_VERSION}"/atim-ubuntu-fonts-fedora-"${FEDORA_MAJOR_VERSION}".repo
dnf5 -y copr enable atim/ubuntu-fonts

# Kvmfr module
curl --retry 3 -Lo /etc/yum.repos.d/hikariknight-looking-glass-kvmfr-fedora-"${FEDORA_MAJOR_VERSION}".repo \
https://copr.fedorainfracloud.org/coprs/hikariknight/looking-glass-kvmfr/repo/fedora-"${FEDORA_MAJOR_VERSION}"/hikariknight-looking-glass-kvmfr-fedora-"${FEDORA_MAJOR_VERSION}".repo
dnf5 -y copr enable hikariknight/looking-glass-kvmfr

# Podman-bootc
curl --retry 3 -Lo /etc/yum.repos.d/gmaglione-podman-bootc-fedora-"${FEDORA_MAJOR_VERSION}".repo \
https://copr.fedorainfracloud.org/coprs/gmaglione/podman-bootc/repo/fedora-"${FEDORA_MAJOR_VERSION}"/gmaglione-podman-bootc-fedora-"${FEDORA_MAJOR_VERSION}".repo
dnf5 -y copr enable gmaglione/podman-bootc


echo "::endgroup::"
Loading

0 comments on commit 6fcdce4

Please sign in to comment.