diff --git a/variants/bluefin/Containerfile b/variants/bluefin/Containerfile index ada49d4..c941b68 100644 --- a/variants/bluefin/Containerfile +++ b/variants/bluefin/Containerfile @@ -16,7 +16,8 @@ ARG UBLUE_IMAGE_TAG="stable" ARG FEDORA_MAJOR_VERSION="41" # 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 @@ -31,6 +32,7 @@ ARG UBLUE_IMAGE_TAG="stable" ARG FEDORA_MAJOR_VERSION="41" # 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 diff --git a/variants/bluefin/build_files/base/04-packages.sh b/variants/bluefin/build_files/base/04-packages.sh index 6c453e3..045de99 100755 --- a/variants/bluefin/build_files/base/04-packages.sh +++ b/variants/bluefin/build_files/base/04-packages.sh @@ -26,14 +26,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 \ + dnf -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 @@ -46,6 +47,6 @@ 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 diff --git a/variants/bluefin/build_files/dx/03-packages-dx.sh b/variants/bluefin/build_files/dx/03-packages-dx.sh index 7850d48..da032a5 100755 --- a/variants/bluefin/build_files/dx/03-packages-dx.sh +++ b/variants/bluefin/build_files/dx/03-packages-dx.sh @@ -30,14 +30,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 \ + dnf -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 @@ -50,6 +51,6 @@ 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 diff --git a/variants/bluefin/build_files/shared/build-base.sh b/variants/bluefin/build_files/shared/build-base.sh index 1a17fd0..458ef71 100755 --- a/variants/bluefin/build_files/shared/build-base.sh +++ b/variants/bluefin/build_files/shared/build-base.sh @@ -2,6 +2,23 @@ set -eoux pipefail +# there is no 'rpm-ostree cliwrap uninstall-from-root', but this is close enough. See: +# https://github.com/coreos/rpm-ostree/blob/6d2548ddb2bfa8f4e9bafe5c6e717cf9531d8001/rust/src/cliwrap.rs#L25-L32 +if [ -d /usr/libexec/rpm-ostree/wrapped ]; then + # binaries which could be created if they did not exist thus may not be in wrapped dir + rm -f \ + /usr/bin/yum \ + /usr/bin/dnf \ + /usr/bin/kernel-install + # binaries which were wrapped + mv -f /usr/libexec/rpm-ostree/wrapped/* /usr/bin + rm -fr /usr/libexec/rpm-ostree +fi + +if [ ${FEDORA_MAJOR_VERSION} -lt 41 ]; then + rpm-ostree install --idempotent dnf5 dnf5-plugins +fi + # Make Alternatives Directory mkdir -p /var/lib/alternatives diff --git a/variants/bluefin/build_files/shared/clean-stage.sh b/variants/bluefin/build_files/shared/clean-stage.sh index 064dd0b..336472c 100755 --- a/variants/bluefin/build_files/shared/clean-stage.sh +++ b/variants/bluefin/build_files/shared/clean-stage.sh @@ -1,8 +1,7 @@ #!/usr/bin/bash set -eoux pipefail -shopt -s extglob rm -rf /tmp/* || true -rm -rf /var/!(cache) -rm -rf /var/cache/!(rpm-ostree) +find /var/* -maxdepth 0 -type d \! -name cache -exec rm -fr {} \; +find /var/cache/* -maxdepth 0 -type d \! -name libdnf5 \! -name rpm-ostree -exec rm -fr {} \;