echo -e "33[34mstop server:33[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