mirror of
				https://gitee.com/SuperManito/LinuxMirrors
				synced 2025-11-04 08:20:28 +08:00 
			
		
		
		
	新增适配 openEuler
This commit is contained in:
		
							
								
								
									
										148
									
								
								ChangeMirrors.sh
									
									
									
									
									
								
							
							
						
						
									
										148
									
								
								ChangeMirrors.sh
									
									
									
									
									
								
							@@ -1,6 +1,6 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					#!/bin/bash
 | 
				
			||||||
## Author: SuperManito
 | 
					## Author: SuperManito
 | 
				
			||||||
## Modified: 2023-04-18
 | 
					## Modified: 2023-04-21
 | 
				
			||||||
## License: GPL-2.0
 | 
					## License: GPL-2.0
 | 
				
			||||||
## Github: https://github.com/SuperManito/LinuxMirrors
 | 
					## Github: https://github.com/SuperManito/LinuxMirrors
 | 
				
			||||||
## Gitee: https://gitee.com/SuperManito/LinuxMirrors
 | 
					## Gitee: https://gitee.com/SuperManito/LinuxMirrors
 | 
				
			||||||
@@ -17,10 +17,12 @@ SYSTEM_CENTOS="CentOS"
 | 
				
			|||||||
SYSTEM_CENTOS_STREAM="CentOS Stream"
 | 
					SYSTEM_CENTOS_STREAM="CentOS Stream"
 | 
				
			||||||
SYSTEM_ROCKY="Rocky"
 | 
					SYSTEM_ROCKY="Rocky"
 | 
				
			||||||
SYSTEM_FEDORA="Fedora"
 | 
					SYSTEM_FEDORA="Fedora"
 | 
				
			||||||
 | 
					SYSTEM_OPENEULER="openEuler"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## 定义目录和文件
 | 
					## 定义目录和文件
 | 
				
			||||||
File_LinuxRelease=/etc/os-release
 | 
					File_LinuxRelease=/etc/os-release
 | 
				
			||||||
File_RedHatRelease=/etc/redhat-release
 | 
					File_RedHatRelease=/etc/redhat-release
 | 
				
			||||||
 | 
					File_openEulerRelease=/etc/openEuler-release
 | 
				
			||||||
File_DebianVersion=/etc/debian_version
 | 
					File_DebianVersion=/etc/debian_version
 | 
				
			||||||
File_DebianSourceList=/etc/apt/sources.list
 | 
					File_DebianSourceList=/etc/apt/sources.list
 | 
				
			||||||
File_DebianSourceListBackup=/etc/apt/sources.list.bak
 | 
					File_DebianSourceListBackup=/etc/apt/sources.list.bak
 | 
				
			||||||
@@ -28,6 +30,8 @@ Dir_DebianExtendSource=/etc/apt/sources.list.d
 | 
				
			|||||||
Dir_DebianExtendSourceBackup=/etc/apt/sources.list.d.bak
 | 
					Dir_DebianExtendSourceBackup=/etc/apt/sources.list.d.bak
 | 
				
			||||||
Dir_RedHatRepos=/etc/yum.repos.d
 | 
					Dir_RedHatRepos=/etc/yum.repos.d
 | 
				
			||||||
Dir_RedHatReposBackup=/etc/yum.repos.d.bak
 | 
					Dir_RedHatReposBackup=/etc/yum.repos.d.bak
 | 
				
			||||||
 | 
					Dir_openEulerRepos=/etc/yum.repos.d
 | 
				
			||||||
 | 
					Dir_openEulerReposBackup=/etc/yum.repos.d.bak
 | 
				
			||||||
SelinuxConfig=/etc/selinux/config
 | 
					SelinuxConfig=/etc/selinux/config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RED='\033[31m'
 | 
					RED='\033[31m'
 | 
				
			||||||
