#!/bin/bash

for file in /etc/yum.repos.d/*
 do
   sed -i 's|^mirrorlist=http://mirrorlist.centos.org|#mirrorlist=http://mirrorlist.centos.org|' $file
   sed -i 's|^#baseurl=http://mirror.centos.org/$contentdir/$releasever/|baseurl=http://mirror.centos.org/$contentdir/$releasever/|' $file
   sed -i 's|^baseurl=http://mirror.centos.org/$contentdir/$releasever/|baseurl=https://vault.centos.org/centos/8.5.2111/|' $file
   sed -i '/failovermethod=priority/d' $file
 done

yum clean all

yum update centos-release -y

for file in /etc/yum.repos.d/*
 do
   sed -i 's|^mirrorlist=http://mirrorlist.centos.org|#mirrorlist=http://mirrorlist.centos.org|' $file
   sed -i 's|^#baseurl=http://mirror.centos.org/$contentdir/$releasever/|baseurl=http://mirror.centos.org/$contentdir/$releasever/|' $file
   sed -i 's|^baseurl=http://mirror.centos.org/$contentdir/$releasever/|baseurl=https://vault.centos.org/centos/8.5.2111/|' $file
   sed -i '/failovermethod=priority/d' $file
 done

yum clean all

