- #!/bin/bash
- #
- #########################################################
- # Function :Yum源更新切换源 #
- # Platform :Centos7.9 #
- # Version :2.0 #
- # Date :2023-09-15 #
- # devops :Shen_Zhao #
- #########################################################
- if [[ `id -u` != "0" ]]; then
- echo "not root!"
- exit 1;
- fi
- sleep 3
- wget=$(rpm -qa |grep wget)
- if [ $? -eq 0 ]
- then
- echo "软件包wgat已安装即将进入下一步."
- else
- yum install wget -y
- echo "即将安装wget软件包."
- fi
- read -p "请输入需要切换的yum源的序号,如1.本地源、2.阿里云镜像源、3.163镜像源、4.华为镜像源、5.清华镜像源:" qh
- case "$qh" in
- 1)
- echo "您选择的是本地源,即将开始切换."
- mkdir /mnt/ncw
- mount /dev/cdrom /mnt/ncw
- if [ $? -eq 0 ];then
- echo "挂载成功,即将进入下一步."
- else
- echo "挂载失败,请检查是