Files
LinuxMirrors/ChangeMirrors.sh

3456 lines
123 KiB
Bash
Raw Normal View History

2021-10-22 14:34:59 +08:00
#!/bin/bash
2021-10-08 00:03:44 +08:00
## Author: SuperManito
2023-05-01 16:27:11 +08:00
## Modified: 2023-05-01
2021-10-08 00:03:44 +08:00
## License: GPL-2.0
2022-02-08 10:04:50 +08:00
## Github: https://github.com/SuperManito/LinuxMirrors
## Gitee: https://gitee.com/SuperManito/LinuxMirrors
2021-10-08 00:03:44 +08:00
## 定义系统判定变量
SYSTEM_DEBIAN="Debian"
SYSTEM_UBUNTU="Ubuntu"
SYSTEM_KALI="Kali"
SYSTEM_REDHAT="RedHat"
SYSTEM_RHEL="RedHat"
SYSTEM_CENTOS="CentOS"
SYSTEM_CENTOS_STREAM="CentOS Stream"
2023-04-19 01:26:44 +08:00
SYSTEM_ROCKY="Rocky"
2021-10-08 00:03:44 +08:00
SYSTEM_FEDORA="Fedora"
2023-04-21 12:06:23 +08:00
SYSTEM_OPENEULER="openEuler"
2023-05-01 16:27:11 +08:00
SYSTEM_OPENSUSE="openSUSE"
2021-10-08 00:03:44 +08:00
## 定义目录和文件
File_LinuxRelease=/etc/os-release
File_RedHatRelease=/etc/redhat-release
2023-04-21 12:06:23 +08:00
File_openEulerRelease=/etc/openEuler-release
File_DebianVersion=/etc/debian_version
File_DebianSourceList=/etc/apt/sources.list
File_DebianSourceListBackup=/etc/apt/sources.list.bak
Dir_DebianExtendSource=/etc/apt/sources.list.d
Dir_DebianExtendSourceBackup=/etc/apt/sources.list.d.bak
Dir_RedHatRepos=/etc/yum.repos.d
Dir_RedHatReposBackup=/etc/yum.repos.d.bak
2023-04-21 12:06:23 +08:00
Dir_openEulerRepos=/etc/yum.repos.d
Dir_openEulerReposBackup=/etc/yum.repos.d.bak
2023-05-01 16:27:11 +08:00
Dir_openSUSERepos=/etc/zypp/repos.d
Dir_openSUSEReposBackup=/etc/zypp/repos.d.bak
2021-10-08 00:03:44 +08:00
2023-05-01 16:27:11 +08:00
## 定义颜色变量
RED='\033[31m'
GREEN='\033[32m'
YELLOW='\033[33m'
BLUE='\033[34m'
PLAIN='\033[0m'
BOLD='\033[1m'
SUCCESS='[\033[32mOK\033[0m]'
2022-04-20 12:32:41 +08:00
COMPLETE='[\033[32mDONE\033[0m]'
WARN='[\033[33mWARN\033[0m]'
ERROR='[\033[31mERROR\033[0m]'
WORKING='[\033[34m*\033[0m]'
function AuthorSignature() {
2023-04-21 13:26:25 +08:00
echo -e "\n$COMPLETE 脚本执行结束\n"
echo -e " \033[1;34m官方网站\033[0m https://supermanito.github.io/LinuxMirrors\n"
}
2021-10-08 00:03:44 +08:00
## 系统判定变量
function EnvJudgment() {
2023-05-01 16:27:11 +08:00
## 定义系统名称
SYSTEM_NAME="$(cat $File_LinuxRelease | grep -E "^NAME=" | awk -F '=' '{print$2}' | sed "s/[\'\"]//g")"
cat $File_LinuxRelease | grep "PRETTY_NAME=" -q
[ $? -eq 0 ] && SYSTEM_PRETTY_NAME="$(cat $File_LinuxRelease | grep -E "^PRETTY_NAME=" | awk -F '=' '{print$2}' | sed "s/[\'\"]//g")"
## 定义系统版本号
SYSTEM_VERSION_NUMBER="$(cat $File_LinuxRelease | grep -E "^VERSION_ID=" | awk -F '=' '{print$2}' | sed "s/[\'\"]//g")"
## 定义系统ID
SYSTEM_ID="$(cat $File_LinuxRelease | grep -E "^ID=" | awk -F '=' '{print$2}' | sed "s/[\'\"]//g")"
## 判定当前系统派系Debian/RedHat/openEuler/openSUSE
if [ -s $File_RedHatRelease ]; then
2023-05-01 16:27:11 +08:00
SYSTEM_FACTIONS="${SYSTEM_REDHAT}"
elif [ -s $File_DebianVersion ]; then
2023-05-01 16:27:11 +08:00
SYSTEM_FACTIONS="${SYSTEM_DEBIAN}"
2023-04-21 12:06:23 +08:00
elif [ -s $File_openEulerRelease ]; then
2023-05-01 16:27:11 +08:00
SYSTEM_FACTIONS="${SYSTEM_OPENEULER}"
elif [[ "${SYSTEM_NAME}" == *"openSUSE"* ]]; then
SYSTEM_FACTIONS="${SYSTEM_OPENSUSE}"
2021-10-17 09:09:00 +08:00
else
echo -e "\n$ERROR 无法判断当前运行环境,请先确认本脚本是否已经适配当前操作系统\n"
2023-05-01 16:27:11 +08:00
exit 1
2021-10-08 00:03:44 +08:00
fi
## 判定系统名称、版本、版本号
2023-05-01 16:27:11 +08:00
case "${SYSTEM_FACTIONS}" in
2023-04-18 20:59:47 +08:00
"${SYSTEM_DEBIAN}")
2021-10-24 21:45:16 +08:00
if [ ! -x /usr/bin/lsb_release ]; then
apt-get install -y lsb-release
2023-05-01 16:27:11 +08:00
if [ $? -ne 0 ]; then
echo -e "\n$ERROR lsb-release 软件包安装失败"
echo -e "\n本脚本需要通过 lsb_release 指令判断系统类型,当前可能为精简安装的系统,因为正常情况下系统会自带该软件包,请自行安装后重新执行脚本!\n"
2023-05-01 16:27:11 +08:00
exit 1
2021-10-24 21:45:16 +08:00
fi
fi
2023-05-01 16:27:11 +08:00
SYSTEM_JUDGMENT="$(lsb_release -is)"
SYSTEM_VERSION_CODENAME="$(lsb_release -cs)"
2021-10-08 00:03:44 +08:00
;;
2023-04-18 18:37:24 +08:00
"${SYSTEM_REDHAT}")
2023-04-19 01:26:44 +08:00
SYSTEM_JUDGMENT="$(cat $File_RedHatRelease | awk -F ' ' '{printf$1}')"
cat $File_RedHatRelease | grep -q "${SYSTEM_CENTOS_STREAM}"
[ $? -eq 0 ] && SYSTEM_JUDGMENT="${SYSTEM_CENTOS_STREAM}"
2021-10-08 00:03:44 +08:00
;;
2023-04-21 12:06:23 +08:00
"${SYSTEM_OPENEULER}")
SYSTEM_JUDGMENT="$(cat $File_openEulerRelease | awk -F ' ' '{printf$1}')"
;;
2023-05-01 16:27:11 +08:00
"${SYSTEM_OPENSUSE}")
SYSTEM_JUDGMENT="${SYSTEM_OPENSUSE}"
;;
2021-10-08 00:03:44 +08:00
esac
## 判定系统处理器架构
2023-05-01 16:27:11 +08:00
case $(uname -m) in
2021-10-08 00:03:44 +08:00
x86_64)
SYSTEM_ARCH="x86_64"
2021-10-08 00:03:44 +08:00
;;
aarch64)
SYSTEM_ARCH="ARM64"
2021-10-08 00:03:44 +08:00
;;
armv7l)
SYSTEM_ARCH="ARMv7"
2021-10-08 00:03:44 +08:00
;;
armv6l)
SYSTEM_ARCH="ARMv6"
2021-10-08 00:03:44 +08:00
;;
i686)
SYSTEM_ARCH="x86_32"
2021-10-08 00:03:44 +08:00
;;
*)
2023-05-01 16:27:11 +08:00
SYSTEM_ARCH=$(uname -m)
2021-10-08 00:03:44 +08:00
;;
esac
## 定义软件源分支名称
if [ "${SYSTEM_JUDGMENT}" = ${SYSTEM_UBUNTU} ]; then
2023-05-01 16:27:11 +08:00
if [ ${SYSTEM_ARCH} = "x86_64" ] || [ $(uname -m) = "*i?86*" ]; then
2023-04-18 18:37:24 +08:00
SOURCE_BRANCH="${SYSTEM_JUDGMENT,,}"
2021-10-08 00:03:44 +08:00
else
SOURCE_BRANCH=ubuntu-ports
fi
else
2023-04-21 12:06:23 +08:00
SOURCE_BRANCH="$(echo "${SYSTEM_JUDGMENT,,}" | sed "s/ /-/g")"
2021-10-08 00:03:44 +08:00
fi
## 定义软件源同步/更新文字
2023-05-01 16:27:11 +08:00
case "${SYSTEM_FACTIONS}" in
2023-04-18 20:59:47 +08:00
"${SYSTEM_DEBIAN}")
2021-10-08 00:03:44 +08:00
SYNC_TXT="更新"
;;
2023-05-01 16:27:11 +08:00
"${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENSUSE}")
2021-10-08 00:03:44 +08:00
SYNC_TXT="同步"
;;
esac
}
2022-06-05 20:19:40 +08:00
## 环境判定
2021-10-08 00:03:44 +08:00
function PermissionJudgment() {
2022-06-05 20:19:40 +08:00
## 权限判定
2021-10-08 00:03:44 +08:00
if [ $UID -ne 0 ]; then
2023-05-01 16:27:11 +08:00
echo -e "\n$ERROR 权限不足,请使用 Root 用户运行本脚本\n"
exit 1
2021-10-08 00:03:44 +08:00
fi
}
2022-06-05 20:19:40 +08:00
## 关闭防火墙和SELinux
2022-02-22 06:33:11 +08:00
function CloseFirewall() {
2023-05-01 16:27:11 +08:00
local SelinuxConf=/etc/selinux/config
if [ -x /usr/bin/systemctl ]; then
if [[ $(systemctl is-active firewalld) == "active" ]]; then
local CHOICE=$(echo -e "\n${BOLD}└─ 是否关闭防火墙和 SELinux ? [Y/n] ${PLAIN}")
read -p "${CHOICE}" INPUT
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
[Yy] | [Yy][Ee][Ss])
systemctl disable --now firewalld >/dev/null 2>&1
[ -s $SelinuxConf ] && sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" $SelinuxConfig && setenforce 0 >/dev/null 2>&1
;;
[Nn] | [Nn][Oo]) ;;
*)
echo -e "\n$WARN 输入错误,默认不关闭!"
;;
esac
fi
2021-10-08 00:03:44 +08:00
fi
}
## 备份原有源
function BackupMirrors() {
2023-04-21 12:06:23 +08:00
local VERIFICATION_FILES=1
local VERIFICATION_BACKUPFILES=1
2023-05-01 16:27:11 +08:00
case "${SYSTEM_FACTIONS}" in
2023-04-18 20:59:47 +08:00
"${SYSTEM_DEBIAN}")
2021-10-08 00:03:44 +08:00
## 判断 /etc/apt/sources.list.d 目录下是否存在文件
[ -d $Dir_DebianExtendSource ] && ls $Dir_DebianExtendSource | grep *.list -q
2021-10-08 00:03:44 +08:00
VERIFICATION_FILES=$?
## 判断 /etc/apt/sources.list.d.bak 目录下是否存在文件
[ -d $Dir_DebianExtendSourceBackup ] && ls $Dir_DebianExtendSourceBackup | grep *.list -q
2021-10-08 00:03:44 +08:00
VERIFICATION_BACKUPFILES=$?
2023-04-18 18:37:24 +08:00
;;
"${SYSTEM_REDHAT}")
2021-10-08 00:03:44 +08:00
## 判断 /etc/yum.repos.d 目录下是否存在文件
[ -d $Dir_RedHatRepos ] && ls $Dir_RedHatRepos | grep repo -q
2021-10-08 00:03:44 +08:00
VERIFICATION_FILES=$?
## 判断 /etc/yum.repos.d.bak 目录下是否存在文件
[ -d $Dir_RedHatReposBackup ] && ls $Dir_RedHatReposBackup | grep repo -q
2021-10-08 00:03:44 +08:00
VERIFICATION_BACKUPFILES=$?
2023-04-18 18:37:24 +08:00
;;
2023-04-21 12:06:23 +08:00
"${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=$?
;;
2023-05-01 16:27:11 +08:00
"${SYSTEM_OPENSUSE}")
## 判断 /etc/zypp/repos.d 目录下是否存在文件
[ -d $Dir_openSUSERepos ] && ls $Dir_openSUSERepos | grep repo -q
VERIFICATION_FILES=$?
## 判断 /etc/zypp/repos.d.bak 目录下是否存在文件
[ -d $Dir_openSUSEReposBackup ] && ls $Dir_openSUSEReposBackup | grep repo -q
VERIFICATION_BACKUPFILES=$?
;;
2023-04-18 18:37:24 +08:00
esac
2021-10-08 00:03:44 +08:00
2023-05-01 16:27:11 +08:00
case "${SYSTEM_FACTIONS}" in
2023-04-18 20:59:47 +08:00
"${SYSTEM_DEBIAN}")
2021-10-08 00:03:44 +08:00
## /etc/apt/sources.list
if [ -s $File_DebianSourceList ]; then
if [ -s $File_DebianSourceListBackup ]; then
2023-05-01 16:27:11 +08:00
local CHOICE_BACKUP1=$(echo -e "\n${BOLD}└─ 检测到系统存在已备份的 list 源文件,是否跳过覆盖备份? [Y/n] ${PLAIN}")
2021-10-08 00:03:44 +08:00
read -p "${CHOICE_BACKUP1}" INPUT
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
[Yy] | [Yy][Ee][Ss]) ;;
[Nn] | [Nn][Oo])
2023-04-18 18:37:24 +08:00
echo ''
cp -rvf $File_DebianSourceList $File_DebianSourceListBackup 2>&1
2021-10-08 00:03:44 +08:00
;;
*)
echo -e "\n$WARN 输入错误,默认不覆盖!"
2021-10-08 00:03:44 +08:00
;;
esac
else
2023-04-18 18:37:24 +08:00
echo ''
cp -rvf $File_DebianSourceList $File_DebianSourceListBackup 2>&1
echo -e "\n$COMPLETE 已备份原有 list 源文件至 $File_DebianSourceListBackup"
2021-10-08 00:03:44 +08:00
sleep 1s
fi
else
2023-04-18 18:37:24 +08:00
[ ! -f $File_DebianSourceList ] && touch $File_DebianSourceList
2021-10-08 00:03:44 +08:00
echo -e ''
fi
## /etc/apt/sources.list.d
if [ -d $Dir_DebianExtendSource ] && [ ${VERIFICATION_FILES} -eq 0 ]; then
if [ -d $Dir_DebianExtendSourceBackup ] && [ ${VERIFICATION_BACKUPFILES} -eq 0 ]; then
2023-05-01 16:27:11 +08:00
local CHOICE_BACKUP2=$(echo -e "\n${BOLD}└─ 检测到系统存在已备份的 list 第三方源文件,是否跳过覆盖备份? [Y/n] ${PLAIN}")
2021-10-08 00:03:44 +08:00
read -p "${CHOICE_BACKUP2}" INPUT
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
[Yy] | [Yy][Ee][Ss]) ;;
[Nn] | [Nn][Oo])
2023-04-18 18:37:24 +08:00
echo ''
cp -rvf $Dir_DebianExtendSource/* $Dir_DebianExtendSourceBackup 2>&1
2021-10-08 00:03:44 +08:00
;;
*)
echo -e "\n$WARN 输入错误,默认不覆盖!"
2021-10-08 00:03:44 +08:00
;;
esac
else
2023-04-18 18:37:24 +08:00
[ ! -d $Dir_DebianExtendSourceBackup ] && mkdir -p $Dir_DebianExtendSourceBackup
echo ''
cp -rvf $Dir_DebianExtendSource/* $Dir_DebianExtendSourceBackup 2>&1
echo -e "$COMPLETE 已备份原有 list 第三方源文件至 $Dir_DebianExtendSourceBackup 目录"
2021-10-08 00:03:44 +08:00
sleep 1s
fi
fi
2023-04-18 18:37:24 +08:00
;;
"${SYSTEM_REDHAT}")
2021-10-08 00:03:44 +08:00
## /etc/yum.repos.d
if [ ${VERIFICATION_FILES} -eq 0 ]; then
if [ -d $Dir_RedHatReposBackup ] && [ ${VERIFICATION_BACKUPFILES} -eq 0 ]; then
2023-05-01 16:27:11 +08:00
local CHOICE_BACKUP3=$(echo -e "\n${BOLD}└─ 检测到系统存在已备份的 repo 源文件,是否跳过覆盖备份? [Y/n] ${PLAIN}")
2021-10-08 00:03:44 +08:00
read -p "${CHOICE_BACKUP3}" INPUT
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
[Yy] | [Yy][Ee][Ss]) ;;
[Nn] | [Nn][Oo])
2023-04-18 18:37:24 +08:00
echo ''
cp -rvf $Dir_RedHatRepos/* $Dir_RedHatReposBackup 2>&1
2021-10-08 00:03:44 +08:00
;;
*)
echo -e "\n$WARN 输入错误,默认不覆盖!"
2021-10-08 00:03:44 +08:00
;;
esac
else
2023-04-18 18:37:24 +08:00
[ ! -d $Dir_RedHatReposBackup ] && mkdir -p $Dir_RedHatReposBackup
echo ''
cp -vrf $Dir_RedHatRepos/* $Dir_RedHatReposBackup 2>&1
echo -e "\n$COMPLETE 已备份原有 repo 源文件至 $Dir_RedHatReposBackup 目录"
2021-10-08 00:03:44 +08:00
sleep 1s
fi
else
[ -d $Dir_RedHatRepos ] || mkdir -p $Dir_RedHatRepos
2021-10-08 00:03:44 +08:00
fi
2023-04-18 18:37:24 +08:00
;;
2023-04-21 12:06:23 +08:00
"${SYSTEM_OPENEULER}")
## /etc/yum.repos.d
if [ ${VERIFICATION_FILES} -eq 0 ]; then
if [ -d $Dir_openEulerReposBackup ] && [ ${VERIFICATION_BACKUPFILES} -eq 0 ]; then
2023-05-01 16:27:11 +08:00
local CHOICE_BACKUP4=$(echo -e "\n${BOLD}└─ 检测到系统存在已备份的 repo 源文件,是否跳过覆盖备份? [Y/n] ${PLAIN}")
read -p "${CHOICE_BACKUP4}" INPUT
2023-04-21 12:06:23 +08:00
[ -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
;;
2023-05-01 16:27:11 +08:00
"${SYSTEM_OPENSUSE}")
## /etc/zypp/repos.d
if [ ${VERIFICATION_FILES} -eq 0 ]; then
if [ -d $Dir_openSUSEReposBackup ] && [ ${VERIFICATION_BACKUPFILES} -eq 0 ]; then
local CHOICE_BACKUP4=$(echo -e "\n${BOLD}└─ 检测到系统存在已备份的 repo 源文件,是否跳过覆盖备份? [Y/n] ${PLAIN}")
read -p "${CHOICE_BACKUP4}" INPUT
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
[Yy] | [Yy][Ee][Ss]) ;;
[Nn] | [Nn][Oo])
echo ''
cp -rvf $Dir_openSUSERepos/* $Dir_openSUSEReposBackup 2>&1
;;
*)
echo -e "\n$WARN 输入错误,默认不覆盖!"
;;
esac
else
[ ! -d $Dir_openSUSEReposBackup ] && mkdir -p $Dir_openSUSEReposBackup
echo ''
cp -vrf $Dir_openSUSERepos/* $Dir_openSUSEReposBackup 2>&1
echo -e "\n$COMPLETE 已备份原有 repo 源文件至 $Dir_openSUSEReposBackup 目录"
sleep 1s
fi
else
[ -d $Dir_openSUSERepos ] || mkdir -p $Dir_openSUSERepos
fi
;;
2023-04-18 18:37:24 +08:00
esac
2021-10-08 00:03:44 +08:00
}
## 删除原有源
2023-04-19 01:26:44 +08:00
function RemoveOldMirrors() {
2023-05-01 16:27:11 +08:00
case "${SYSTEM_FACTIONS}" in
2023-04-18 20:59:47 +08:00
"${SYSTEM_DEBIAN}")
[ -f $File_DebianSourceList ] && sed -i '1,$d' $File_DebianSourceList
2023-04-18 18:37:24 +08:00
;;
"${SYSTEM_REDHAT}")
if [ -d $Dir_RedHatRepos ]; then
2023-04-18 18:37:24 +08:00
# Fedora Linux 特殊,只删除以 fedora 开头的文件
if [ "${SYSTEM_JUDGMENT}" = $SYSTEM_FEDORA ]; then
rm -rf $Dir_RedHatRepos/fedora*
2021-10-08 00:03:44 +08:00
else
if [ -f $Dir_RedHatRepos/epel.repo ]; then
ls $Dir_RedHatRepos/ | egrep -v epel | xargs rm -rf
else
rm -rf $Dir_RedHatRepos/*
fi
2021-10-08 00:03:44 +08:00
fi
fi
2023-04-18 18:37:24 +08:00
;;
2023-04-21 12:06:23 +08:00
"${SYSTEM_OPENEULER}")
[ -d $Dir_openEulerRepos ] && rm -rf $Dir_openEulerRepos/*
;;
2023-05-01 16:27:11 +08:00
"${SYSTEM_OPENSUSE}")
[ -d $Dir_openSUSERepos ] && rm -rf $Dir_openSUSERepos/repo-*
;;
2023-04-18 18:37:24 +08:00
esac
2021-10-08 00:03:44 +08:00
}
2023-04-18 18:37:24 +08:00
## 换源
2021-10-08 00:03:44 +08:00
function ChangeMirrors() {
2023-05-01 16:27:11 +08:00
case "${SYSTEM_FACTIONS}" in
2023-04-18 20:59:47 +08:00
"${SYSTEM_DEBIAN}")
2021-10-08 00:03:44 +08:00
DebianMirrors
2023-04-18 18:37:24 +08:00
;;
"${SYSTEM_REDHAT}")
2021-10-08 00:03:44 +08:00
RedHatMirrors
2023-04-18 18:37:24 +08:00
;;
2023-04-21 12:06:23 +08:00
"${SYSTEM_OPENEULER}")
openEulerMirrors
;;
2023-05-01 16:27:11 +08:00
"${SYSTEM_OPENSUSE}")
openSUSEMirrors
;;
2023-04-18 18:37:24 +08:00
esac
echo -e "\n${WORKING} 开始${SYNC_TXT}软件源...\n"
2023-05-01 16:27:11 +08:00
case "${SYSTEM_FACTIONS}" in
2023-04-18 20:59:47 +08:00
"${SYSTEM_DEBIAN}")
2021-10-08 00:03:44 +08:00
apt-get update
;;
2023-04-21 12:06:23 +08:00
"${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}")
2021-10-08 00:03:44 +08:00
yum makecache
;;
2023-05-01 16:27:11 +08:00
"${SYSTEM_OPENSUSE}")
zypper ref
;;
2021-10-08 00:03:44 +08:00
esac
2023-05-01 16:27:11 +08:00
if [ $? -eq 0 ]; then
echo -e "\n$COMPLETE 软件源更换完毕"
2021-10-08 00:03:44 +08:00
else
echo -e "\n$ERROR 软件源${SYNC_TXT}失败\n"
echo -e "请再次执行脚本并更换相同软件源后进行尝试,若仍然${SYNC_TXT}失败那么可能由以下原因导致"
echo -e "1. 网络问题:例如连接异常、网络间歇式中断、由地区影响的网络因素等"
echo -e "2. 软件源问题:所选镜像站正在维护,或者出现罕见的少数文件同步出错导致软件源${SYNC_TXT}命令执行后返回错误状态"
echo ''
2021-10-08 00:03:44 +08:00
exit
fi
}
## 更新软件包
function UpgradeSoftware() {
2023-05-01 16:27:11 +08:00
local CHOICE_A=$(echo -e "\n${BOLD}└─ 是否跳过更新软件包? [Y/n] ${PLAIN}")
read -p "${CHOICE_A}" INPUT
2021-10-08 00:03:44 +08:00
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
[Yy] | [Yy][Ee][Ss]) ;;
[Nn] | [Nn][Oo])
2021-10-08 00:03:44 +08:00
echo -e ''
2023-05-01 16:27:11 +08:00
case "${SYSTEM_FACTIONS}" in
2023-04-18 20:59:47 +08:00
"${SYSTEM_DEBIAN}")
2021-10-08 00:03:44 +08:00
apt-get upgrade -y
;;
2023-04-21 12:06:23 +08:00
"${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}")
2021-10-08 00:03:44 +08:00
yum update -y
;;
2023-05-01 16:27:11 +08:00
"${SYSTEM_OPENSUSE}")
zypper update -y
;;
2021-10-08 00:03:44 +08:00
esac
2023-05-01 16:27:11 +08:00
local CHOICE_B=$(echo -e "\n${BOLD}└─ 是否清理已下载的软件包缓存? [Y/n] ${PLAIN}")
read -p "${CHOICE_B}" INPUT
2021-10-08 00:03:44 +08:00
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
2021-10-08 00:16:12 +08:00
[Yy] | [Yy][Ee][Ss])
2023-05-01 16:27:11 +08:00
case "${SYSTEM_FACTIONS}" in
"${SYSTEM_DEBIAN}")
2021-10-08 00:03:44 +08:00
apt-get autoremove -y >/dev/null 2>&1
apt-get clean >/dev/null 2>&1
2023-05-01 16:27:11 +08:00
;;
"${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}")
2021-10-08 00:03:44 +08:00
yum autoremove -y >/dev/null 2>&1
yum clean packages -y >/dev/null 2>&1
2023-05-01 16:27:11 +08:00
;;
"${SYSTEM_OPENSUSE}")
zypper clean >/dev/null 2>&1
;;
esac
echo -e "\n$COMPLETE 清理完毕"
2021-10-08 00:03:44 +08:00
;;
2021-10-08 00:16:12 +08:00
[Nn] | [Nn][Oo]) ;;
2021-10-08 00:03:44 +08:00
*)
echo -e "\n$WARN 输入错误,默认不清理!"
2021-10-08 00:03:44 +08:00
;;
esac
;;
*)
echo -e "\n$WARN 输入错误,默认不更新!"
2021-10-08 00:03:44 +08:00
;;
esac
}
## 更换基于 Debian 系 Linux 发行版的国内源
function DebianMirrors() {
## 修改国内源
case "${SYSTEM_JUDGMENT}" in
2023-04-19 01:26:44 +08:00
"${SYSTEM_UBUNTU}")
2021-10-17 09:09:00 +08:00
echo "## 默认禁用源码镜像以提高速度,如需启用请自行取消注释
2023-04-21 13:26:25 +08:00
deb ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME} main restricted universe multiverse
# deb-src ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME} main restricted universe multiverse
deb ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME}-security main restricted universe multiverse
# deb-src ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME}-security main restricted universe multiverse
deb ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME}-updates main restricted universe multiverse
# deb-src ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME}-updates main restricted universe multiverse
deb ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME}-backports main restricted universe multiverse
# deb-src ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME}-backports main restricted universe multiverse
2021-10-17 09:09:00 +08:00
## 预发布软件源(不建议启用)
2023-04-21 13:26:25 +08:00
# deb ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME}-proposed main restricted universe multiverse
# deb-src ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME}-proposed main restricted universe multiverse" >>$File_DebianSourceList
2021-10-24 21:45:16 +08:00
;;
2023-04-18 20:59:47 +08:00
"${SYSTEM_DEBIAN}")
2021-10-17 09:09:00 +08:00
echo "## 默认禁用源码镜像以提高速度,如需启用请自行取消注释
2023-04-21 13:26:25 +08:00
deb ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME} main contrib non-free
# deb-src ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME} main contrib non-free
deb ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME}-updates main contrib non-free
# deb-src ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME}-updates main contrib non-free
deb ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME}-backports main contrib non-free
# deb-src ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME}-backports main contrib non-free
2021-10-17 09:09:00 +08:00
## 预发布软件源(不建议启用)
2023-04-21 13:26:25 +08:00
# deb ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}-security ${SYSTEM_VERSION_CODENAME}/updates main contrib non-free
# deb-src ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}-security ${SYSTEM_VERSION_CODENAME}/updates main contrib non-free" >>$File_DebianSourceList
2021-10-24 21:45:16 +08:00
;;
2023-04-19 01:26:44 +08:00
"${SYSTEM_KALI}")
2023-05-01 16:27:11 +08:00
echo "## 默认禁用源码镜像以提高速度,如需启用请自行取消注释
deb ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME} main non-free contrib
# deb-src ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH} ${SYSTEM_VERSION_CODENAME} main non-free contrib" >>$File_DebianSourceList
2021-10-24 21:45:16 +08:00
;;
esac
2021-10-08 00:03:44 +08:00
}
## 更换基于 RedHat 系 Linux 发行版的国内源
function RedHatMirrors() {
## 生成基于 RedHat 发行版和及其衍生发行版的官方 repo 源文件
case "${SYSTEM_JUDGMENT}" in
2023-04-18 18:37:24 +08:00
"${SYSTEM_RHEL}" | "${SYSTEM_CENTOS}")
2023-05-01 16:27:11 +08:00
GenRepoFiles_CentOS ${SYSTEM_VERSION_NUMBER:0:1}
;;
2023-04-18 18:37:24 +08:00
"${SYSTEM_CENTOS_STREAM}")
2023-05-01 16:27:11 +08:00
GenRepoFiles_CentOSStream ${SYSTEM_VERSION_NUMBER:0:1}
2021-10-08 00:03:44 +08:00
;;
2023-04-19 01:26:44 +08:00
"${SYSTEM_ROCKY}")
2023-05-01 16:27:11 +08:00
GenRepoFiles_RockyLinux ${SYSTEM_VERSION_NUMBER:0:1}
2023-04-19 01:26:44 +08:00
;;
2023-04-18 18:37:24 +08:00
"${SYSTEM_FEDORA}")
GenRepoFiles_Fedora
2021-10-08 00:03:44 +08:00
;;
esac
2022-02-25 21:36:56 +08:00
2021-10-17 09:09:00 +08:00
## 修改源
cd $Dir_RedHatRepos
case "${SYSTEM_JUDGMENT}" in
2023-04-19 01:26:44 +08:00
"${SYSTEM_RHEL}" | "${SYSTEM_CENTOS}")
2023-04-18 18:37:24 +08:00
sed -i 's|^mirrorlist=|#mirrorlist=|g' CentOS-*
2022-02-22 06:33:11 +08:00
2022-02-16 17:52:16 +08:00
## CentOS 8 操作系统版本结束了生命周期EOLLinux 社区已不再维护该操作系统版本,最终版本为 8.5.2011
# 原 centos 镜像中的 CentOS 8 相关内容已被官方移动,从 2022-02 开始切换至 centos-vault 源
2023-04-19 01:26:44 +08:00
if [ ${SYSTEM_VERSION_NUMBER:0:1} -eq "8" ]; then
2023-04-18 18:37:24 +08:00
sed -i 's|mirror.centos.org/$contentdir|mirror.centos.org/centos-vault|g' CentOS-*
sed -i 's|vault.centos.org/$contentdir|mirror.centos.org/centos-vault|g' CentOS-Sources.repo # 单独处理 CentOS-Sources.repo
sed -i "s/\$releasever/8.5.2111/g" CentOS-*
2022-02-22 06:33:11 +08:00
fi
# 更换 WEB 协议HTTP/HTTPS
2023-04-18 18:37:24 +08:00
sed -i "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" CentOS-*
# 更换软件源
2023-04-18 18:37:24 +08:00
sed -i "s|mirror.centos.org|${SOURCE}|g" CentOS-*
2022-02-22 06:33:11 +08:00
# Red Hat Enterprise Linux 修改版本号
if [ "${SYSTEM_JUDGMENT}" = ${SYSTEM_RHEL} ]; then
2023-04-19 01:26:44 +08:00
case ${SYSTEM_VERSION_NUMBER:0:1} in
8)
2023-04-18 18:37:24 +08:00
sed -i "s/\$releasever/8.5.2111/g" CentOS-*
;;
7)
2023-04-18 18:37:24 +08:00
sed -i "s/\$releasever/7/g" CentOS-*
;;
esac
2022-02-16 17:52:16 +08:00
fi
2022-02-22 06:33:11 +08:00
2023-04-21 13:26:25 +08:00
# EPEL 附加软件包(安装/换源)
2021-10-08 00:03:44 +08:00
[ ${EPEL_INSTALL} = "True" ] && EPELMirrors
;;
2023-04-19 01:26:44 +08:00
"${SYSTEM_CENTOS_STREAM}")
2023-04-18 18:01:48 +08:00
# CentOS Stream 9 使用的是 centos-stream 镜像,而 CentOS Stream 8 使用的是 centos 镜像
2023-04-19 01:26:44 +08:00
case ${SYSTEM_VERSION_NUMBER:0:1} in
9)
2023-04-18 18:01:48 +08:00
sed -i 's|^metalink=|#metalink=|g' \
centos.repo \
centos-addons.repo
# 更换 WEB 协议HTTP/HTTPS
2023-04-18 18:01:48 +08:00
sed -i "s|^#baseurl=https|baseurl=${WEB_PROTOCOL}|g" \
centos.repo \
centos-addons.repo
# 更换软件源
2023-04-21 12:06:23 +08:00
sed -i "s|mirror.stream.centos.org|${SOURCE}/${SOURCE_BRANCH}|g" \
2023-04-18 18:01:48 +08:00
centos.repo \
centos-addons.repo
;;
8)
2023-04-18 18:37:24 +08:00
sed -i 's|^mirrorlist=|#mirrorlist=|g' CentOS-Stream-*
sed -i 's|vault.centos.org/$contentdir|mirror.centos.org/centos-vault|g' CentOS-Stream-Sources.repo # 单独处理 CentOS-Stream-Sources.repo
# 更换 WEB 协议HTTP/HTTPS
2023-04-18 18:37:24 +08:00
sed -i "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" CentOS-Stream-*
# 更换软件源
2023-04-18 18:37:24 +08:00
sed -i "s|mirror.centos.org|${SOURCE}|g" CentOS-Stream-*
;;
esac
2023-04-21 13:26:25 +08:00
# EPEL 附加软件包(安装/换源)
2023-04-19 01:26:44 +08:00
[ ${EPEL_INSTALL} = "True" ] && EPELMirrors
;;
"${SYSTEM_ROCKY}")
case ${SYSTEM_VERSION_NUMBER:0:1} in
9)
sed -i 's|^mirrorlist=|#mirrorlist=|g' \
rocky.repo \
rocky-addons.repo \
rocky-devel.repo \
rocky-extras.repo
# 更换 WEB 协议HTTP/HTTPS
sed -i "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" \
rocky.repo \
rocky-addons.repo \
rocky-devel.repo \
rocky-extras.repo
# 更换软件源
2023-04-21 12:06:23 +08:00
sed -i "s|dl.rockylinux.org/\$contentdir|${SOURCE}/${SOURCE_BRANCH}|g" \
2023-04-19 01:26:44 +08:00
rocky.repo \
rocky-addons.repo \
rocky-devel.repo \
rocky-extras.repo
;;
8)
sed -i 's|^mirrorlist=|#mirrorlist=|g' Rocky-*
# 更换 WEB 协议HTTP/HTTPS
sed -i "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" Rocky-*
# 更换软件源
2023-04-21 12:06:23 +08:00
sed -i "s|dl.rockylinux.org/\$contentdir|${SOURCE}/${SOURCE_BRANCH}|g" Rocky-*
2023-04-19 01:26:44 +08:00
;;
esac
2023-04-21 13:26:25 +08:00
# EPEL 附加软件包(安装/换源)
[ ${EPEL_INSTALL} = "True" ] && EPELMirrors
;;
2023-04-19 01:26:44 +08:00
"${SYSTEM_FEDORA}")
2021-10-08 00:03:44 +08:00
sed -i 's|^metalink=|#metalink=|g' \
fedora.repo \
fedora-updates.repo \
fedora-modular.repo \
fedora-updates-modular.repo \
fedora-updates-testing.repo \
fedora-updates-testing-modular.repo
# 更换 WEB 协议HTTP/HTTPS
2023-04-18 18:01:48 +08:00
sed -i "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" \
fedora.repo \
fedora-updates.repo \
fedora-modular.repo \
fedora-updates-modular.repo \
fedora-updates-testing.repo \
fedora-updates-testing-modular.repo
# 更换软件源
2023-04-21 12:06:23 +08:00
sed -i "s|download.example/pub/fedora/linux|${SOURCE}/${SOURCE_BRANCH}|g" \
2022-02-25 21:36:56 +08:00
fedora.repo \
fedora-updates.repo \
fedora-modular.repo \
fedora-updates-modular.repo \
fedora-updates-testing.repo \
fedora-updates-testing-modular.repo
;;
esac
2021-10-08 00:03:44 +08:00
}
2023-04-21 12:06:23 +08:00
## 更换基于 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
}
2023-05-01 16:27:11 +08:00
## 更换基于 openSUSE 系 Linux 发行版的国内源
function openSUSEMirrors() {
case "${SYSTEM_ID}" in
"opensuse-leap")
GenRepoFiles_openSUSE "leap" "${SYSTEM_VERSION_NUMBER}"
;;
"opensuse-tumbleweed")
GenRepoFiles_openSUSE "tumbleweed"
;;
esac
cd $Dir_openSUSERepos
# 更换 WEB 协议HTTP/HTTPS
sed -i "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" repo-*
# 更换软件源
case "${SYSTEM_ID}" in
opensuse-leap)
case "${SYSTEM_VERSION_NUMBER}" in
15.[0-2])
sed -i "s|download.opensuse.org|${SOURCE}/${SOURCE_BRANCH}|g" \
repo-debug-non-oss.repo \
repo-debug.repo \
repo-debug-update-non-oss.repo \
repo-debug-update.repo \
repo-non-oss.repo \
repo-oss.repo \
repo-source-non-oss.repo \
repo-source.repo \
repo-update-non-oss.repo \
repo-update.repo
;;
*)
sed -i "s|download.opensuse.org|${SOURCE}/${SOURCE_BRANCH}|g" \
repo-backports-debug-update.repo \
repo-backports-update.repo \
repo-debug-non-oss.repo \
repo-debug.repo \
repo-debug-update-non-oss.repo \
repo-debug-update.repo \
repo-non-oss.repo \
repo-oss.repo \
repo-sle-debug-update.repo \
repo-sle-update.repo \
repo-source.repo \
repo-update-non-oss.repo \
repo-update.repo
;;
esac
;;
opensuse-tumbleweed)
sed -i "s|download.opensuse.org|${SOURCE}/${SOURCE_BRANCH}|g" \
repo-debug.repo \
repo-non-oss.repo \
repo-openh264.repo \
repo-oss.repo \
repo-source.repo \
repo-update.repo
;;
esac
}
# 适用于 RHEL/CentOS(Stream)/RockyLinux 的 EPEL 附加软件包(安装/换源)
function ChooseInstallEPEL() {
case "${SYSTEM_JUDGMENT}" in
"${SYSTEM_RHEL}" | "${SYSTEM_CENTOS}" | "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ROCKY}")
## 判断是否已安装 EPEL 软件包
rpm -qa | grep epel-release -q
VERIFICATION_EPEL=$?
## 判断 /etc/yum.repos.d 目录下是否存在 epel 附加软件包 repo 源文件
[ -d $Dir_RedHatRepos ] && ls $Dir_RedHatRepos | grep epel -q
VERIFICATION_EPELFILES=$?
## 判断 /etc/yum.repos.d.bak 目录下是否存在 epel 附加软件包 repo 源文件
[ -d $Dir_RedHatReposBackup ] && ls $Dir_RedHatReposBackup | grep epel -q
VERIFICATION_EPELBACKUPFILES=$?
if [ ${VERIFICATION_EPEL} -eq 0 ]; then
local CHOICE=$(echo -e "\n ${BOLD}└─ 检测到系统已安装 EPEL 附加软件包,是否替换/覆盖为国内源? [Y/n] ${PLAIN}")
else
local CHOICE=$(echo -e "\n ${BOLD}└─ 是否安装 EPEL 附加软件包? [Y/n] ${PLAIN}")
fi
read -p "${CHOICE}" INPUT
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
[Yy] | [Yy][Ee][Ss])
EPEL_INSTALL="True"
;;
[Nn] | [Nn][Oo])
EPEL_INSTALL="False"
;;
*)
echo -e "\n $WARN 输入错误,默认不更换!"
EPEL_INSTALL="False"
;;
esac
;;
esac
}
2023-04-21 13:26:25 +08:00
## 安装/更换基于 RHEL/CentOS 等红帽系 Linux 的 EPEL (Extra Packages for Enterprise Linux) 附加软件包国内源
2021-10-08 00:03:44 +08:00
function EPELMirrors() {
## 安装 EPEL 软件包
if [ ${VERIFICATION_EPEL} -ne 0 ]; then
echo -e "\n${WORKING} 安装 epel-release 软件包...\n"
2023-04-19 01:26:44 +08:00
yum install -y https://mirrors.cloud.tencent.com/epel/epel-release-latest-${SYSTEM_VERSION_NUMBER:0:1}.noarch.rpm
2021-10-08 00:03:44 +08:00
fi
2023-04-21 13:26:25 +08:00
## 删除原有 EPEL 附加软件包 repo 源文件
[ ${VERIFICATION_EPELFILES} -eq 0 ] && rm -rf $Dir_RedHatRepos/epel*
[ ${VERIFICATION_EPELBACKUPFILES} -eq 0 ] && rm -rf $Dir_RedHatReposBackup/epel*
2023-04-21 13:26:25 +08:00
## 生成官方 EPEL 附加软件包 repo 源文件
2023-04-19 01:26:44 +08:00
GenRepoFiles_EPEL
sed -i 's|^metalink=|#metalink=|g' $Dir_RedHatRepos/epel*
# 更换 WEB 协议HTTP/HTTPS
2023-04-19 01:26:44 +08:00
case ${SYSTEM_VERSION_NUMBER:0:1} in
9 | 8)
sed -i "s|^#baseurl=https|baseurl=${WEB_PROTOCOL}|g" $Dir_RedHatRepos/epel*
2021-10-08 00:03:44 +08:00
;;
7)
sed -i "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" $Dir_RedHatRepos/epel*
;;
esac
# 修改源
2023-04-19 01:26:44 +08:00
case ${SYSTEM_VERSION_NUMBER:0:1} in
9)
sed -i "s|download.example/pub|${SOURCE}|g" $Dir_RedHatRepos/epel*
;;
8 | 7)
sed -i "s|download.fedoraproject.org/pub|${SOURCE}|g" $Dir_RedHatRepos/epel*
2021-10-08 00:03:44 +08:00
;;
esac
rm -rf $Dir_RedHatRepos/epel*rpmnew
2021-10-08 00:03:44 +08:00
}
## 选择国内源
function ChooseMirrors() {
## 云计算厂商的软件源
# 分外网(公网)地址和内网地址,内网地址仅面向云计算厂商云服务器用户使用
# 内网地址不支持使用 HTTPS 协议
function Cloud_Computing_Vendors_Mirrors() {
2022-04-20 12:32:41 +08:00
local Extranet Intranet
## 公网地址
case $1 in
1)
Extranet="mirrors.aliyun.com"
;;
2)
2022-12-15 07:42:27 +08:00
Extranet="mirrors.tencent.com"
;;
3)
Extranet="repo.huaweicloud.com"
;;
esac
## 内网地址
case $1 in
1)
Intranet="mirrors.cloud.aliyuncs.com"
;;
2)
Intranet="mirrors.tencentyun.com"
;;
3)
Intranet="mirrors.myhuaweicloud.com"
;;
esac
2022-04-20 12:32:41 +08:00
CHOICE_A_TMP=$(echo -e "\n ${BOLD}└─ 默认使用镜像站的公网地址,是否继续? [Y/n] ${PLAIN}")
read -p "${CHOICE_A_TMP}" INPUT
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
[Yy] | [Yy][Ee][Ss])
SOURCE=${Extranet}
;;
[Nn] | [Nn][Oo])
SOURCE=${Intranet}
2022-04-20 12:32:41 +08:00
echo -e "\n $WARN 已切换至云计算厂商镜像站的内网访问地址,仅限对应厂商云服务器用户使用!"
2023-05-01 16:27:11 +08:00
ONLY_HTTP="True"
;;
*)
SOURCE=${Extranet}
echo -e "\n$WARN 输入错误,默认使用公网地址!"
;;
esac
}
2023-05-01 16:27:11 +08:00
function WelcomeTitle() {
echo -e '+-------------------------------------+'
echo -e '| |'
echo -e '| 欢迎使用 Linux 一键更换国内软件源 |'
echo -e '| |'
echo -e '+-------------------------------------+'
echo -e ''
echo -e " 运行环境 ${BLUE}${SYSTEM_PRETTY_NAME:-"${SYSTEM_NAME} ${SYSTEM_VERSION_NUMBER}"} ${SYSTEM_ARCH}${PLAIN}"
echo -e " 系统时间 ${BLUE}$(date "+%Y-%m-%d %H:%M:%S") $(timedatectl status | grep "Time zone" | awk -F ':' '{print$2}' | awk -F ' ' '{print$1}')${PLAIN}"
echo -e ''
}
2021-10-24 21:45:16 +08:00
clear
2023-05-01 16:27:11 +08:00
WelcomeTitle
2023-04-21 12:43:57 +08:00
echo -e ' ❖ 阿里云 1)'
echo -e ' ❖ 腾讯云 2)'
echo -e ' ❖ 华为云 3)'
echo -e ' ❖ 网易 4)'
echo -e ' ❖ 搜狐 5)'
echo -e ' ❖ 清华大学 6)'
echo -e ' ❖ 北京大学 7)'
echo -e ' ❖ 浙江大学 8)'
echo -e ' ❖ 南京大学 9)'
echo -e ' ❖ 重庆大学 10)'
echo -e ' ❖ 兰州大学 11)'
echo -e ' ❖ 上海交通大学 12)'
echo -e ' ❖ 哈尔滨工业大学 13)'
echo -e ' ❖ 中国科学技术大学 14)'
echo -e ' ❖ 中国科学院软件研究所 15)'
2023-05-01 16:27:11 +08:00
local CHOICE=$(echo -e "\n${BOLD}└─ 请选择并输入你想使用的软件源 [ 1-15 ]${PLAIN}")
read -p "${CHOICE}" INPUT
2021-10-08 00:03:44 +08:00
case $INPUT in
1 | 2 | 3)
Cloud_Computing_Vendors_Mirrors $INPUT
2021-10-08 00:03:44 +08:00
;;
4)
SOURCE="mirrors.163.com"
;;
5)
SOURCE="mirrors.sohu.com"
;;
6)
SOURCE="mirrors.tuna.tsinghua.edu.cn"
;;
7)
2023-04-21 12:43:57 +08:00
SOURCE="mirrors.pku.edu.cn"
2021-10-08 00:03:44 +08:00
;;
8)
2023-04-21 12:43:57 +08:00
SOURCE="mirrors.zju.edu.cn"
2021-10-08 00:03:44 +08:00
;;
9)
2023-04-21 12:43:57 +08:00
SOURCE="mirrors.nju.edu.cn"
2021-10-08 00:03:44 +08:00
;;
10)
2023-04-21 12:43:57 +08:00
SOURCE="mirrors.cqu.edu.cn"
2021-10-08 00:03:44 +08:00
;;
11)
2023-04-21 12:43:57 +08:00
SOURCE="mirror.lzu.edu.cn"
2021-10-08 00:03:44 +08:00
;;
12)
2023-04-21 12:43:57 +08:00
SOURCE="mirror.sjtu.edu.cn"
2021-10-08 00:03:44 +08:00
;;
13)
2023-04-21 12:43:57 +08:00
SOURCE="mirrors.hit.edu.cn"
;;
14)
2021-10-08 00:03:44 +08:00
SOURCE="mirrors.ustc.edu.cn"
;;
2023-04-21 12:43:57 +08:00
15)
SOURCE="mirror.iscas.ac.cn"
;;
2021-10-08 00:03:44 +08:00
*)
SOURCE="mirrors.aliyun.com"
echo -e "\n$WARN 输入错误,将默认使用 ${BLUE}阿里云${PLAIN} 作为国内源!"
sleep 2s
2021-10-08 00:03:44 +08:00
;;
esac
2023-05-01 16:27:11 +08:00
}
2021-10-08 00:03:44 +08:00
2023-05-01 16:27:11 +08:00
## 选择同步软件源所使用的 WEB 协议( HTTP80 端口HTTPS443 端口)
function ChooseWebProtocol() {
if [[ ${ONLY_HTTP} == "True" ]]; then
2021-10-08 00:03:44 +08:00
WEB_PROTOCOL="http"
else
2023-05-01 16:27:11 +08:00
local CHOICE=$(echo -e "\n${BOLD}└─ 软件源是否使用 HTTP 协议? [Y/n] ${PLAIN}")
read -p "${CHOICE}" INPUT
[ -z ${INPUT} ] && INPUT=Y
case $INPUT in
[Yy] | [Yy][Ee][Ss])
WEB_PROTOCOL="http"
;;
[Nn] | [Nn][Oo])
WEB_PROTOCOL="https"
;;
*)
echo -e "\n$WARN 输入错误,默认使用 HTTPS 协议!"
WEB_PROTOCOL="https"
;;
esac
fi
2021-10-08 00:03:44 +08:00
}
## 生成 CentOS 官方 repo 源文件
function GenRepoFiles_CentOS() {
2023-05-01 16:27:11 +08:00
case $1 in
8)
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Linux-AppStream.repo <<\EOF
2021-10-08 00:03:44 +08:00
# CentOS-Linux-AppStream.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[appstream]
name=CentOS Linux $releasever - AppStream
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Linux-BaseOS.repo <<\EOF
2021-10-08 00:03:44 +08:00
# CentOS-Linux-BaseOS.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[baseos]
name=CentOS Linux $releasever - BaseOS
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Linux-ContinuousRelease.repo <<\EOF
2021-10-08 00:03:44 +08:00
# CentOS-Linux-ContinuousRelease.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
#
# The Continuous Release (CR) repository contains packages for the next minor
# release of CentOS Linux. This repository only has content in the time period
# between an upstream release and the official CentOS Linux release. These
# packages have not been fully tested yet and should be considered beta
# quality. They are made available for people willing to test and provide
# feedback for the next release.
[cr]
name=CentOS Linux $releasever - ContinuousRelease
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=cr&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/cr/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Linux-Debuginfo.repo <<\EOF
2021-10-08 00:03:44 +08:00
# CentOS-Linux-Debuginfo.repo
#
# All debug packages are merged into a single repo, split by basearch, and are
# not signed.
[debuginfo]
name=CentOS Linux $releasever - Debuginfo
baseurl=http://debuginfo.centos.org/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Linux-Devel.repo <<\EOF
2021-10-08 00:03:44 +08:00
# CentOS-Linux-Devel.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[devel]
name=CentOS Linux $releasever - Devel WARNING! FOR BUILDROOT USE ONLY!
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=Devel&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/Devel/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Linux-Extras.repo <<\EOF
2021-10-08 00:03:44 +08:00
# CentOS-Linux-Extras.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[extras]
name=CentOS Linux $releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/extras/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Linux-FastTrack.repo <<\EOF
2021-10-08 00:03:44 +08:00
# CentOS-Linux-FastTrack.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[fasttrack]
name=CentOS Linux $releasever - FastTrack
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=fasttrack&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/fasttrack/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Linux-HighAvailability.repo <<\EOF
2021-10-08 00:03:44 +08:00
# CentOS-Linux-HighAvailability.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[ha]
name=CentOS Linux $releasever - HighAvailability
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=HighAvailability&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/HighAvailability/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Linux-Media.repo <<\EOF
2021-10-08 00:03:44 +08:00
# CentOS-Linux-Media.repo
#
# You can use this repo to install items directly off the installation media.
# Verify your mount point matches one of the below file:// paths.
[media-baseos]
name=CentOS Linux $releasever - Media - BaseOS
baseurl=file:///media/CentOS/BaseOS
file:///media/cdrom/BaseOS
file:///media/cdrecorder/BaseOS
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[media-appstream]
name=CentOS Linux $releasever - Media - AppStream
baseurl=file:///media/CentOS/AppStream
file:///media/cdrom/AppStream
file:///media/cdrecorder/AppStream
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Linux-Plus.repo <<\EOF
2021-10-08 00:03:44 +08:00
# CentOS-Linux-Plus.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[plus]
name=CentOS Linux $releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/centosplus/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Linux-PowerTools.repo <<\EOF
2021-10-08 00:03:44 +08:00
# CentOS-Linux-PowerTools.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[powertools]
name=CentOS Linux $releasever - PowerTools
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=PowerTools&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/PowerTools/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Linux-Sources.repo <<\EOF
2021-10-08 00:03:44 +08:00
# CentOS-Linux-Sources.repo
[baseos-source]
name=CentOS Linux $releasever - BaseOS - Source
baseurl=http://vault.centos.org/$contentdir/$releasever/BaseOS/Source/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[appstream-source]
name=CentOS Linux $releasever - AppStream - Source
baseurl=http://vault.centos.org/$contentdir/$releasever/AppStream/Source/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[extras-source]
name=CentOS Linux $releasever - Extras - Source
baseurl=http://vault.centos.org/$contentdir/$releasever/extras/Source/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[plus-source]
name=CentOS Linux $releasever - Plus - Source
baseurl=http://vault.centos.org/$contentdir/$releasever/centosplus/Source/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
;;
7)
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Base.repo <<\EOF
2021-10-08 00:03:44 +08:00
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-CR.repo <<\EOF
2021-10-08 00:03:44 +08:00
# CentOS-CR.repo
#
# The Continuous Release ( CR ) repository contains rpms that are due in the next
# release for a specific CentOS Version ( eg. next release in CentOS-7 ); these rpms
# are far less tested, with no integration checking or update path testing having
# taken place. They are still built from the upstream sources, but might not map
# to an exact upstream distro release.
#
# These packages are made available soon after they are built, for people willing
# to test their environments, provide feedback on content for the next release, and
# for people looking for early-access to next release content.
#
# The CR repo is shipped in a disabled state by default; its important that users
# understand the implications of turning this on.
#
# NOTE: We do not use a mirrorlist for the CR repos, to ensure content is available
# to everyone as soon as possible, and not need to wait for the external
# mirror network to seed first. However, many local mirrors will carry CR repos
# and if desired you can use one of these local mirrors by editing the baseurl
# line in the repo config below.
#
[cr]
name=CentOS-$releasever - cr
baseurl=http://mirror.centos.org/centos/$releasever/cr/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=0
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Debuginfo.repo <<\EOF
2021-10-08 00:03:44 +08:00
# CentOS-Debug.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# All debug packages from all the various CentOS-7 releases
# are merged into a single repo, split by BaseArch
#
# Note: packages in the debuginfo repo are currently not signed
#
[base-debuginfo]
name=CentOS-7 - Debuginfo
baseurl=http://debuginfo.centos.org/7/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-7
enabled=0
#
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-fasttrack.repo <<\EOF
2021-10-08 00:03:44 +08:00
[fasttrack]
name=CentOS-7 - fasttrack
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=fasttrack&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/fasttrack/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Media.repo <<\EOF
2021-10-08 00:03:44 +08:00
# CentOS-Media.repo
#
# This repo can be used with mounted DVD media, verify the mount point for
# CentOS-7. You can use this repo and yum to install items directly off the
# DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
# yum --enablerepo=c7-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c7-media [command]
[c7-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
file:///media/cdrom/
file:///media/cdrecorder/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Sources.repo <<\EOF
2021-10-08 00:03:44 +08:00
# CentOS-Sources.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base-source]
name=CentOS-$releasever - Base Sources
baseurl=http://vault.centos.org/centos/$releasever/os/Source/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates-source]
name=CentOS-$releasever - Updates Sources
baseurl=http://vault.centos.org/centos/$releasever/updates/Source/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras-source]
name=CentOS-$releasever - Extras Sources
baseurl=http://vault.centos.org/centos/$releasever/extras/Source/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus-source]
name=CentOS-$releasever - Plus Sources
baseurl=http://vault.centos.org/centos/$releasever/centosplus/Source/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
EOF
;;
esac
}
## 生成 CentOS Stream 官方 repo 源文件
function GenRepoFiles_CentOSStream() {
2023-05-01 16:27:11 +08:00
case $1 in
9)
2023-04-18 18:01:48 +08:00
cat >$Dir_RedHatRepos/centos.repo <<\EOF
[baseos]
name=CentOS Stream $releasever - BaseOS
#baseurl=https://mirror.stream.centos.org/$releasever-stream/BaseOS/$basearch/os/
metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-$stream&arch=$basearch&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
countme=1
2023-04-18 18:01:48 +08:00
enabled=1
2023-04-18 18:01:48 +08:00
[baseos-debug]
name=CentOS Stream $releasever - BaseOS - Debug
metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-debug-$stream&arch=$basearch&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
2023-04-18 18:01:48 +08:00
[baseos-source]
name=CentOS Stream $releasever - BaseOS - Source
metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-source-$stream&arch=source&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
2023-04-18 18:01:48 +08:00
[appstream]
name=CentOS Stream $releasever - AppStream
#baseurl=https://mirror.stream.centos.org/$releasever-stream/AppStream/$basearch/os/
metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-$stream&arch=$basearch&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
countme=1
2023-04-18 18:01:48 +08:00
enabled=1
2023-04-18 18:01:48 +08:00
[appstream-debug]
name=CentOS Stream $releasever - AppStream - Debug
metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-debug-$stream&arch=$basearch&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
2023-04-18 18:01:48 +08:00
[appstream-source]
name=CentOS Stream $releasever - AppStream - Source
metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-source-$stream&arch=source&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
2023-04-18 18:01:48 +08:00
[crb]
name=CentOS Stream $releasever - CRB
#baseurl=https://mirror.stream.centos.org/$releasever-stream/CRB/$basearch/os/
metalink=https://mirrors.centos.org/metalink?repo=centos-crb-$stream&arch=$basearch&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
countme=1
enabled=0
2023-04-18 18:01:48 +08:00
[crb-debug]
name=CentOS Stream $releasever - CRB - Debug
metalink=https://mirrors.centos.org/metalink?repo=centos-crb-debug-$stream&arch=$basearch&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
2023-04-18 18:01:48 +08:00
[crb-source]
name=CentOS Stream $releasever - CRB - Source
metalink=https://mirrors.centos.org/metalink?repo=centos-crb-source-$stream&arch=source&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
2023-04-18 18:01:48 +08:00
EOF
cat >$Dir_RedHatRepos/centos-addons.repo <<\EOF
[highavailability]
name=CentOS Stream $releasever - HighAvailability
#baseurl=https://mirror.stream.centos.org/$releasever-stream/HighAvailability/$basearch/os/
metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-$stream&arch=$basearch&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
countme=1
enabled=0
2023-04-18 18:01:48 +08:00
[highavailability-debug]
name=CentOS Stream $releasever - HighAvailability - Debug
metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-debug-$stream&arch=$basearch&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
2023-04-18 18:01:48 +08:00
[highavailability-source]
name=CentOS Stream $releasever - HighAvailability - Source
metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-source-$stream&arch=source&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
2023-04-18 18:01:48 +08:00
[nfv]
name=CentOS Stream $releasever - NFV
#baseurl=https://mirror.stream.centos.org/$releasever-stream/NFV/$basearch/os/
metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-$stream&arch=$basearch&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
countme=1
2023-04-18 18:01:48 +08:00
enabled=0
2023-04-18 18:01:48 +08:00
[nfv-debug]
name=CentOS Stream $releasever - NFV - Debug
metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-debug-$stream&arch=$basearch&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
2023-04-18 18:01:48 +08:00
[nfv-source]
name=CentOS Stream $releasever - NFV - Source
metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-source-$stream&arch=source&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
2023-04-18 18:01:48 +08:00
enabled=0
2023-04-18 18:01:48 +08:00
[rt]
name=CentOS Stream $releasever - RT
#baseurl=https://mirror.stream.centos.org/$releasever-stream/RT/$basearch/os/
metalink=https://mirrors.centos.org/metalink?repo=centos-rt-$stream&arch=$basearch&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
2023-04-18 18:01:48 +08:00
countme=1
enabled=0
2023-04-18 18:01:48 +08:00
[rt-debug]
name=CentOS Stream $releasever - RT - Debug
metalink=https://mirrors.centos.org/metalink?repo=centos-rt-debug-$stream&arch=$basearch&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
2023-04-18 18:01:48 +08:00
[rt-source]
name=CentOS Stream $releasever - RT - Source
metalink=https://mirrors.centos.org/metalink?repo=centos-rt-source-$stream&arch=source&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
2023-04-18 18:01:48 +08:00
enabled=0
2023-04-18 18:01:48 +08:00
[resilientstorage]
name=CentOS Stream $releasever - ResilientStorage
#baseurl=https://mirror.stream.centos.org/$releasever-stream/ResilientStorage/$basearch/os/
metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-$stream&arch=$basearch&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
2023-04-18 18:01:48 +08:00
countme=1
enabled=0
2023-04-18 18:01:48 +08:00
[resilientstorage-debug]
name=CentOS Stream $releasever - ResilientStorage - Debug
metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-debug-$stream&arch=$basearch&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
2023-04-18 18:01:48 +08:00
[resilientstorage-source]
name=CentOS Stream $releasever - ResilientStorage - Source
metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-source-$stream&arch=source&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
2023-04-18 18:01:48 +08:00
[extras-common]
name=CentOS Stream $releasever - Extras packages
#baseurl=https://mirror.stream.centos.org/SIGs/$releasever-stream/extras/$basearch/extras-common/
metalink=https://mirrors.centos.org/metalink?repo=centos-extras-sig-extras-common-$stream&arch=$basearch&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
2023-04-18 18:01:48 +08:00
countme=1
enabled=1
2023-04-18 18:01:48 +08:00
[extras-common-source]
name=CentOS Stream $releasever - Extras packages - Source
metalink=https://mirrors.centos.org/metalink?repo=centos-extras-sig-extras-common-source-$stream&arch=source&protocol=https,http
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
EOF
;;
8)
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Stream-AppStream.repo <<\EOF
# CentOS-Stream-AppStream.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[appstream]
name=CentOS Stream $releasever - AppStream
mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=AppStream&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$stream/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Stream-BaseOS.repo <<\EOF
# CentOS-Stream-BaseOS.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[baseos]
name=CentOS Stream $releasever - BaseOS
mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=BaseOS&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$stream/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Stream-Debuginfo.repo <<\EOF
# CentOS-Stream-Debuginfo.repo
#
# All debug packages are merged into a single repo, split by basearch, and are
# not signed.
[debuginfo]
name=CentOS Stream $releasever - Debuginfo
baseurl=http://debuginfo.centos.org/$stream/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Stream-Extras-common.repo <<\EOF
# CentOS-Stream-Extras-common.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[extras-common]
name=CentOS Stream $releasever - Extras common packages
mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=extras-extras-common
#baseurl=http://mirror.centos.org/$contentdir/$stream/extras/$basearch/extras-common/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Stream-Extras.repo <<\EOF
# CentOS-Stream-Extras.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[extras]
name=CentOS Stream $releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$stream/extras/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Stream-HighAvailability.repo <<\EOF
# CentOS-Stream-HighAvailability.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[ha]
name=CentOS Stream $releasever - HighAvailability
mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=HighAvailability&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$stream/HighAvailability/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Stream-Media.repo <<\EOF
# CentOS-Stream-Media.repo
#
# You can use this repo to install items directly off the installation media.
# Verify your mount point matches one of the below file:// paths.
[media-baseos]
name=CentOS Stream $releasever - Media - BaseOS
baseurl=file:///media/CentOS/BaseOS
file:///media/cdrom/BaseOS
file:///media/cdrecorder/BaseOS
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[media-appstream]
name=CentOS Stream $releasever - Media - AppStream
baseurl=file:///media/CentOS/AppStream
file:///media/cdrom/AppStream
file:///media/cdrecorder/AppStream
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Stream-NFV.repo <<\EOF
# CentOS-Stream-NFV.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[nfv]
name=CentOS Stream $releasever - NFV
mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=NFV&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$stream/NFV/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Stream-PowerTools.repo <<\EOF
# CentOS-Stream-PowerTools.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[powertools]
name=CentOS Stream $releasever - PowerTools
mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=PowerTools&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$stream/PowerTools/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Stream-RealTime.repo <<\EOF
# CentOS-Stream-RealTime.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[rt]
name=CentOS Stream $releasever - RealTime
mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=RT&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$stream/RT/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Stream-ResilientStorage.repo <<\EOF
# CentOS-Stream-ResilientStorage.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[resilientstorage]
name=CentOS Stream $releasever - ResilientStorage
mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=ResilientStorage&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$stream/ResilientStorage/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
2023-04-18 18:37:24 +08:00
cat >$Dir_RedHatRepos/CentOS-Stream-Sources.repo <<\EOF
# CentOS-Stream-Sources.repo
[baseos-source]
name=CentOS Stream $releasever - BaseOS - Source
baseurl=http://vault.centos.org/$contentdir/$stream/BaseOS/Source/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[appstream-source]
name=CentOS Stream $releasever - AppStream - Source
baseurl=http://vault.centos.org/$contentdir/$stream/AppStream/Source/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[powertools-source]
name=CentOS Stream $releasever - PowerTools - Source
baseurl=http://vault.centos.org/$contentdir/$stream/PowerTools/Source/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[extras-source]
name=CentOS Stream $releasever - Extras - Source
baseurl=http://vault.centos.org/$contentdir/$stream/extras/Source/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[ha-source]
name=CentOS Stream $releasever - HighAvailability - Source
baseurl=http://vault.centos.org/$contentdir/$stream/HighAvailability/Source/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[rt-source]
name=CentOS Stream $releasever - RT - Source
baseurl=http://vault.centos.org/$contentdir/$stream/RT/Source/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[resilientstorage-source]
name=CentOS Stream $releasever - ResilientStorage - Source
baseurl=http://vault.centos.org/$contentdir/$stream/ResilientStorage/Source/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[nfv-source]
name=CentOS Stream $releasever - NFV - Source
baseurl=http://vault.centos.org/$contentdir/$stream/NFV/Source/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
;;
esac
2021-10-08 00:03:44 +08:00
}
2023-04-19 01:26:44 +08:00
## 生成 Rocky Linux 官方 repo 源文件
function GenRepoFiles_RockyLinux() {
2023-05-01 16:27:11 +08:00
case $1 in
2023-04-19 01:26:44 +08:00
9)
cat >$Dir_RedHatRepos/rocky.repo <<\EOF
# rocky.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for Rocky updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[baseos]
name=Rocky Linux $releasever - BaseOS
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=BaseOS-$releasever$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
countme=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[baseos-debug]
name=Rocky Linux $releasever - BaseOS - Debug
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=BaseOS-$releasever-debug$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/$basearch/debug/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[baseos-source]
name=Rocky Linux $releasever - BaseOS - Source
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=BaseOS-$releasever-source$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/source/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[appstream]
name=Rocky Linux $releasever - AppStream
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=AppStream-$releasever$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
countme=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[appstream-debug]
name=Rocky Linux $releasever - AppStream - Debug
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=AppStream-$releasever-debug$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/$basearch/debug/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[appstream-source]
name=Rocky Linux $releasever - AppStream - Source
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=AppStream-$releasever-source$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/source/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[crb]
name=Rocky Linux $releasever - CRB
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=CRB-$releasever$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/CRB/$basearch/os/
gpgcheck=1
enabled=0
countme=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[crb-debug]
name=Rocky Linux $releasever - CRB - Debug
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=CRB-$releasever-debug$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/CRB/$basearch/debug/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[crb-source]
name=Rocky Linux $releasever - CRB - Source
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=CRB-$releasever-source$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/CRB/source/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
EOF
cat >$Dir_RedHatRepos/rocky-addons.repo <<\EOF
# rocky-addons.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for Rocky updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[highavailability]
name=Rocky Linux $releasever - High Availability
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=HighAvailability-$releasever$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/$basearch/os/
gpgcheck=1
enabled=0
countme=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[highavailability-debug]
name=Rocky Linux $releasever - High Availability - Debug
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=HighAvailability-$releasever-debug$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/$basearch/debug/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[highavailability-source]
name=Rocky Linux $releasever - High Availability - Source
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=HighAvailability-$releasever-source$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/source/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[resilientstorage]
name=Rocky Linux $releasever - Resilient Storage
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=ResilientStorage-$releasever$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/ResilientStorage/$basearch/os/
gpgcheck=1
enabled=0
countme=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[resilientstorage-debug]
name=Rocky Linux $releasever - Resilient Storage - Debug
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=ResilientStorage-$releasever-debug$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/ResilientStorage/$basearch/debug/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[resilientstorage-source]
name=Rocky Linux $releasever - Resilient Storage - Source
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=ResilientStorage-$releasever-source$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/ResilientStorage/source/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[nfv]
name=Rocky Linux $releasever - NFV
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=NFV-$releasever$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/NFV/$basearch/os/
gpgcheck=1
enabled=0
countme=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[nfv-debug]
name=Rocky Linux $releasever - NFV Debug
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever-debug$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/NFV/$basearch/debug/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[nfv-source]
name=Rocky Linux $releasever - NFV Source
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever-source$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/NFV/source/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[rt]
name=Rocky Linux $releasever - Realtime
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/RT/$basearch/os/
gpgcheck=1
enabled=0
countme=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[rt-debug]
name=Rocky Linux $releasever - Realtime Debug
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever-debug$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/RT/$basearch/debug/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[rt-source]
name=Rocky Linux $releasever - Realtime Source
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever-source$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/RT/source/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[sap]
name=Rocky Linux $releasever - SAP
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAP-$releasever$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAP/$basearch/os/
gpgcheck=1
enabled=0
countme=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[sap-debug]
name=Rocky Linux $releasever - SAP Debug
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAP-$releasever-debug$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAP/$basearch/debug/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[sap-source]
name=Rocky Linux $releasever - SAP Source
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAP-$releasever-source$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAP/source/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[saphana]
name=Rocky Linux $releasever - SAPHANA
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAPHANA-$releasever$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAPHANA/$basearch/os/
gpgcheck=1
enabled=0
countme=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[saphana-debug]
name=Rocky Linux $releasever - SAPHANA Debug
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAPHANA-$releasever-debug$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAPHANA/$basearch/debug/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[saphana-source]
name=Rocky Linux $releasever - SAPHANA Source
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAPHANA-$releasever-source$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAPHANA/source/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
EOF
cat >$Dir_RedHatRepos/rocky-devel.repo <<\EOF
# rocky-devel.repo
#
# devel and no-package-left-behind
[devel]
name=Rocky Linux $releasever - Devel WARNING! FOR BUILDROOT ONLY DO NOT LEAVE ENABLED
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=devel-$releasever$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/devel/$basearch/os/
gpgcheck=1
enabled=0
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
EOF
cat >$Dir_RedHatRepos/rocky-extras.repo <<\EOF
# rocky-extras.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for Rocky updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[extras]
name=Rocky Linux $releasever - Extras
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=extras-$releasever$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/$basearch/os/
gpgcheck=1
enabled=1
countme=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[extras-debug]
name=Rocky Linux $releasever - Extras Debug
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=extras-$releasever-debug$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/$basearch/debug/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[extras-source]
name=Rocky Linux $releasever - Extras Source
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=extras-$releasever-source$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/source/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[plus]
name=Rocky Linux $releasever - Plus
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=plus-$releasever$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/plus/$basearch/os/
gpgcheck=1
enabled=0
countme=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[plus-debug]
name=Rocky Linux $releasever - Plus - Debug
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=plus-$releasever-debug$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/plus/$basearch/debug/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
[plus-source]
name=Rocky Linux $releasever - Plus - Source
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=plus-$releasever-source$rltype
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/plus/source/tree/
gpgcheck=1
enabled=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
EOF
;;
8)
cat >$Dir_RedHatRepos/Rocky-AppStream.repo <<\EOF
# Rocky-AppStream.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for Rocky updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[appstream]
name=Rocky Linux $releasever - AppStream
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=AppStream-$releasever
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
EOF
cat >$Dir_RedHatRepos/Rocky-BaseOS.repo <<\EOF
# Rocky-BaseOS.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for Rocky updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[baseos]
name=Rocky Linux $releasever - BaseOS
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=BaseOS-$releasever
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
EOF
cat >$Dir_RedHatRepos/Rocky-Debuginfo.repo <<\EOF
# Rocky-Debuginfo.repo
#
[baseos-debug]
name=Rocky Linux $releasever - BaseOS - Source
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=BaseOS-$releasever-debug
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/$basearch/debug/tree/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
[appstream-debug]
name=Rocky Linux $releasever - AppStream - Source
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=AppStream-$releasever-debug
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/$basearch/debug/tree/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
[ha-debug]
name=Rocky Linux $releasever - High Availability - Source
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=HighAvailability-$releasever-debug
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/$basearch/debug/tree/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
[powertools-debug]
name=Rocky Linux $releasever - PowerTools - Source
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=PowerTools-$releasever-debug
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/PowerTools/$basearch/debug/tree/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
[resilient-storage-debug]
name=Rocky Linux $releasever - Resilient Storage - Source
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=ResilientStorage-$releasever-debug
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/ResilientStorage/$basearch/debug/tree/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
EOF
cat >$Dir_RedHatRepos/Rocky-Devel.repo <<\EOF
# Rocky-Devel.repo
#
[devel]
name=Rocky Linux $releasever - Devel WARNING! FOR BUILDROOT AND KOJI USE
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=Devel-$releasever
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/Devel/$basearch/os/
gpgcheck=1
enabled=0
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
EOF
cat >$Dir_RedHatRepos/Rocky-Extras.repo <<\EOF
# Rocky-Extras.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for Rocky updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[extras]
name=Rocky Linux $releasever - Extras
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=extras-$releasever
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/$basearch/os/
gpgcheck=1
enabled=1
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
EOF
cat >$Dir_RedHatRepos/Rocky-HighAvailability.repo <<\EOF
# Rocky-HighAvailability.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for Rocky updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[ha]
name=Rocky Linux $releasever - HighAvailability
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=HighAvailability-$releasever
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/$basearch/os/
gpgcheck=1
enabled=0
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
EOF
cat >$Dir_RedHatRepos/Rocky-Media.repo <<\EOF
# Rocky-Media.repo
#
# You can use this repo to install items directly off the installation media.
# Verify your mount point matches one of the below file:// paths.
[media-baseos]
name=Rocky Linux $releasever - Media - BaseOS
baseurl=file:///media/Rocky/BaseOS
file:///media/cdrom/BaseOS
file:///media/cdrecorder/BaseOS
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
[media-appstream]
name=Rocky Linux $releasever - Media - AppStream
baseurl=file:///media/Rocky/AppStream
file:///media/cdrom/AppStream
file:///media/cdrecorder/AppStream
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
EOF
cat >$Dir_RedHatRepos/Rocky-NFV.repo <<\EOF
# Rocky-NFV.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for Rocky updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[nfv]
name=Rocky Linux $releasever - NFV
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=NFV-$releasever
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/nfv/$basearch/os/
gpgcheck=1
enabled=0
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
EOF
cat >$Dir_RedHatRepos/Rocky-Plus.repo <<\EOF
# Rocky-Plus.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for Rocky updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[plus]
name=Rocky Linux $releasever - Plus
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=rockyplus-$releasever
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/plus/$basearch/os/
gpgcheck=1
enabled=0
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
EOF
cat >$Dir_RedHatRepos/Rocky-PowerTools.repo <<\EOF
# Rocky-PowerTools.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for Rocky updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[powertools]
name=Rocky Linux $releasever - PowerTools
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=PowerTools-$releasever
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/PowerTools/$basearch/os/
gpgcheck=1
enabled=0
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
EOF
cat >$Dir_RedHatRepos/Rocky-ResilientStorage.repo <<\EOF
# Rocky-ResilientStorage.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for Rocky updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[resilient-storage]
name=Rocky Linux $releasever - ResilientStorage
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=ResilientStorage-$releasever
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/ResilientStorage/$basearch/os/
gpgcheck=1
enabled=0
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
EOF
cat >$Dir_RedHatRepos/Rocky-RT.repo <<\EOF
# Rocky-RT.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for Rocky updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
[rt]
name=Rocky Linux $releasever - Realtime
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/RT/$basearch/os/
gpgcheck=1
enabled=0
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
EOF
cat >$Dir_RedHatRepos/Rocky-Sources.repo <<\EOF
# Rocky-Sources.repo
[baseos-source]
name=Rocky Linux $releasever - BaseOS - Source
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=BaseOS-$releasever-source
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/source/tree/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
[appstream-source]
name=Rocky Linux $releasever - AppStream - Source
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=AppStream-$releasever-source
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/source/tree/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
#[extras-source]
#name=Rocky Linux $releasever - Extras - Source
#mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=extras-$releasever-source
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/source/tree/
#gpgcheck=1
#enabled=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
#[plus-source]
#name=Rocky Linux $releasever - Plus - Source
#mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=plus-$releasever-source
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/Plus/source/tree/
#gpgcheck=1
#enabled=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
[ha-source]
name=Rocky Linux $releasever - High Availability - Source
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=HighAvailability-$releasever-source
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/source/tree/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
[powertools-source]
name=Rocky Linux $releasever - PowerTools - Source
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=PowerTools-$releasever-source
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/PowerTools/source/tree/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
[resilient-storage-source]
name=Rocky Linux $releasever - Resilient Storage - Source
mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=ResilientStorage-$releasever-source
#baseurl=http://dl.rockylinux.org/$contentdir/$releasever/ResilientStorage/source/tree/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
EOF
;;
esac
}
2021-10-08 00:03:44 +08:00
## 生成 Fedora 官方 repo 源文件
function GenRepoFiles_Fedora() {
cat >$Dir_RedHatRepos/fedora-cisco-openh264.repo <<\EOF
2021-10-08 00:03:44 +08:00
[fedora-cisco-openh264]
name=Fedora $releasever openh264 (From Cisco) - $basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-cisco-openh264-$releasever&arch=$basearch
type=rpm
enabled=1
metadata_expire=14d
repo_gpgcheck=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=True
[fedora-cisco-openh264-debuginfo]
name=Fedora $releasever openh264 (From Cisco) - $basearch - Debug
metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-cisco-openh264-debug-$releasever&arch=$basearch
type=rpm
enabled=0
metadata_expire=14d
repo_gpgcheck=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=True
EOF
cat >$Dir_RedHatRepos/fedora.repo <<\EOF
2021-10-08 00:03:44 +08:00
[fedora]
name=Fedora $releasever - $basearch
#baseurl=http://download.example/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch
enabled=1
countme=1
metadata_expire=7d
repo_gpgcheck=0
type=rpm
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
[fedora-debuginfo]
name=Fedora $releasever - $basearch - Debug
#baseurl=http://download.example/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/tree/
metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-$releasever&arch=$basearch
enabled=0
metadata_expire=7d
repo_gpgcheck=0
type=rpm
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
[fedora-source]
name=Fedora $releasever - Source
#baseurl=http://download.example/pub/fedora/linux/releases/$releasever/Everything/source/tree/
metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-source-$releasever&arch=$basearch
enabled=0
metadata_expire=7d
repo_gpgcheck=0
type=rpm
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
EOF
cat >$Dir_RedHatRepos/fedora-updates.repo <<\EOF
2021-10-08 00:03:44 +08:00
[updates]
name=Fedora $releasever - $basearch - Updates
#baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Everything/$basearch/
metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch
enabled=1
countme=1
repo_gpgcheck=0
type=rpm
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
[updates-debuginfo]
name=Fedora $releasever - $basearch - Updates - Debug
#baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Everything/$basearch/debug/
metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-debug-f$releasever&arch=$basearch
enabled=0
repo_gpgcheck=0
type=rpm
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
[updates-source]
name=Fedora $releasever - Updates Source
#baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Everything/SRPMS/
metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-source-f$releasever&arch=$basearch
enabled=0
repo_gpgcheck=0
type=rpm
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
EOF
cat >$Dir_RedHatRepos/fedora-modular.repo <<\EOF
2021-10-08 00:03:44 +08:00
[fedora-modular]
name=Fedora Modular $releasever - $basearch
#baseurl=http://download.example/pub/fedora/linux/releases/$releasever/Modular/$basearch/os/
metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-modular-$releasever&arch=$basearch
enabled=1
countme=1
#metadata_expire=7d
repo_gpgcheck=0
type=rpm
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
[fedora-modular-debuginfo]
name=Fedora Modular $releasever - $basearch - Debug
#baseurl=http://download.example/pub/fedora/linux/releases/$releasever/Modular/$basearch/debug/tree/
metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-modular-debug-$releasever&arch=$basearch
enabled=0
metadata_expire=7d
repo_gpgcheck=0
type=rpm
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
[fedora-modular-source]
name=Fedora Modular $releasever - Source
#baseurl=http://download.example/pub/fedora/linux/releases/$releasever/Modular/source/tree/
metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-modular-source-$releasever&arch=$basearch
enabled=0
metadata_expire=7d
repo_gpgcheck=0
type=rpm
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
EOF
cat >$Dir_RedHatRepos/fedora-updates-modular.repo <<\EOF
2021-10-08 00:03:44 +08:00
[updates-modular]
name=Fedora Modular $releasever - $basearch - Updates
#baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Modular/$basearch/
metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-modular-f$releasever&arch=$basearch
enabled=1
countme=1
repo_gpgcheck=0
type=rpm
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
[updates-modular-debuginfo]
name=Fedora Modular $releasever - $basearch - Updates - Debug
#baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Modular/$basearch/debug/
metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-modular-debug-f$releasever&arch=$basearch
enabled=0
repo_gpgcheck=0
type=rpm
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
[updates-modular-source]
name=Fedora Modular $releasever - Updates Source
#baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Modular/SRPMS/
metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-modular-source-f$releasever&arch=$basearch
enabled=0
repo_gpgcheck=0
type=rpm
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
EOF
cat >$Dir_RedHatRepos/fedora-updates-testing.repo <<\EOF
2021-10-08 00:03:44 +08:00
[updates-testing]
name=Fedora $releasever - $basearch - Test Updates
#baseurl=http://download.example/pub/fedora/linux/updates/testing/$releasever/Everything/$basearch/
metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-f$releasever&arch=$basearch
enabled=0
countme=1
repo_gpgcheck=0
type=rpm
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
[updates-testing-debuginfo]
name=Fedora $releasever - $basearch - Test Updates Debug
#baseurl=http://download.example/pub/fedora/linux/updates/testing/$releasever/Everything/$basearch/debug/
metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-debug-f$releasever&arch=$basearch
enabled=0
repo_gpgcheck=0
type=rpm
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
[updates-testing-source]
name=Fedora $releasever - Test Updates Source
#baseurl=http://download.example/pub/fedora/linux/updates/testing/$releasever/Everything/SRPMS/
metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-source-f$releasever&arch=$basearch
enabled=0
repo_gpgcheck=0
type=rpm
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
EOF
cat >$Dir_RedHatRepos/fedora-updates-testing-modular.repo <<\EOF
2021-10-08 00:03:44 +08:00
[updates-testing-modular]
name=Fedora Modular $releasever - $basearch - Test Updates
#baseurl=http://download.example/pub/fedora/linux/updates/testing/$releasever/Modular/$basearch/
metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-modular-f$releasever&arch=$basearch
enabled=0
countme=1
repo_gpgcheck=0
type=rpm
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
[updates-testing-modular-debuginfo]
name=Fedora Modular $releasever - $basearch - Test Updates Debug
#baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Modular/$basearch/debug/
metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-modular-debug-f$releasever&arch=$basearch
enabled=0
repo_gpgcheck=0
type=rpm
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
[updates-testing-modular-source]
name=Fedora Modular $releasever - Test Updates Source
#baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Modular/SRPMS/
metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-modular-source-f$releasever&arch=$basearch
enabled=0
repo_gpgcheck=0
type=rpm
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
EOF
}
2023-04-21 12:06:23 +08:00
## 生成 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
}
2023-05-01 16:27:11 +08:00
## 生成 openSUSE 官方 repo 源文件
function GenRepoFiles_openSUSE() {
case $1 in
leap)
case $2 in
15.[0-2])
cat >$Dir_openSUSERepos/repo-debug-non-oss.repo <<\EOF
[repo-debug-non-oss]
name=Debug Repository (Non-OSS)
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/distribution/leap/$releasever/repo/non-oss/
type=NONE
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-debug.repo <<\EOF
[repo-debug]
name=Debug Repository
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/distribution/leap/$releasever/repo/oss/
type=NONE
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-debug-update-non-oss.repo <<\EOF
[repo-debug-update-non-oss]
name=Update Repository (Debug, Non-OSS)
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/update/leap/$releasever/non-oss/
type=NONE
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-debug-update.repo <<\EOF
[repo-debug-update]
name=Update Repository (Debug)
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/update/leap/$releasever/oss/
type=NONE
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-non-oss.repo <<\EOF
[repo-non-oss]
name=Non-OSS Repository
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/distribution/leap/$releasever/repo/non-oss/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-oss.repo <<\EOF
[repo-oss]
name=Main Repository
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/distribution/leap/$releasever/repo/oss/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-source-non-oss.repo <<\EOF
[repo-source-non-oss]
name=Source Repository (Non-OSS)
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/source/distribution/leap/$releasever/repo/non-oss/
type=NONE
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-source.repo <<\EOF
[repo-source]
name=Source Repository
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/source/distribution/leap/$releasever/repo/oss/
type=NONE
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-update-non-oss.repo <<\EOF
[repo-update-non-oss]
name=Update Repository (Non-Oss)
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/update/leap/$releasever/non-oss/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-update.repo <<\EOF
[repo-update]
name=Main Update Repository
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/update/leap/$releasever/oss/
type=rpm-md
keeppackages=0
EOF
;;
*)
cat >$Dir_openSUSERepos/repo-backports-debug-update.repo <<\EOF
[repo-backports-debug-update]
name=Update repository with updates for openSUSE Leap debuginfo packages from openSUSE Backports
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/update/leap/$releasever/backports_debug/
type=NONE
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-backports-update.repo <<\EOF
[repo-backports-update]
name=Update repository of openSUSE Backports
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/update/leap/$releasever/backports/
path=/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-debug-non-oss.repo <<\EOF
[repo-debug-non-oss]
name=Debug Repository (Non-OSS)
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/distribution/leap/$releasever/repo/non-oss/
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-debug.repo <<\EOF
[repo-debug]
name=Debug Repository
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/distribution/leap/$releasever/repo/oss/
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-debug-update-non-oss.repo <<\EOF
[repo-debug-update-non-oss]
name=Update Repository (Debug, Non-OSS)
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/update/leap/$releasever/non-oss/
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-debug-update.repo <<\EOF
[repo-debug-update]
name=Update Repository (Debug)
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/update/leap/$releasever/oss/
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-non-oss.repo <<\EOF
[repo-non-oss]
name=Non-OSS Repository
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/distribution/leap/$releasever/repo/non-oss/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-oss.repo <<\EOF
[repo-oss]
name=Main Repository
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/distribution/leap/$releasever/repo/oss/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-sle-debug-update.repo <<\EOF
[repo-sle-debug-update]
name=Update repository with debuginfo for updates from SUSE Linux Enterprise 15
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/update/leap/$releasever/sle/
path=/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-sle-update.repo <<\EOF
[repo-sle-update]
name=Update repository with updates from SUSE Linux Enterprise 15
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/update/leap/$releasever/sle/
path=/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-source.repo <<\EOF
[repo-source]
name=Source Repository
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/source/distribution/leap/$releasever/repo/oss/
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-update-non-oss.repo <<\EOF
[repo-update-non-oss]
name=Update Repository (Non-Oss)
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/update/leap/$releasever/non-oss/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-update.repo <<\EOF
[repo-update]
name=Main Update Repository
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/update/leap/$releasever/oss/
type=rpm-md
keeppackages=0
EOF
;;
esac
;;
tumbleweed)
cat >$Dir_openSUSERepos/repo-debug.repo <<\EOF
[repo-debug]
name=openSUSE-Tumbleweed-Debug
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/tumbleweed/repo/oss/
path=/
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-non-oss.repo <<\EOF
[repo-non-oss]
name=openSUSE-Tumbleweed-Non-Oss
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/tumbleweed/repo/non-oss/
path=/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-openh264.repo <<\EOF
[repo-openh264]
name=Open H.264 Codec (openSUSE Tumbleweed)
enabled=1
autorefresh=1
baseurl=http://codecs.opensuse.org/openh264/openSUSE_Tumbleweed
path=/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-oss.repo <<\EOF
[repo-oss]
name=openSUSE-Tumbleweed-Oss
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/tumbleweed/repo/oss/
path=/
type=rpm-md
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-source.repo <<\EOF
[repo-source]
name=openSUSE-Tumbleweed-Source
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/source/tumbleweed/repo/oss/
path=/
keeppackages=0
EOF
cat >$Dir_openSUSERepos/repo-update.repo <<\EOF
[repo-update]
name=openSUSE-Tumbleweed-Update
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/update/tumbleweed/
path=/
type=rpm-md
keeppackages=0
EOF
;;
esac
}
2023-04-21 13:26:25 +08:00
## 生成 EPEL 附加软件包官方 repo 源文件
2023-04-19 01:26:44 +08:00
function GenRepoFiles_EPEL() {
case ${SYSTEM_VERSION_NUMBER:0:1} in
9)
cat >$Dir_RedHatRepos/epel.repo <<\EOF
[epel]
name=Extra Packages for Enterprise Linux $releasever - $basearch
# It is much more secure to use the metalink, but if you wish to use a local mirror
# place its address here.
#baseurl=https://download.example/pub/epel/$releasever/Everything/$basearch/
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=1
gpgcheck=1
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever
[epel-debuginfo]
name=Extra Packages for Enterprise Linux $releasever - $basearch - Debug
# It is much more secure to use the metalink, but if you wish to use a local mirror
# place its address here.
#baseurl=https://download.example/pub/epel/$releasever/Everything/$basearch/debug/
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever
gpgcheck=1
[epel-source]
name=Extra Packages for Enterprise Linux $releasever - $basearch - Source
# It is much more secure to use the metalink, but if you wish to use a local mirror
# place its address here.
#baseurl=https://download.example/pub/epel/$releasever/Everything/source/tree/
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever
gpgcheck=1
EOF
cat >$Dir_RedHatRepos/epel-testing.repo <<\EOF
[epel-testing]
name=Extra Packages for Enterprise Linux $releasever - Testing - $basearch
# It is much more secure to use the metalink, but if you wish to use a local mirror
# place its address here.
#baseurl=https://download.example/pub/epel/testing/$releasever/Everything/$basearch/
metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgcheck=1
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever
[epel-testing-debuginfo]
name=Extra Packages for Enterprise Linux $releasever - Testing - $basearch - Debug
# It is much more secure to use the metalink, but if you wish to use a local mirror
# place its address here.
#baseurl=https://download.example/pub/epel/testing/$releasever/Everything/$basearch/debug/
metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever
gpgcheck=1
[epel-testing-source]
name=Extra Packages for Enterprise Linux $releasever - Testing - $basearch - Source
# It is much more secure to use the metalink, but if you wish to use a local mirror
# place its address here.
#baseurl=https://download.example/pub/epel/testing/$releasever/Everything/source/tree/
metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever
gpgcheck=1
EOF
;;
8)
cat >$Dir_RedHatRepos/epel.repo <<\EOF
2021-10-08 00:03:44 +08:00
[epel]
name=Extra Packages for Enterprise Linux $releasever - $basearch
2022-09-14 00:26:52 +08:00
#baseurl=https://download.fedoraproject.org/pub/epel/8/Everything/$basearch
2021-10-08 00:03:44 +08:00
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
[epel-debuginfo]
name=Extra Packages for Enterprise Linux $releasever - $basearch - Debug
2022-09-14 00:26:52 +08:00
#baseurl=https://download.fedoraproject.org/pub/epel/8/Everything/$basearch/debug
2021-10-08 00:03:44 +08:00
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
gpgcheck=1
[epel-source]
name=Extra Packages for Enterprise Linux $releasever - $basearch - Source
2022-09-14 00:26:52 +08:00
#baseurl=https://download.fedoraproject.org/pub/epel/8/Everything/SRPMS
2021-10-08 00:03:44 +08:00
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
gpgcheck=1
EOF
cat >$Dir_RedHatRepos/epel-modular.repo <<\EOF
2021-10-08 00:03:44 +08:00
[epel-modular]
name=Extra Packages for Enterprise Linux Modular $releasever - $basearch
2022-09-14 00:26:52 +08:00
#baseurl=https://download.fedoraproject.org/pub/epel/8/Modular/$basearch
2021-10-08 00:03:44 +08:00
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-modular-$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
[epel-modular-debuginfo]
name=Extra Packages for Enterprise Linux Modular $releasever - $basearch - Debug
2022-09-14 00:26:52 +08:00
#baseurl=https://download.fedoraproject.org/pub/epel/8/Modular/$basearch/debug
2021-10-08 00:03:44 +08:00
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-modular-debug-$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
gpgcheck=1
[epel-modular-source]
name=Extra Packages for Enterprise Linux Modular $releasever - $basearch - Source
2022-09-14 00:26:52 +08:00
#baseurl=https://download.fedoraproject.org/pub/epel/8/Modular/SRPMS
2021-10-08 00:03:44 +08:00
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-modular-source-$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
gpgcheck=1
EOF
cat >$Dir_RedHatRepos/epel-playground.repo <<\EOF
2021-10-08 00:03:44 +08:00
[epel-playground]
name=Extra Packages for Enterprise Linux $releasever - Playground - $basearch
#baseurl=https://download.fedoraproject.org/pub/epel/playground/$releasever/Everything/$basearch/os
metalink=https://mirrors.fedoraproject.org/metalink?repo=playground-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
[epel-playground-debuginfo]
name=Extra Packages for Enterprise Linux $releasever - Playground - $basearch - Debug
#baseurl=https://download.fedoraproject.org/pub/epel/playground/$releasever/Everything/$basearch/debug
metalink=https://mirrors.fedoraproject.org/metalink?repo=playground-debug-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
gpgcheck=1
[epel-playground-source]
name=Extra Packages for Enterprise Linux $releasever - Playground - $basearch - Source
#baseurl=https://download.fedoraproject.org/pub/epel/playground/$releasever/Everything/source/tree/
metalink=https://mirrors.fedoraproject.org/metalink?repo=playground-source-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
gpgcheck=1
EOF
cat >$Dir_RedHatRepos/epel-testing.repo <<\EOF
2021-10-08 00:03:44 +08:00
[epel-testing]
name=Extra Packages for Enterprise Linux $releasever - Testing - $basearch
#baseurl=https://download.fedoraproject.org/pub/epel/testing/$releasever/Everything/$basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
[epel-testing-debuginfo]
name=Extra Packages for Enterprise Linux $releasever - Testing - $basearch - Debug
#baseurl=https://download.fedoraproject.org/pub/epel/testing/$releasever/Everything/$basearch/debug
metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
gpgcheck=1
[epel-testing-source]
name=Extra Packages for Enterprise Linux $releasever - Testing - $basearch - Source
#baseurl=https://download.fedoraproject.org/pub/epel/testing/$releasever/Everything/SRPMS
metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
gpgcheck=1
EOF
cat >$Dir_RedHatRepos/epel-testing-modular.repo <<\EOF
2021-10-08 00:03:44 +08:00
[epel-testing-modular]
name=Extra Packages for Enterprise Linux Modular $releasever - Testing - $basearch
#baseurl=https://download.fedoraproject.org/pub/epel/testing/$releasever/Modular/$basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-modular-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
[epel-testing-modular-debuginfo]
name=Extra Packages for Enterprise Linux Modular $releasever - Testing - $basearch - Debug
#baseurl=https://download.fedoraproject.org/pub/epel/testing/$releasever/Modular/$basearch/debug
metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-modular-debug-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
gpgcheck=1
[epel-testing-modular-source]
name=Extra Packages for Enterprise Linux Modular $releasever - Testing - $basearch - Source
#baseurl=https://download.fedoraproject.org/pub/epel/testing/$releasever/Modular/SRPMS
metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-modular-source-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
gpgcheck=1
EOF
;;
7)
cat >$Dir_RedHatRepos/epel.repo <<\EOF
2021-10-08 00:03:44 +08:00
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
EOF
cat >$Dir_RedHatRepos/epel-testing.repo <<\EOF
2021-10-08 00:03:44 +08:00
[epel-testing]
name=Extra Packages for Enterprise Linux 7 - Testing - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/testing/7/$basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-epel7&arch=$basearch
failovermethod=priority
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
[epel-testing-debuginfo]
name=Extra Packages for Enterprise Linux 7 - Testing - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/testing/7/$basearch/debug
metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
[epel-testing-source]
name=Extra Packages for Enterprise Linux 7 - Testing - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/testing/7/SRPMS
metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
EOF
;;
esac
2021-10-08 00:03:44 +08:00
}
2023-05-01 16:27:11 +08:00
## 组合函数
function Combin_Function() {
PermissionJudgment
EnvJudgment
ChooseMirrors
ChooseWebProtocol
ChooseInstallEPEL
CloseFirewall
BackupMirrors
RemoveOldMirrors
ChangeMirrors
UpgradeSoftware
AuthorSignature
}
2021-10-08 00:03:44 +08:00
Combin_Function