diff --git a/bindep.txt b/bindep.txt index 30a0f027..d29cddbd 100644 --- a/bindep.txt +++ b/bindep.txt @@ -19,11 +19,12 @@ gnupg2 [!platform:redhat !platform:ubuntu-trusty !platform:suse] # ubuntu apt-transport-https [platform:dpkg] inetutils-ping [platform:dpkg] -python-lzma [platform:dpkg !platform:ubuntu-focal] +python-lzma [platform:dpkg !platform:ubuntu-focal !platform:debian-bullseye] qemu-utils [platform:dpkg] rpm [platform:dpkg] uuid-runtime [platform:dpkg] -yum-utils [platform:dpkg !platform:ubuntu-focal] +yum-utils [platform:dpkg !platform:ubuntu-focal !platform:debian-bullseye] +dnf [platform:debian-bullseye] debootstrap [platform:dpkg] procps [platform:dpkg] diff --git a/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot b/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot index 9a3fbd44..3be0fe23 100755 --- a/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot +++ b/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot @@ -46,6 +46,16 @@ trap "$EACTION" EXIT YUM_CACHE=$DIB_IMAGE_CACHE/yum mkdir -p $YUM_CACHE +# Debian Bullseye and beyond only has DNF locally +HOST_YUM_DOWNLOADER="yumdownloader" +HOST_YUM="yum" +if ! command -v yumdownloader &> /dev/null +then + HOST_YUM_DOWNLOADER="dnf download" + HOST_YUM="dnf" +fi + + # Note, on Debian/Ubuntu, %_dbpath is set in the RPM macros as # ${HOME}/.rpmdb/ -- this makes sense as RPM isn't the system # packager. This path is relative to the "--root" argument @@ -55,7 +65,7 @@ _RPM="rpm --dbpath=/var/lib/rpm" # chroot, which are needed to bootstrap yum/dnf # # note this runs outside the chroot, where we're assuming the platform -# has yum/yumdownloader +# has yum/yumdownloader/dnf download function _install_repos { local packages local rc @@ -130,7 +140,7 @@ function _install_repos { # can clean it up nicely local temp_tmp temp_tmp=$(mktemp -d) - TMPDIR=${temp_tmp} yumdownloader --verbose \ + TMPDIR=${temp_tmp} ${HOST_YUM_DOWNLOADER} --verbose \ --releasever=${DIB_RELEASE/-*/} \ --setopt=reposdir=$repo \ --setopt=cachedir=$temp_tmp \ @@ -237,7 +247,7 @@ function _install_pkg_manager { sudo ln -s $TARGET_ROOT/etc/dnf/vars $TARGET_ROOT/etc/yum/vars fi - sudo -E yum -y \ + sudo -E ${HOST_YUM} -y \ --disableexcludes=all \ --setopt=cachedir=$YUM_CACHE/$ARCH/$DIB_RELEASE \ --setopt=reposdir=$TARGET_ROOT/etc/yum.repos.d \ diff --git a/releasenotes/notes/yum-minimal-dnf-63305c349bcccdd4.yaml b/releasenotes/notes/yum-minimal-dnf-63305c349bcccdd4.yaml new file mode 100644 index 00000000..89044a7d --- /dev/null +++ b/releasenotes/notes/yum-minimal-dnf-63305c349bcccdd4.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + This includes updates to allow `yum-minimal` elements to work on + host platforms that only supply DNF (e.g. Debian Bullseye). Note + the `dnf download` plugin is required on these platforms.