Image building tools for OpenStack
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
1.3 KiB

  1. #!/bin/bash
  2. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
  3. set -x
  4. fi
  5. set -eu
  6. set -o pipefail
  7. DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-}
  8. [ -n "$DIB_DISTRIBUTION_MIRROR" ] || exit 0
  9. # Only set the mirror for the Base, Extras and Updates repositories
  10. # The others aren't enabled and do not exist on all mirrors
  11. if [[ ${DIB_RELEASE} == '7' ]]; then
  12. sed -e "s|^#baseurl=http[s]*://mirror.centos.org/centos|baseurl=$DIB_DISTRIBUTION_MIRROR|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-Base.repo
  13. elif [[ ${DIB_RELEASE} == '8' ]]; then
  14. sed -e "s|^#baseurl=http[s]*://mirror.centos.org/\$contentdir/|baseurl=$DIB_DISTRIBUTION_MIRROR/|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-Base.repo
  15. sed -e "s|^#baseurl=http[s]*://mirror.centos.org/\$contentdir/|baseurl=$DIB_DISTRIBUTION_MIRROR/|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-AppStream.repo
  16. sed -e "s|^#baseurl=http[s]*://mirror.centos.org/\$contentdir/|baseurl=$DIB_DISTRIBUTION_MIRROR/|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-centosplus.repo
  17. sed -e "s|^#baseurl=http[s]*://mirror.centos.org/\$contentdir/|baseurl=$DIB_DISTRIBUTION_MIRROR/|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-Extras.repo
  18. sed -e "s|^#baseurl=http[s]*://mirror.centos.org/\$contentdir/|baseurl=$DIB_DISTRIBUTION_MIRROR/|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-PowerTools.repo
  19. fi