@@ -66,6 +70,8 @@ function EnvJudgment() {
 | 
				
			|||||||
        SYSTEM_FACTIONS=${SYSTEM_REDHAT}
 | 
					        SYSTEM_FACTIONS=${SYSTEM_REDHAT}
 | 
				
			||||||
    elif [ -s $File_DebianVersion ]; then
 | 
					    elif [ -s $File_DebianVersion ]; then
 | 
				
			||||||
        SYSTEM_FACTIONS=${SYSTEM_DEBIAN}
 | 
					        SYSTEM_FACTIONS=${SYSTEM_DEBIAN}
 | 
				
			||||||
 | 
					    elif [ -s $File_openEulerRelease ]; then
 | 
				
			||||||
 | 
					        SYSTEM_FACTIONS=${SYSTEM_OPENEULER}
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        echo -e "\n$ERROR 无法判断当前运行环境,请先确认本脚本是否已经适配当前操作系统\n"
 | 
					        echo -e "\n$ERROR 无法判断当前运行环境,请先确认本脚本是否已经适配当前操作系统\n"
 | 
				
			||||||
        exit
 | 
					        exit
 | 
				
			||||||
@@ -95,6 +101,9 @@ function EnvJudgment() {
 | 
				
			|||||||
        cat $File_RedHatRelease | grep -q "${SYSTEM_CENTOS_STREAM}"
 | 
					        cat $File_RedHatRelease | grep -q "${SYSTEM_CENTOS_STREAM}"
 | 
				
			||||||
        [ $? -eq 0 ] && SYSTEM_JUDGMENT="${SYSTEM_CENTOS_STREAM}"
 | 
					        [ $? -eq 0 ] && SYSTEM_JUDGMENT="${SYSTEM_CENTOS_STREAM}"
 | 
				
			||||||
        ;;
 | 
					        ;;
 | 
				
			||||||
 | 
					    "${SYSTEM_OPENEULER}")
 | 
				
			||||||
 | 
					        SYSTEM_JUDGMENT="$(cat $File_openEulerRelease | awk -F ' ' '{printf$1}')"
 | 
				
			||||||
 | 
					        ;;
 | 
				
			||||||
    esac
 | 
					    esac
 | 
				
			||||||
    ## 判定系统处理器架构
 | 
					    ## 判定系统处理器架构
 | 
				
			||||||
    case ${ARCH} in
 | 
					    case ${ARCH} in
 | 
				
			||||||
@@ -125,14 +134,14 @@ function EnvJudgment() {
 | 
				
			|||||||
            SOURCE_BRANCH=ubuntu-ports
 | 
					            SOURCE_BRANCH=ubuntu-ports
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        SOURCE_BRANCH="${SYSTEM_JUDGMENT,,}"
 | 
					        SOURCE_BRANCH="$(echo "${SYSTEM_JUDGMENT,,}" | sed "s/ /-/g")"
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
    ## 定义软件源同步/更新文字
 | 
					    ## 定义软件源同步/更新文字
 | 
				
			||||||
    case ${SYSTEM_FACTIONS} in
 | 
					    case ${SYSTEM_FACTIONS} in
 | 
				
			||||||
    "${SYSTEM_DEBIAN}")
 | 
					    "${SYSTEM_DEBIAN}")
 | 
				
			||||||
        SYNC_TXT="更新"
 | 
					        SYNC_TXT="更新"
 | 
				
			||||||
        ;;
 | 
					        ;;
 | 
				
			||||||
    "${SYSTEM_REDHAT}")
 | 
					    "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}")
 | 
				
			||||||
        SYNC_TXT="同步"
 | 
					        SYNC_TXT="同步"
 | 
				
			||||||
        ;;
 | 
					        ;;
 | 
				
			||||||
    esac
 | 
					    esac
 | 
				
			||||||
@@ -168,6 +177,9 @@ function CloseFirewall() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
## 备份原有源
 | 
					## 备份原有源
 | 
				
			||||||
function BackupMirrors() {
 | 
					function BackupMirrors() {
 | 
				
			||||||
 | 
					    local VERIFICATION_FILES=1
 | 
				
			||||||
 | 
					    local VERIFICATION_BACKUPFILES=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case ${SYSTEM_FACTIONS} in
 | 
					    case ${SYSTEM_FACTIONS} in
 | 
				
			||||||
    "${SYSTEM_DEBIAN}")
 | 
					    "${SYSTEM_DEBIAN}")
 | 
				
			||||||
        ## 判断 /etc/apt/sources.list.d 目录下是否存在文件
 | 
					        ## 判断 /etc/apt/sources.list.d 目录下是否存在文件
 | 
				
			||||||
@@ -185,6 +197,14 @@ function BackupMirrors() {
 | 
				
			|||||||
        [ -d $Dir_RedHatReposBackup ] && ls $Dir_RedHatReposBackup | grep repo -q
 | 
					        [ -d $Dir_RedHatReposBackup ] && ls $Dir_RedHatReposBackup | grep repo -q
 | 
				
			||||||
        VERIFICATION_BACKUPFILES=$?
 | 
					        VERIFICATION_BACKUPFILES=$?
 | 
				
			||||||
        ;;
 | 
					        ;;
 | 
				
			||||||
 | 
					    "${SYSTEM_OPENEULER}")
 | 
				
			||||||
 | 
					        ## 判断 /etc/yum.repos.d 目录下是否存在文件
 | 
				
			||||||
 | 
					        [ -d $Dir_openEulerRepos ] && ls $Dir_openEulerRepos | grep repo -q
 | 
				
			||||||
 | 
					        VERIFICATION_FILES=$?
 | 
				
			||||||
 | 
					        ## 判断 /etc/yum.repos.d.bak 目录下是否存在文件
 | 
				
			||||||
 | 
					        [ -d $Dir_openEulerReposBackup ] && ls $Dir_openEulerReposBackup | grep repo -q
 | 
				
			||||||
 | 
					        VERIFICATION_BACKUPFILES=$?
 | 
				
			||||||
 | 
					        ;;
 | 
				
			||||||
    esac
 | 
					    esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case ${SYSTEM_FACTIONS} in
 | 
					    case ${SYSTEM_FACTIONS} in
 | 
				
			||||||
