update reset_v7 shell files

This commit is contained in:
raymond999999
2024-02-25 20:20:37 +08:00
parent f744070e48
commit 47fa52ab1a
2 changed files with 143 additions and 13 deletions

View File

@@ -3,7 +3,7 @@
#***************************************************************************************************
#Author: Raymond
#QQ: 88563128
#Date: 2024-02-04
#Date: 2024-02-25
#FileName: reset_v7_1.sh
#MIRROR: raymond.blog.csdn.net
#Description: reset for CentOS 7 & CentOS Stream 8/9 & Ubuntu 18.04/20.04/22.04 & Rocky 8/9
@@ -431,6 +431,20 @@ EOF
done
}
set_devel_rocky9(){
dnf config-manager --set-enabled devel
${COLOR}"更新镜像源中,请稍等..."${END}
dnf clean all &> /dev/null && dnf makecache &> /dev/null
${COLOR}"${OS_ID} ${OS_RELEASE} devel源设置完成!"${END}
}
set_powertools_rocky_centos8(){
dnf config-manager --set-enabled powertools
${COLOR}"更新镜像源中,请稍等..."${END}
dnf clean all &> /dev/null && dnf makecache &> /dev/null
${COLOR}"${OS_ID} ${OS_RELEASE} powertools源设置完成!"${END}
}
set_yum_centos_stream9_perl(){
${COLOR}"由于CentOS Stream 9系统默认镜像源是Perl语言实现的在更改镜像源之前先确保把'update_mirror.pl'文件和reset脚本放在同一个目录下否则后面程序会退出默认的CentOS Stream 9镜像源设置的是阿里云要修改镜像源请去'update_mirror.pl'文件里修改url变量"${END}
sleep 10
@@ -516,6 +530,13 @@ EOF
done
}
set_crb_centos9(){
dnf config-manager --set-enabled crb
${COLOR}"更新镜像源中,请稍等..."${END}
dnf clean all &> /dev/null && dnf makecache &> /dev/null
${COLOR}"${OS_ID} ${OS_RELEASE} crb源设置完成!"${END}
}
set_yum_centos_stream8(){
OLD_MIRROR=$(sed -rn '/^.*baseurl=/s@.*=http.*://(.*)/(.*)/\$stream/.*/$@\1@p' /etc/yum.repos.d/CentOS-*.repo | head -1)
OLD_DIR=$(sed -rn '/^.*baseurl=/s@.*=http.*://(.*)/(.*)/\$stream/.*/$@\2@p' /etc/yum.repos.d/CentOS-*.repo | head -1)
@@ -902,11 +923,13 @@ rocky_menu(){
cat <<-EOF
1)base仓库
2)epel仓库
3)退出
3)启用Rocky 9 devel仓库
4)启用Rocky 8 PowerTools仓库
5)退出
EOF
echo -e '\E[0m'
read -p "请输入镜像源编号(1-3): " NUM
read -p "请输入镜像源编号(1-5): " NUM
case ${NUM} in
1)
rocky8_9_base_menu
@@ -915,10 +938,20 @@ EOF
rocky_centos8_9_epel_menu
;;
3)
if [ ${OS_RELEASE_VERSION} == "9" ];then
set_devel_rocky9
fi
;;
4)
if [ ${OS_RELEASE_VERSION} == "8" ];then
set_powertools_rocky_centos8
fi
;;
5)
break
;;
*)
${COLOR}"输入错误,请输入正确的数字(1-3)!"${END}
${COLOR}"输入错误,请输入正确的数字(1-5)!"${END}
;;
esac
done
@@ -930,11 +963,13 @@ centos_menu(){
cat <<-EOF
1)base仓库
2)epel仓库
3)退出
3)启用CentOS Stream 9 crb仓库
4)启用CentOS Stream 8 PowerTools仓库
5)退出
EOF
echo -e '\E[0m'
read -p "请输入镜像源编号(1-3): " NUM
read -p "请输入镜像源编号(1-5): " NUM
case ${NUM} in
1)
if [ ${OS_NAME} == "Stream" ];then
@@ -959,10 +994,20 @@ EOF
fi
;;
3)
if [ ${OS_RELEASE_VERSION} == "9" ];then
set_crb_centos9
fi
;;
4)
if [ ${OS_RELEASE_VERSION} == "8" ];then
set_powertools_rocky_centos8
fi
;;
5)
break
;;
*)
${COLOR}"输入错误,请输入正确的数字(1-3)!"${END}
${COLOR}"输入错误,请输入正确的数字(1-5)!"${END}
;;
esac
done

