diff --git a/diskimage_builder/elements/yum-minimal/pkg-map b/diskimage_builder/elements/yum-minimal/pkg-map index edb04168..134403a0 100644 --- a/diskimage_builder/elements/yum-minimal/pkg-map +++ b/diskimage_builder/elements/yum-minimal/pkg-map @@ -20,7 +20,7 @@ }, "family": { "redhat": { - "lsb_release": "redhat-lsb-core" + "lsb_release": "ed hostname patch postfix tar time" } } } 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 8bc81e25..2079387c 100755 --- a/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot +++ b/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot @@ -88,6 +88,8 @@ function _install_repos { if [[ ${DISTRO_NAME} = fedora ]]; then packages+="fedora-release-cloud fedora-release-common " packages+="fedora-repos fedora-gpg-keys" + elif [[ ${DISTRO_NAME} = rocky ]]; then + packages+="rocky-release rocky-repos rocky-gpg-keys" elif [[ ${DISTRO_NAME} = centos && ${DIB_RELEASE%-stream} -gt 7 ]]; then packages+="centos-gpg-keys " if [[ "$DIB_RELEASE" =~ (stream) ]]; then @@ -167,6 +169,8 @@ function _install_repos { if [[ ${DISTRO_NAME} == 'openeuler' ]]; then sudo sed -i 's/enabled=0/enabled=1/' $TARGET_ROOT/etc/yum.repos.d/*.repo fi + + } # _install_pkg_manager packages... @@ -211,7 +215,8 @@ function _install_pkg_manager { local _extra_pkgs="" if [[ $DISTRO_NAME == "fedora" ]] || \ - [[ $DISTRO_NAME == "centos" && $DIB_RELEASE > "7" ]]; then + [[ $DISTRO_NAME == "centos" && $DIB_RELEASE > "7" ]] || \ + [[ $DISTRO_NAME == 'rocky' ]]; then # glibc from F24 onwards has split locales into "langpack" # packages. Host yum doesn't understand the # weak-dependencies glibc now uses to get the @@ -238,6 +243,10 @@ function _install_pkg_manager { sudo ln -s $TARGET_ROOT/etc/dnf/vars $TARGET_ROOT/etc/yum/vars fi + if [[ ${DISTRO_NAME} == 'rocky' ]]; then + echo 'stg/rocky' | sudo tee /etc/dnf/vars/contentdir + fi + sudo -E ${HOST_YUM} -y \ --disableexcludes=all \ --setopt=cachedir=$YUM_CACHE/$ARCH/$DIB_RELEASE \ @@ -308,7 +317,7 @@ _install_repos # it seems, as it seems like as part of the Fedora modular updates # (https://docs.fedoraproject.org/en-US/modularity/) we can pick up # seemingly mismatched libraries. -if [[ ${DISTRO_NAME} =~ (fedora|openeuler) ]]; then +if [[ ${DISTRO_NAME} =~ (fedora|openeuler|rocky) ]]; then _install_pkg_manager dnf dnf-plugins-core curl elif [[ ${DISTRO_NAME} == centos && $DIB_RELEASE > "7" ]]; then _install_pkg_manager dnf dnf-plugins-core curl libcurl @@ -343,6 +352,10 @@ if [[ ${DISTRO_NAME} = centos && ${DIB_RELEASE%-stream} -le 7 ]]; then YUM="${YUM} --releasever=${DIB_RELEASE}" fi +if [[ ${DISTRO_NAME} == 'rocky' ]]; then + YUM="DNF_VAR_contentdir=stg/rocky ${YUM}" +fi + # we just installed yum/dnf with "outside" tools (yum/rpm) which # might have created /var/lib/[yum|rpm] (etc) that are slighlty # incompatible. Refresh everything with the in-chroot tools diff --git a/diskimage_builder/elements/yum/bin/install-packages b/diskimage_builder/elements/yum/bin/install-packages index 1c0a0219..5572c03d 100755 --- a/diskimage_builder/elements/yum/bin/install-packages +++ b/diskimage_builder/elements/yum/bin/install-packages @@ -134,6 +134,10 @@ if [ -n "$WHITELIST" ]; then # # [1] https://bugzilla.redhat.com/show_bug.cgi?id=965567 set -o xtrace + if [[ -n ${DIB_YUM_DNF_CONTENTDIR:-''} ]]; then + echo $DIB_YUM_DNF_CONTENTDIR | sudo tee /etc/dnf/vars/contentdir + sudo sed -i -e 's,^mirrorlist,#mirrorlist,' -e 's,^#baseurl,baseurl,' /etc/yum.repos.d/*.repo + fi ${YUM} -v -y $ACTION $EXTRA_ARGS $PKGS if [ "$ACTION" == "install" ]; then diff --git a/diskimage_builder/elements/yum/post-install.d/99-reset-yum-conf b/diskimage_builder/elements/yum/post-install.d/99-reset-yum-conf index d4fad1cc..5004c658 100755 --- a/diskimage_builder/elements/yum/post-install.d/99-reset-yum-conf +++ b/diskimage_builder/elements/yum/post-install.d/99-reset-yum-conf @@ -6,6 +6,11 @@ fi set -eu set -o pipefail + +# if [[ -n ${DIB_YUM_DNF_CONTENTDIR:-''} ]]; then +# sudo sed -i 's,^#mirrorlist,mirrorlist,' -e 's,^baseurl,#baseurl,' /etc/yum.repos.d/rocky.repo +# fi + if [[ ${YUM} == "dnf" ]]; then cfg=/etc/dnf/dnf.conf cachedir=/var/cache/dnf