make it work for rocky

This commit is contained in:
Neil Hanlon 2023-11-15 11:43:48 -07:00
parent 0576fadab8
commit d06a66d0f0
Signed by: neil
GPG Key ID: 705BC21EC3C70F34
4 changed files with 25 additions and 3 deletions

View File

@ -20,7 +20,7 @@
}, },
"family": { "family": {
"redhat": { "redhat": {
"lsb_release": "redhat-lsb-core" "lsb_release": "ed hostname patch postfix tar time"
} }
} }
} }

View File

@ -88,6 +88,8 @@ function _install_repos {
if [[ ${DISTRO_NAME} = fedora ]]; then if [[ ${DISTRO_NAME} = fedora ]]; then
packages+="fedora-release-cloud fedora-release-common " packages+="fedora-release-cloud fedora-release-common "
packages+="fedora-repos fedora-gpg-keys" 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 elif [[ ${DISTRO_NAME} = centos && ${DIB_RELEASE%-stream} -gt 7 ]]; then
packages+="centos-gpg-keys " packages+="centos-gpg-keys "
if [[ "$DIB_RELEASE" =~ (stream) ]]; then if [[ "$DIB_RELEASE" =~ (stream) ]]; then
@ -167,6 +169,8 @@ function _install_repos {
if [[ ${DISTRO_NAME} == 'openeuler' ]]; then if [[ ${DISTRO_NAME} == 'openeuler' ]]; then
sudo sed -i 's/enabled=0/enabled=1/' $TARGET_ROOT/etc/yum.repos.d/*.repo sudo sed -i 's/enabled=0/enabled=1/' $TARGET_ROOT/etc/yum.repos.d/*.repo
fi fi
} }
# _install_pkg_manager packages... # _install_pkg_manager packages...
@ -211,7 +215,8 @@ function _install_pkg_manager {
local _extra_pkgs="" local _extra_pkgs=""
if [[ $DISTRO_NAME == "fedora" ]] || \ 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" # glibc from F24 onwards has split locales into "langpack"
# packages. Host yum doesn't understand the # packages. Host yum doesn't understand the
# weak-dependencies glibc now uses to get 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 sudo ln -s $TARGET_ROOT/etc/dnf/vars $TARGET_ROOT/etc/yum/vars
fi fi
if [[ ${DISTRO_NAME} == 'rocky' ]]; then
echo 'stg/rocky' | sudo tee /etc/dnf/vars/contentdir
fi
sudo -E ${HOST_YUM} -y \ sudo -E ${HOST_YUM} -y \
--disableexcludes=all \ --disableexcludes=all \
--setopt=cachedir=$YUM_CACHE/$ARCH/$DIB_RELEASE \ --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 # it seems, as it seems like as part of the Fedora modular updates
# (https://docs.fedoraproject.org/en-US/modularity/) we can pick up # (https://docs.fedoraproject.org/en-US/modularity/) we can pick up
# seemingly mismatched libraries. # seemingly mismatched libraries.
if [[ ${DISTRO_NAME} =~ (fedora|openeuler) ]]; then if [[ ${DISTRO_NAME} =~ (fedora|openeuler|rocky) ]]; then
_install_pkg_manager dnf dnf-plugins-core curl _install_pkg_manager dnf dnf-plugins-core curl
elif [[ ${DISTRO_NAME} == centos && $DIB_RELEASE > "7" ]]; then elif [[ ${DISTRO_NAME} == centos && $DIB_RELEASE > "7" ]]; then
_install_pkg_manager dnf dnf-plugins-core curl libcurl _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}" YUM="${YUM} --releasever=${DIB_RELEASE}"
fi 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 # we just installed yum/dnf with "outside" tools (yum/rpm) which
# might have created /var/lib/[yum|rpm] (etc) that are slighlty # might have created /var/lib/[yum|rpm] (etc) that are slighlty
# incompatible. Refresh everything with the in-chroot tools # incompatible. Refresh everything with the in-chroot tools

View File

@ -134,6 +134,10 @@ if [ -n "$WHITELIST" ]; then
# #
# [1] https://bugzilla.redhat.com/show_bug.cgi?id=965567 # [1] https://bugzilla.redhat.com/show_bug.cgi?id=965567
set -o xtrace 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 ${YUM} -v -y $ACTION $EXTRA_ARGS $PKGS
if [ "$ACTION" == "install" ]; then if [ "$ACTION" == "install" ]; then

View File

@ -6,6 +6,11 @@ fi
set -eu set -eu
set -o pipefail 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 if [[ ${YUM} == "dnf" ]]; then
cfg=/etc/dnf/dnf.conf cfg=/etc/dnf/dnf.conf
cachedir=/var/cache/dnf cachedir=/var/cache/dnf