echo -e "\033[34mstop server:\033[0m"
service iptables stop
service NetworkManager stop
chkconfig --del iptables
chkconfig --del NetworkManager
setenforce 0
cat /etc/redhat-release | cut -d' ' -f3 | cut -d. -f1 >/so.txt
#read -p "Input source.1/2/3:" MI
if [ $(cat /so.txt) -eq 6 ];then
        cd /etc/yum.repos.d/
        [ -f /etc/yum.repos.d/CentOS-Base.repo ] && mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak && echo "backup local source OK!"
        [ -f /etc/yum.repos.d/CentOS6-Base.repo ] && echo "yum source exist" && yum list && exit 4
        [ ! -f /etc/yum.repos.d/CentOS6-Base.repo ] && wget http://10.56.126.75/.help/CentOS6-Base.repo
        [ -f /etc/yum.repos.d/CentOS6-Base.repo ] && yum clean all &>/dev/null && echo "Clean Yum cache OK" || echo "Loading error." 
        yum makecache
        yum list
        rm -rf /so.txt
elif [ $(cat /so.txt) -eq 7 ];then
        cd /etc/yum.repos.d/
        [ -f /etc/yum.repos.d/CentOS-Base.repo ] && mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak && echo "backup local source OK!"
        [ -f /etc/yum.repos.d/CentOS7-Base.repo ] && echo "yum source exist" && exit 4
        [ ! -f /etc/yum.repos.d/CentOS7-Base.repo ] && wget http://10.56.126.75/.help/CentOS7-Base.repo
        [ -f /etc/yum.repos.d/CentOS7-Base.repo ] && yum clean all &>/dev/null && echo "Clean Yum cache OK" || echo "Loading error." && exit 4
        echo "please waiting..." 
        yum makecahe
        yum list
        rm -rf /so.txt
elif [ $(cat /so.txt) -eq 5 ];then
        [ -f /etc/yum.repos.d/CentOS-Base.repo ] && mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak && echo "backup local source OK!"
        [ -f /etc/yum.repos.d/CentOS5-Base.repo ] && echo "yum source exist" && yum list && exit 4
        [ ! -f /etc/yum.repos.d/CentOS5-Base.repo ] && wget http://10.56.126.75/.help/CentOS5-Base.repo
        [ -f /etc/yum.repos.d/CentOS5-Base.repo ] && yum clean all &>/dev/null && echo "Clean Yum cache OK" || echo "Loading error." 
        yum makecache
        yum list
        rm -rf /so.txt

else
        echo "error option"
        exit 4
fi

相关文章:

  • 2022-12-23
  • 2022-01-01
  • 2021-06-26
  • 2021-10-30
  • 2021-09-22
猜你喜欢
  • 2021-10-29
  • 2022-12-23
  • 2021-05-08
  • 2021-07-07
  • 2022-01-01
相关资源
相似解决方案