View File

@@ -3,7 +3,7 @@
#***************************************************************************************************
#Author: Raymond
#QQ: 88563128
#Date: 2024-02-04
#Date: 2024-02-25
#FileName: reset_v7_2.sh
#MIRROR: raymond.blog.csdn.net
#Description: reset for CentOS 7 & CentOS Stream 8/9 & Ubuntu 18.04/20.04/22.04 & Rocky 8/9
@@ -904,6 +904,85 @@ EOF
done
}
set_crb_centos_stream9(){
cat > /etc/yum.repos.d/crb.repo <<-EOF
[crb]
name=crb
baseurl=https://${MIRROR}/centos-stream/\$releasever-stream/CRB/\$basearch/os
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
${COLOR}"更新镜像源中,请稍等..."${END}
dnf clean all &> /dev/null
dnf makecache &> /dev/null
${COLOR}"${OS_ID} ${OS_RELEASE} crb源设置完成!"${END}
}
centos_stream9_crb_menu(){
while true;do
echo -e "\E[$[RANDOM%7+31];1m"
cat <<-EOF
1)阿里镜像源
2)华为镜像源
3)腾讯镜像源
4)清华镜像源
5)网易镜像源
6)南京大学镜像源
7)中科大镜像源
8)北京大学镜像源
9)西安交通大学镜像源
10)退出
EOF
echo -e '\E[0m'
read -p "请输入镜像源编号(1-10): " NUM
case ${NUM} in
1)
aliyun
set_crb_centos_stream9
;;
2)
huawei
set_crb_centos_stream9
;;
3)
tencent
set_crb_centos_stream9
;;
4)
tuna
set_crb_centos_stream9
;;
5)
netease
set_crb_centos_stream9
;;
6)
nju
set_crb_centos_stream9
;;
7)
ustc
set_crb_centos_stream9
;;
8)
pku
set_crb_centos_stream9
;;
9)
xjtu
set_crb_centos_stream9
;;
10)
break
;;
*)
${COLOR}"输入错误,请输入正确的数字(1-10)!"${END}
;;
esac
done
}
set_yum_centos_stream8(){
[ -d /etc/yum.repos.d/backup ] || { mkdir /etc/yum.repos.d/backup; mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup; }
cat > /etc/yum.repos.d/base.repo <<-EOF
@@ -1423,12 +1502,13 @@ centos_menu(){
cat <<-EOF
1)base仓库
2)epel仓库
3)CentOS Stream 8 PowerTools仓库
4)退出
3)CentOS Stream 9 crb仓库
4)CentOS Stream 8 PowerTools仓库
5)退出
EOF
echo -e '\E[0m'
read -p "请输入镜像源编号(1-4): " NUM
read -p "请输入镜像源编号(1-5): " NUM
case ${NUM} in
1)
if [ ${OS_NAME} == "Stream" ];then
@@ -1449,15 +1529,20 @@ EOF
fi
;;
3)
if [ ${OS_RELEASE_VERSION} == "9" ];then
centos_stream9_crb_menu
fi
;;
4)
if [ ${OS_RELEASE_VERSION} == "8" ];then
centos_stream8_powertools_menu
fi
;;
4)
5)
break
;;
*)
${COLOR}"输入错误,请输入正确的数字(1-4)!"${END}
${COLOR}"输入错误,请输入正确的数字(1-5)!"${END}
;;
esac
done