Skip to content

Commit

Permalink
chore: un-cliwrap and use dnf5 instead of rpm-ostree (#1954)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsherman authored Jan 12, 2025
1 parent ce84b9d commit 3603918
Show file tree
Hide file tree
Showing 15 changed files with 91 additions and 138 deletions.
6 changes: 4 additions & 2 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ ARG SHA_HEAD_SHORT="dedbeef"
ARG UBLUE_IMAGE_TAG="stable"

# 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 @@ -36,6 +37,7 @@ ARG SHA_HEAD_SHORT="dedbeef"
ARG UBLUE_IMAGE_TAG="stable"

# 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
56 changes: 0 additions & 56 deletions build_files/base/01-build-fix.sh

This file was deleted.

8 changes: 3 additions & 5 deletions build_files/base/02-install-copr-repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ 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
dnf5 -y copr enable sentry/switcheroo-control_discrete

# 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 che/nerd-fonts

echo "::endgroup::"
13 changes: 7 additions & 6 deletions build_files/base/03-install-kernel-akmods.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ 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
Expand All @@ -29,20 +29,21 @@ 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 \
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
rpm-ostree install \
dnf5 -y install \
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 Down Expand Up @@ -85,7 +86,7 @@ if [[ ${AKMODS_FLAVOR} =~ coreos ]]; then
)

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

# Depmod and autoload
depmod -a -v "${KERNEL}"
Expand Down
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
36 changes: 14 additions & 22 deletions build_files/base/05-override-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,28 @@ echo "::group:: ===$(basename "$0")==="
set -eoux pipefail

# Patched shells
rpm-ostree override replace \
--experimental \
--from repo=copr:copr.fedorainfracloud.org:ublue-os:staging \
gnome-shell
dnf5 -y swap \
--repo=copr:copr.fedorainfracloud.org:ublue-os:staging \
gnome-shell gnome-shell

# GNOME Triple Buffering
if [[ "${BASE_IMAGE_NAME}" =~ silverblue && "${FEDORA_MAJOR_VERSION}" -lt "41" ]]; then
rpm-ostree override replace \
--experimental \
--from repo=copr:copr.fedorainfracloud.org:ublue-os:staging \
mutter \
mutter-common
dnf5 -y swap \
--repo=copr:copr.fedorainfracloud.org:ublue-os:staging \
mutter mutter
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

# 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 @@ -47,7 +39,7 @@ echo 'eval "$(starship init bash)"' >> /etc/bashrc
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

# Required for bluefin faces to work without conflicting with a ton of packages
rm -f /usr/share/pixmaps/faces/* || echo "Expected directory deletion to fail"
Expand Down
2 changes: 1 addition & 1 deletion build_files/base/09-hwe-additions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ SURFACE_PACKAGES=(
pipewire-plugin-libcamera
)

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

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 @@ rm -f /etc/xdg/autostart/solaar.desktop
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
for i in /etc/yum.repos.d/rpmfusion-*; do
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::"
22 changes: 8 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,27 @@ 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::"
5 changes: 3 additions & 2 deletions build_files/dx/02-install-kernel-akmods-dx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ echo "::group:: ===$(basename "$0")==="

set -ouex pipefail

# 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

# Fetch Kernel RPMS
Expand All @@ -13,7 +14,7 @@ tar -xvzf /tmp/kernel-rpms/"$KERNEL_TARGZ" -C /
mv /tmp/rpms/* /tmp/kernel-rpms/

if [[ -z "$(grep kernel-devel <<<$(rpm -qa))" ]]; then
rpm-ostree install /tmp/kernel-rpms/kernel-devel-*.rpm
dnf5 -y install /tmp/kernel-rpms/kernel-devel-*.rpm
fi

# Fetch AKMODS RPMS
Expand All @@ -23,6 +24,6 @@ tar -xvzf /tmp/akmods/"$AKMODS_TARGZ" -C /tmp/
mv /tmp/rpms/* /tmp/akmods/

# Install RPMS
rpm-ostree install /tmp/akmods/kmods/*kvmfr*.rpm
dnf5 -y install /tmp/akmods/kmods/*kvmfr*.rpm

echo "::endgroup::"
11 changes: 6 additions & 5 deletions build_files/dx/03-packages-dx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,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 @@ -52,7 +53,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
19 changes: 10 additions & 9 deletions build_files/dx/09-cleanup-dx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,20 @@ systemctl enable libvirt-workaround.service
systemctl enable bluefin-dx-groups.service
systemctl enable --global bluefin-dx-user-vscode.service

sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/ublue-os-staging-fedora-"${FEDORA_MAJOR_VERSION}".repo
if [[ -f /etc/yum.repos.d/ganto-lxc4-fedora-"${FEDORA_MAJOR_VERSION}".repo ]]; then
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/ganto-lxc4-fedora-"${FEDORA_MAJOR_VERSION}".repo
dnf5 -y copr disable ublue-os/staging
if [[ "${FEDORA_MAJOR_VERSION}" -lt "42" ]]; then
dnf5 -y copr disable ganto/lxc4
fi
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/ganto-umoci-fedora-"${FEDORA_MAJOR_VERSION}".repo
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/karmab-kcli-fedora-"${FEDORA_MAJOR_VERSION}".repo
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/atim-ubuntu-fonts-fedora-"${FEDORA_MAJOR_VERSION}".repo
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/hikariknight-looking-glass-kvmfr-fedora-"${FEDORA_MAJOR_VERSION}".repo
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/gmaglione-podman-bootc-fedora-"${FEDORA_MAJOR_VERSION}".repo
dnf5 -y copr disable ganto/umoci
dnf5 -y copr disable karmab/kcli
dnf5 -y copr disable atim/ubuntu-fonts
dnf5 -y copr disable hikariknight/looking-glass-kvmfr
dnf5 -y copr disable gmaglione/podman-bootc
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/vscode.repo
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/docker-ce.repo
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr:copr.fedorainfracloud.org:phracek:PyCharm.repo
dnf5 -y copr disable phracek/PyCharm
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/fedora-cisco-openh264.repo
# 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

for i in /etc/yum.repos.d/rpmfusion-*; do
Expand Down
Loading

0 comments on commit 3603918

Please sign in to comment.