@@ -269,6 +289,34 @@ function BackupMirrors() {
 | 
				
			|||||||
            [ -d $Dir_RedHatRepos ] || mkdir -p $Dir_RedHatRepos
 | 
					            [ -d $Dir_RedHatRepos ] || mkdir -p $Dir_RedHatRepos
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
        ;;
 | 
					        ;;
 | 
				
			||||||
 | 
					    "${SYSTEM_OPENEULER}")
 | 
				
			||||||
 | 
					        ## /etc/yum.repos.d
 | 
				
			||||||
 | 
					        if [ ${VERIFICATION_FILES} -eq 0 ]; then
 | 
				
			||||||
 | 
					            if [ -d $Dir_openEulerReposBackup ] && [ ${VERIFICATION_BACKUPFILES} -eq 0 ]; then
 | 
				
			||||||
 | 
					                CHOICE_BACKUP3=$(echo -e "\n${BOLD}└─ 检测到系统存在已备份的 repo 源文件,是否跳过覆盖备份? [Y/n] ${PLAIN}")
 | 
				
			||||||
 | 
					                read -p "${CHOICE_BACKUP3}" INPUT
 | 
				
			||||||
 | 
					                [ -z ${INPUT} ] && INPUT=Y
 | 
				
			||||||
 | 
					                case $INPUT in
 | 
				
			||||||
 | 
					                [Yy] | [Yy][Ee][Ss]) ;;
 | 
				
			||||||
 | 
					                [Nn] | [Nn][Oo])
 | 
				
			||||||
 | 
					                    echo ''
 | 
				
			||||||
 | 
					                    cp -rvf $Dir_openEulerRepos/* $Dir_openEulerReposBackup 2>&1
 | 
				
			||||||
 | 
					                    ;;
 | 
				
			||||||
 | 
					                *)
 | 
				
			||||||
 | 
					                    echo -e "\n$WARN 输入错误,默认不覆盖!"
 | 
				
			||||||
 | 
					                    ;;
 | 
				
			||||||
 | 
					                esac
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					                [ ! -d $Dir_openEulerReposBackup ] && mkdir -p $Dir_openEulerReposBackup
 | 
				
			||||||
 | 
					                echo ''
 | 
				
			||||||
 | 
					                cp -vrf $Dir_openEulerRepos/* $Dir_openEulerReposBackup 2>&1
 | 
				
			||||||
 | 
					                echo -e "\n$COMPLETE 已备份原有 repo 源文件至 $Dir_openEulerReposBackup 目录"
 | 
				
			||||||
 | 
					                sleep 1s
 | 
				
			||||||
 | 
					            fi
 | 
				
			||||||
 | 
					        else
 | 
				
			||||||
 | 
					            [ -d $Dir_openEulerRepos ] || mkdir -p $Dir_openEulerRepos
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
 | 
					        ;;
 | 
				
			||||||
    esac
 | 
					    esac
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -292,6 +340,9 @@ function RemoveOldMirrors() {
 | 
				
			|||||||
            fi
 | 
					            fi
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
        ;;
 | 
					        ;;
 | 
				
			||||||
 | 
					    "${SYSTEM_OPENEULER}")
 | 
				
			||||||
 | 
					        [ -d $Dir_openEulerRepos ] && rm -rf $Dir_openEulerRepos/*
 | 
				
			||||||
 | 
					        ;;
 | 
				
			||||||
    esac
 | 
					    esac
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -304,13 +355,16 @@ function ChangeMirrors() {
 | 
				
			|||||||
    "${SYSTEM_REDHAT}")
 | 
					    "${SYSTEM_REDHAT}")
 | 
				
			||||||
        RedHatMirrors
 | 
					        RedHatMirrors
 | 
				
			||||||
        ;;
 | 
					        ;;
 | 
				
			||||||
 | 
					    "${SYSTEM_OPENEULER}")
 | 
				
			||||||
 | 
					        openEulerMirrors
 | 
				
			||||||
 | 
					        ;;
 | 
				
			||||||
    esac
 | 
					    esac
 | 
				
			||||||
    echo -e "\n${WORKING} 开始${SYNC_TXT}软件源...\n"
 | 
					    echo -e "\n${WORKING} 开始${SYNC_TXT}软件源...\n"
 | 
				
			||||||
    case ${SYSTEM_FACTIONS} in
 | 
					    case ${SYSTEM_FACTIONS} in
 | 
				
			||||||
    "${SYSTEM_DEBIAN}")
 | 
					    "${SYSTEM_DEBIAN}")
 | 
				
			||||||
        apt-get update
 | 
					        apt-get update
 | 
				
			||||||
        ;;
 | 
					        ;;
 | 
				
			||||||
    "${SYSTEM_REDHAT}")
 | 
					    "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}")
 | 
				
			||||||
        yum makecache
 | 
					        yum makecache
 | 
				
			||||||
        ;;
 | 
					        ;;
 | 
				
			||||||
    esac
 | 
					    esac
 | 
				
			||||||
@@ -340,7 +394,7 @@ function UpgradeSoftware() {
 | 
				
			|||||||
        "${SYSTEM_DEBIAN}")
 | 
					        "${SYSTEM_DEBIAN}")
 | 
				
			||||||
            apt-get upgrade -y
 | 
					            apt-get upgrade -y
 | 
				
			||||||
            ;;
 | 
					            ;;
 | 
				
			||||||
        "${SYSTEM_REDHAT}")
 | 
					        "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}")
 | 
				
			||||||
            yum update -y
 | 
					            yum update -y
 | 
				
			||||||
            ;;
 | 
					            ;;
 | 
				
			||||||
        esac
 | 
					        esac
 | 
				
			||||||
@@ -474,7 +528,7 @@ function RedHatMirrors() {
 | 
				
			|||||||
                centos.repo \
 | 
					                centos.repo \
 | 
				
			||||||
                centos-addons.repo
 | 
					                centos-addons.repo
 | 
				
			||||||
            # 更换软件源
 | 
					            # 更换软件源
 | 
				
			||||||
            sed -i "s|mirror.stream.centos.org|${SOURCE}/centos-stream|g" \
 | 
					            sed -i "s|mirror.stream.centos.org|${SOURCE}/${SOURCE_BRANCH}|g" \
 | 
				
			||||||
                centos.repo \
 | 
					                centos.repo \
 | 
				
			||||||
                centos-addons.repo
 | 
					                centos-addons.repo
 | 
				
			||||||
            ;;
 | 
					            ;;
 | 
				
			||||||
@@ -508,7 +562,7 @@ function RedHatMirrors() {
 | 
				
			|||||||
                rocky-devel.repo \
 | 
					                rocky-devel.repo \
 | 
				
			||||||
                rocky-extras.repo
 | 
					                rocky-extras.repo
 | 
				
			||||||
            # 更换软件源
 | 
					            # 更换软件源
 | 
				
			||||||
            sed -i "s|dl.rockylinux.org/\$contentdir|${SOURCE}/rocky|g" \
 | 
					            sed -i "s|dl.rockylinux.org/\$contentdir|${SOURCE}/${SOURCE_BRANCH}|g" \
 | 
				
			||||||
                rocky.repo \
 | 
					                rocky.repo \
 | 
				
			||||||
                rocky-addons.repo \
 | 
					                rocky-addons.repo \
 | 
				
			||||||
                rocky-devel.repo \
 | 
					                rocky-devel.repo \
 | 
				
			||||||
@@ -520,7 +574,7 @@ function RedHatMirrors() {
 | 
				
			|||||||
            # 更换 WEB 协议(HTTP/HTTPS)
 | 
					            # 更换 WEB 协议(HTTP/HTTPS)
 | 
				
			||||||
            sed -i "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" Rocky-*
 | 
					            sed -i "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" Rocky-*
 | 
				
			||||||
            # 更换软件源
 | 
					            # 更换软件源
 | 
				
			||||||
            sed -i "s|dl.rockylinux.org/\$contentdir|${SOURCE}/rocky|g" Rocky-*
 | 
					            sed -i "s|dl.rockylinux.org/\$contentdir|${SOURCE}/${SOURCE_BRANCH}|g" Rocky-*
 | 
				
			||||||
            ;;
 | 
					            ;;
 | 
				
			||||||
        esac
 | 
					        esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -545,7 +599,7 @@ function RedHatMirrors() {
 | 
				
			|||||||
            fedora-updates-testing.repo \
 | 
					            fedora-updates-testing.repo \
 | 
				
			||||||
            fedora-updates-testing-modular.repo
 | 
					            fedora-updates-testing-modular.repo
 | 
				
			||||||
        # 更换软件源
 | 
					        # 更换软件源
 | 
				
			||||||
        sed -i "s|download.example/pub/fedora/linux|${SOURCE}/fedora|g" \
 | 
					        sed -i "s|download.example/pub/fedora/linux|${SOURCE}/${SOURCE_BRANCH}|g" \
 | 
				
			||||||
            fedora.repo \
 | 
					            fedora.repo \
 | 
				
			||||||
            fedora-updates.repo \
 | 
					            fedora-updates.repo \
 | 
				
			||||||
            fedora-modular.repo \
 | 
					            fedora-modular.repo \
 | 
				
			||||||
@@ -559,6 +613,17 @@ function RedHatMirrors() {
 | 
				
			|||||||
    yum clean all >/dev/null 2>&1
 | 
					    yum clean all >/dev/null 2>&1
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 更换基于 openEuler 系 Linux 发行版的国内源
 | 
				
			||||||
 | 
					function openEulerMirrors() {
 | 
				
			||||||
 | 
					    GenRepoFiles_openEuler
 | 
				
			||||||
 | 
					    cd $Dir_openEulerRepos
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # 更换 WEB 协议(HTTP/HTTPS)
 | 
				
			||||||
 | 
					    sed -i "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" openEuler.repo
 | 
				
			||||||
 | 
					    # 更换软件源
 | 
				
			||||||
 | 
					    sed -i "s|repo.openeuler.org|${SOURCE}/${SOURCE_BRANCH}|g" openEuler.repo
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## 安装/更换基于 RHEL/CentOS 等红帽系 Linux 的 EPEL (Extra Packages for Enterprise Linux) 扩展国内源
 | 
					## 安装/更换基于 RHEL/CentOS 等红帽系 Linux 的 EPEL (Extra Packages for Enterprise Linux) 扩展国内源
 | 
				
			||||||
function EPELMirrors() {
 | 
					function EPELMirrors() {
 | 
				
			||||||
    ## 安装 EPEL 软件包
 | 
					    ## 安装 EPEL 软件包
 | 
				
			||||||
@@ -775,7 +840,7 @@ function ChooseMirrors() {
 | 
				
			|||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ## 关闭防火墙和SELinux
 | 
					    ## 关闭防火墙和SELinux
 | 
				
			||||||
    [ ${SYSTEM_FACTIONS} = ${SYSTEM_REDHAT} ] && CloseFirewall
 | 
					    [[ ${SYSTEM_FACTIONS} = ${SYSTEM_REDHAT} || ${SYSTEM_FACTIONS} = ${SYSTEM_OPENEULER} ]] && CloseFirewall
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## 生成 CentOS 官方 repo 源文件
 | 
					## 生成 CentOS 官方 repo 源文件
 | 
				
			||||||
@@ -2652,6 +2717,69 @@ skip_if_unavailable=False
 | 
				
			|||||||
EOF
 | 
					EOF
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 生成 openEuler 官方 repo 源文件
 | 
				
			||||||
 | 
					function GenRepoFiles_openEuler() {
 | 
				
			||||||
 | 
					    cat >$Dir_openEulerRepos/openEuler.repo <<\EOF
 | 
				
			||||||
 | 
					#generic-repos is licensed under the Mulan PSL v2.
 | 
				
			||||||
 | 
					#You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
				
			||||||
 | 
					#You may obtain a copy of Mulan PSL v2 at:
 | 
				
			||||||
 | 
					#    http://license.coscl.org.cn/MulanPSL2
 | 
				
			||||||
 | 
					#THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
 | 
				
			||||||
 | 
					#IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
 | 
				
			||||||
 | 
					#PURPOSE.
 | 
				
			||||||
 | 
					#See the Mulan PSL v2 for more details.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[OS]
 | 
				
			||||||
 | 
					name=OS
 | 
				
			||||||
 | 
					baseurl=http://repo.openeuler.org/openEuler-$releasever/OS/$basearch/
 | 
				
			||||||
 | 
					enabled=1
 | 
				
			||||||
 | 
					gpgcheck=1
 | 
				
			||||||
 | 
					gpgkey=http://repo.openeuler.org/openEuler-$releasever/OS/$basearch/RPM-GPG-KEY-openEuler
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[everything]
 | 
				
			||||||
 | 
					name=everything
 | 
				
			||||||
 | 
					baseurl=http://repo.openeuler.org/openEuler-$releasever/everything/$basearch/
 | 
				
			||||||
 | 
					enabled=1
 | 
				
			||||||
 | 
					gpgcheck=1
 | 
				
			||||||
 | 
					gpgkey=http://repo.openeuler.org/openEuler-$releasever/everything/$basearch/RPM-GPG-KEY-openEuler
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[EPOL]
 | 
				
			||||||
 | 
					name=EPOL
 | 
				
			||||||
 | 
					baseurl=http://repo.openeuler.org/openEuler-$releasever/EPOL/main/$basearch/
 | 
				
			||||||
 | 
					enabled=1
 | 
				
			||||||
 | 
					gpgcheck=1
 | 
				
			||||||
 | 
					gpgkey=http://repo.openeuler.org/openEuler-$releasever/OS/$basearch/RPM-GPG-KEY-openEuler
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[debuginfo]
 | 
				
			||||||
 | 
					name=debuginfo
 | 
				
			||||||
 | 
					baseurl=http://repo.openeuler.org/openEuler-$releasever/debuginfo/$basearch/
 | 
				
			||||||
 | 
					enabled=1
 | 
				
			||||||
 | 
					gpgcheck=1
 | 
				
			||||||
 | 
					gpgkey=http://repo.openeuler.org/openEuler-$releasever/debuginfo/$basearch/RPM-GPG-KEY-openEuler
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[source]
 | 
				
			||||||
 | 
					name=source
 | 
				
			||||||
 | 
					baseurl=http://repo.openeuler.org/openEuler-$releasever/source/
 | 
				
			||||||
 | 
					enabled=1
 | 
				
			||||||
 | 
					gpgcheck=1
 | 
				
			||||||
 | 
					gpgkey=http://repo.openeuler.org/openEuler-$releasever/source/RPM-GPG-KEY-openEuler
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[update]
 | 
				
			||||||
 | 
					name=update
 | 
				
			||||||
 | 
					baseurl=http://repo.openeuler.org/openEuler-$releasever/update/$basearch/
 | 
				
			||||||
 | 
					enabled=1
 | 
				
			||||||
 | 
					gpgcheck=1
 | 
				
			||||||
 | 
					gpgkey=http://repo.openeuler.org/openEuler-$releasever/OS/$basearch/RPM-GPG-KEY-openEuler
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[update-source]
 | 
				
			||||||
 | 
					name=update-source
 | 
				
			||||||
 | 
					baseurl=http://repo.openeuler.org/openEuler-$releasever/update/source/
 | 
				
			||||||
 | 
					enabled=1
 | 
				
			||||||
 | 
					gpgcheck=1
 | 
				
			||||||
 | 
					gpgkey=http://repo.openeuler.org/openEuler-$releasever/source/RPM-GPG-KEY-openEuler
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## 生成 EPEL 扩展 repo 官方源文件
 | 
					## 生成 EPEL 扩展 repo 官方源文件
 | 
				
			||||||
function GenRepoFiles_EPEL() {
 | 
					function GenRepoFiles_EPEL() {
 | 
				
			||||||
    case ${SYSTEM_VERSION_NUMBER:0:1} in
 | 
					    case ${SYSTEM_VERSION_NUMBER:0:1} in
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										42
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								README.md
									
									
									
									
									
								
							@@ -10,7 +10,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  <table>
 | 
					  <table>
 | 
				
			||||||
  <tr>
 | 
					  <tr>
 | 
				
			||||||
      <td rowspan="9"> 支持<br/>版本<br/>
 | 
					      <td rowspan="10"> 支持<br/>版本<br/>
 | 
				
			||||||
  </tr>
 | 
					  </tr>
 | 
				
			||||||
  <tr>
 | 
					  <tr>
 | 
				
			||||||
      <td><a href="https://www.debian.org"><img src="./docs/img/icon/debian.svg" width="16" height="16"/></a> Debian</td>
 | 
					      <td><a href="https://www.debian.org"><img src="./docs/img/icon/debian.svg" width="16" height="16"/></a> Debian</td>
 | 
				
			||||||
@@ -44,9 +44,13 @@
 | 
				
			|||||||
      <td><a href="https://fedoraproject.org/zh-Hans"><img src="./docs/img/icon/fedora.ico" width="16" height="16"/></a> Fedora</td>
 | 
					      <td><a href="https://fedoraproject.org/zh-Hans"><img src="./docs/img/icon/fedora.ico" width="16" height="16"/></a> Fedora</td>
 | 
				
			||||||
      <td align="center">28 ~ 37</td>
 | 
					      <td align="center">28 ~ 37</td>
 | 
				
			||||||
  </tr>
 | 
					  </tr>
 | 
				
			||||||
 | 
					  <tr>
 | 
				
			||||||
 | 
					      <td><a href="https://www.openeuler.org/zh"><img src="./docs/img/icon/openEuler.ico" width="16" height="16"/></a> openEuler</td>
 | 
				
			||||||
 | 
					      <td align="center">21.03 ~ 23</td>
 | 
				
			||||||
 | 
					  </tr>
 | 
				
			||||||
  </table>
 | 
					  </table>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  目前仅支持上述基于 Debian 与 RedHat 系的发行版和及其部分衍生版本
 | 
					  目前仅支持上述基于 Debian、RedHat、openEuler 的发行版和及其部分衍生版本
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- ### 使用方法
 | 
					- ### 使用方法
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -68,23 +72,23 @@
 | 
				
			|||||||
    > _Debian 系 Linux 默认禁用了**源码仓库**和**预发布软件源**,若需启用请将 `/etc/apt/sources.list` 文件中相关内容的所在行**取消注释**_  
 | 
					    > _Debian 系 Linux 默认禁用了**源码仓库**和**预发布软件源**,若需启用请将 `/etc/apt/sources.list` 文件中相关内容的所在行**取消注释**_  
 | 
				
			||||||
    > _RedHat 系 Linux 部分仓库**默认没有启用**,若需启用请将 `/etc/yum.repos.d` 目录下相关 **repo** 文件中的 `enabled` 值修改为 `1`_
 | 
					    > _RedHat 系 Linux 部分仓库**默认没有启用**,若需启用请将 `/etc/yum.repos.d` 目录下相关 **repo** 文件中的 `enabled` 值修改为 `1`_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - #### 脚本当前使用的开源镜像站
 | 
					  - #### 软件源
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    |       |    镜像站名称    |                                 镜像站地址                                  | IPv6  | Kali Linux | Rocky Linux | Fedora | EPEL  |
 | 
					    |       |    镜像站名称    |                                 镜像站地址                                  | IPv6  | Kali Linux | Rocky Linux | Fedora | openEuler | EPEL  |
 | 
				
			||||||
    | :---: | :-------------: | :-----------------------------------------------------------------------: | :---: | :--------: | :---------: | :----: | :---: |
 | 
					    | :---: | :-------------: | :-----------------------------------------------------------------------: | :---: | :--------: | :---------: | :----: | :-------: | :---: |
 | 
				
			||||||
    |   1   |      阿里云      |             [mirrors.aliyun.com](https://mirrors.aliyun.com)              |   ✓   |     ✓      |             |   ✓    |   ✓   |
 | 
					    |   1   |      阿里云      |             [mirrors.aliyun.com](https://mirrors.aliyun.com)              |   ✓   |     ✓      |             |   ✓    |     ✓     |   ✓   |
 | 
				
			||||||
    |   2   |      腾讯云      |            [mirrors.tencent.com](https://mirrors.tencent.com)             |   ✓   |     ✓      |      ✓      |   ✓    |   ✓   |
 | 
					    |   2   |      腾讯云      |            [mirrors.tencent.com](https://mirrors.tencent.com)             |   ✓   |     ✓      |      ✓      |   ✓    |           |   ✓   |
 | 
				
			||||||
    |   3   |      华为云      |        [mirrors.huaweicloud.com](https://mirrors.huaweicloud.com)         |   ✓   |     ✓      |             |   ✓    |   ✓   |
 | 
					    |   3   |      华为云      |        [mirrors.huaweicloud.com](https://mirrors.huaweicloud.com)         |   ✓   |     ✓      |             |   ✓    |     ✓     |   ✓   |
 | 
				
			||||||
    |   4   |       网易       |                [mirrors.163.com](https://mirrors.163.com)                 |       |            |      ✓      |   ✓    |       |
 | 
					    |   4   |       网易       |                [mirrors.163.com](https://mirrors.163.com)                 |       |            |      ✓      |   ✓    |     ✓    |       |
 | 
				
			||||||
    |   5   |       搜狐       |               [mirrors.sohu.com](https://mirrors.sohu.com)                |       |            |             |   ✓    |       |
 | 
					    |   5   |       搜狐       |               [mirrors.sohu.com](https://mirrors.sohu.com)                |       |            |             |   ✓    |          |       |
 | 
				
			||||||
    |   6   |     清华大学     |   [mirrors.tuna.tsinghua.edu.cn](https://mirrors.tuna.tsinghua.edu.cn)    |   ✓   |     ✓      |             |   ✓    |   ✓   |
 | 
					    |   6   |     清华大学     |   [mirrors.tuna.tsinghua.edu.cn](https://mirrors.tuna.tsinghua.edu.cn)    |   ✓   |     ✓      |             |   ✓    |     ✓     |   ✓   |
 | 
				
			||||||
    |   7   |     浙江大学     |             [mirrors.zju.edu.cn](https://mirrors.zju.edu.cn)              |       |     ✓      |      ✓      |   ✓    |   ✓   |
 | 
					    |   7   |     浙江大学     |             [mirrors.zju.edu.cn](https://mirrors.zju.edu.cn)              |       |     ✓      |      ✓      |   ✓    |     ✓     |   ✓   |
 | 
				
			||||||
    |   8   |     南京大学     |             [mirrors.nju.edu.cn](https://mirrors.nju.edu.cn)              |       |     ✓      |      ✓      |   ✓    |   ✓   |
 | 
					    |   8   |     南京大学     |             [mirrors.nju.edu.cn](https://mirrors.nju.edu.cn)              |       |     ✓      |      ✓      |   ✓    |     ✓     |   ✓   |
 | 
				
			||||||
    |   9   |     重庆大学     |             [mirrors.cqu.edu.cn](https://mirrors.cqu.edu.cn)              |       |     ✓      |             |   ✓    |   ✓   |
 | 
					    |   9   |     重庆大学     |             [mirrors.cqu.edu.cn](https://mirrors.cqu.edu.cn)              |       |     ✓      |             |   ✓    |           |   ✓   |
 | 
				
			||||||
    |  10   |     兰州大学     |              [mirror.lzu.edu.cn](https://mirror.lzu.edu.cn)               |   ✓   |            |      ✓      |   ✓    |   ✓   |
 | 
					    |  10   |     兰州大学     |              [mirror.lzu.edu.cn](https://mirror.lzu.edu.cn)               |   ✓   |            |      ✓      |   ✓    |     ✓     |   ✓   |
 | 
				
			||||||
    |  11   |   上海交通大学    |             [mirror.sjtu.edu.cn](https://mirror.sjtu.edu.cn)              |   ✓   |     ✓      |      ✓      |   ✓    |   ✓   |
 | 
					    |  11   |   上海交通大学    |             [mirror.sjtu.edu.cn](https://mirror.sjtu.edu.cn)              |   ✓   |     ✓      |      ✓      |   ✓    |     ✓     |   ✓   |
 | 
				
			||||||
    |  12   |  哈尔滨工业大学   |             [mirrors.hit.edu.cn](https://mirrors.hit.edu.cn)              |   ✓   |     ✓      |             |        |   ✓   |
 | 
					    |  12   |  哈尔滨工业大学   |             [mirrors.hit.edu.cn](https://mirrors.hit.edu.cn)              |   ✓   |     ✓      |             |        |     ✓     |   ✓   |
 | 
				
			||||||
    |  13   | 中国科学技术大学  |            [mirrors.ustc.edu.cn](https://mirrors.ustc.edu.cn)             |   ✓   |     ✓      |      ✓      |   ✓    |   ✓   |
 | 
					    |  13   | 中国科学技术大学  |            [mirrors.ustc.edu.cn](https://mirrors.ustc.edu.cn)             |   ✓   |     ✓      |      ✓      |   ✓    |     ✓     |   ✓   |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    以上为脚本当前使用的开源镜像站,所有镜像站均支持 `Debian` `Ubuntu` `CentOS` 软件源  
 | 
					    以上为脚本当前使用的开源镜像站,所有镜像站均支持 `Debian` `Ubuntu` `CentOS` 软件源  
 | 
				
			||||||
    如果使用过程中脚本不能正常输出中文内容则可对照此列表使用,顺序与脚本一致,之后一路回车即可
 | 
					    如果使用过程中脚本不能正常输出中文内容则可对照此列表使用,顺序与脚本一致,之后一路回车即可
 | 
				
			||||||
@@ -113,7 +117,7 @@
 | 
				
			|||||||
        cp -rvf /etc/apt/sources.list.bak /etc/apt/sources.list
 | 
					        cp -rvf /etc/apt/sources.list.bak /etc/apt/sources.list
 | 
				
			||||||
        ```
 | 
					        ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - RedHat 系
 | 
					      - RedHat 系 / openEuler
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ```
 | 
					        ```
 | 
				
			||||||
        cp -rvf /etc/yum.repos.d.bak /etc/yum.repos.d
 | 
					        cp -rvf /etc/yum.repos.d.bak /etc/yum.repos.d
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
<table>
 | 
					<table>
 | 
				
			||||||
<tr>
 | 
					<tr>
 | 
				
			||||||
    <td rowspan="9"> 支持<br/>版本<br/>
 | 
					    <td rowspan="10"> 支持<br/>版本<br/>
 | 
				
			||||||
</tr>
 | 
					</tr>
 | 
				
			||||||
<tr>
 | 
					<tr>
 | 
				
			||||||
    <td><a href="https://www.debian.org"><img src="./img/icon/debian.svg" width="16" height="16"/></a> Debian</td>
 | 
					    <td><a href="https://www.debian.org"><img src="./img/icon/debian.svg" width="16" height="16"/></a> Debian</td>
 | 
				
			||||||
@@ -42,10 +42,14 @@
 | 
				
			|||||||
    <td><a href="https://fedoraproject.org/zh-Hans"><img src="./img/icon/fedora.ico" width="16" height="16"/></a> Fedora</td>
 | 
					    <td><a href="https://fedoraproject.org/zh-Hans"><img src="./img/icon/fedora.ico" width="16" height="16"/></a> Fedora</td>
 | 
				
			||||||
    <td align="center">28 ~ 37</td>
 | 
					    <td align="center">28 ~ 37</td>
 | 
				
			||||||
</tr>
 | 
					</tr>
 | 
				
			||||||
 | 
					<tr>
 | 
				
			||||||
 | 
					    <td><a href="https://www.openeuler.org/zh"><img src="./img/icon/openEuler.ico" width="16" height="16"/></a> openEuler</td>
 | 
				
			||||||
 | 
					    <td align="center">21.03 ~ 23</td>
 | 
				
			||||||
 | 
					</tr>
 | 
				
			||||||
</table>
 | 
					</table>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
> [!NOTE|label:说明]
 | 
					> [!NOTE|label:说明]
 | 
				
			||||||
> 目前仅支持上述基于 Debian 与 RedHat 系的发行版和及其部分衍生版本
 | 
					> 目前仅支持上述基于 Debian、RedHat、openEuler 的发行版和及其部分衍生版本
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## <i class="fa-solid fa-wheelchair-move fa-bounce" style=" --fa-bounce-start-scale-x: 1; --fa-bounce-start-scale-y: 1; --fa-bounce-jump-scale-x: 1; --fa-bounce-jump-scale-y: 1; --fa-bounce-land-scale-x: 1; --fa-bounce-land-scale-y: 1; " ></i> 使用方法
 | 
					## <i class="fa-solid fa-wheelchair-move fa-bounce" style=" --fa-bounce-start-scale-x: 1; --fa-bounce-start-scale-y: 1; --fa-bounce-jump-scale-x: 1; --fa-bounce-jump-scale-y: 1; --fa-bounce-land-scale-x: 1; --fa-bounce-land-scale-y: 1; " ></i> 使用方法
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								docs/img/icon/openEuler.ico
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/img/icon/openEuler.ico
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 4.2 KiB  | 
		Reference in New Issue
	
	Block a user