mirror of
https://gitee.com/SuperManito/LinuxMirrors
synced 2025-11-05 00:40:27 +08:00
优化
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
## Author: SuperManito
|
## Author: SuperManito
|
||||||
## Modified: 2025-03-15
|
## Modified: 2025-03-16
|
||||||
## License: MIT
|
## License: MIT
|
||||||
## GitHub: https://github.com/SuperManito/LinuxMirrors
|
## GitHub: https://github.com/SuperManito/LinuxMirrors
|
||||||
## Website: https://linuxmirrors.cn
|
## Website: https://linuxmirrors.cn
|
||||||
@@ -184,7 +184,7 @@ File_LinuxRelease=/etc/os-release
|
|||||||
File_RedHatRelease=/etc/redhat-release
|
File_RedHatRelease=/etc/redhat-release
|
||||||
File_DebianVersion=/etc/debian_version
|
File_DebianVersion=/etc/debian_version
|
||||||
File_ArmbianRelease=/etc/armbian-release
|
File_ArmbianRelease=/etc/armbian-release
|
||||||
File_RaspberryPiRelease=/etc/rpi-issue
|
File_RaspberryPiOSRelease=/etc/rpi-issue
|
||||||
File_openEulerRelease=/etc/openEuler-release
|
File_openEulerRelease=/etc/openEuler-release
|
||||||
File_OpenCloudOSRelease=/etc/opencloudos-release
|
File_OpenCloudOSRelease=/etc/opencloudos-release
|
||||||
File_AnolisOSRelease=/etc/anolis-release
|
File_AnolisOSRelease=/etc/anolis-release
|
||||||
@@ -646,25 +646,25 @@ function collect_system_info() {
|
|||||||
## 定义系统ID
|
## 定义系统ID
|
||||||
SYSTEM_ID="$(cat $File_LinuxRelease | grep -E "^ID=" | awk -F '=' '{print$2}' | sed "s/[\'\"]//g")"
|
SYSTEM_ID="$(cat $File_LinuxRelease | grep -E "^ID=" | awk -F '=' '{print$2}' | sed "s/[\'\"]//g")"
|
||||||
## 判定当前系统派系
|
## 判定当前系统派系
|
||||||
if [ -s $File_DebianVersion ]; then
|
if [ -s "${File_DebianVersion}" ]; then
|
||||||
SYSTEM_FACTIONS="${SYSTEM_DEBIAN}"
|
SYSTEM_FACTIONS="${SYSTEM_DEBIAN}"
|
||||||
elif [ -s $File_OracleLinuxRelease ]; then
|
elif [ -s "${File_OracleLinuxRelease}" ]; then
|
||||||
output_error "当前操作系统不在本脚本的支持范围内,请前往官网查看支持列表!"
|
output_error "当前操作系统不在本脚本的支持范围内,请前往官网查看支持列表!"
|
||||||
elif [ -s $File_RedHatRelease ]; then
|
elif [ -s "${File_RedHatRelease}" ]; then
|
||||||
SYSTEM_FACTIONS="${SYSTEM_REDHAT}"
|
SYSTEM_FACTIONS="${SYSTEM_REDHAT}"
|
||||||
elif [ -s $File_openEulerRelease ]; then
|
elif [ -s "${File_openEulerRelease}" ]; then
|
||||||
SYSTEM_FACTIONS="${SYSTEM_OPENEULER}"
|
SYSTEM_FACTIONS="${SYSTEM_OPENEULER}"
|
||||||
elif [ -s $File_OpenCloudOSRelease ]; then
|
elif [ -s "${File_OpenCloudOSRelease}" ]; then
|
||||||
SYSTEM_FACTIONS="${SYSTEM_OPENCLOUDOS}" # 自 9.0 版本起不再基于红帽
|
SYSTEM_FACTIONS="${SYSTEM_OPENCLOUDOS}" # 自 9.0 版本起不再基于红帽
|
||||||
elif [ -s $File_AnolisOSRelease ]; then
|
elif [ -s "${File_AnolisOSRelease}" ]; then
|
||||||
SYSTEM_FACTIONS="${SYSTEM_ANOLISOS}" # 自 8.8 版本起不再基于红帽
|
SYSTEM_FACTIONS="${SYSTEM_ANOLISOS}" # 自 8.8 版本起不再基于红帽
|
||||||
elif [ -s $File_openKylinVersion ]; then
|
elif [ -s "${File_openKylinVersion}" ]; then
|
||||||
SYSTEM_FACTIONS="${SYSTEM_OPENKYLIN}"
|
SYSTEM_FACTIONS="${SYSTEM_OPENKYLIN}"
|
||||||
elif [ -f $File_ArchLinuxRelease ]; then
|
elif [ -f "${File_ArchLinuxRelease}" ]; then
|
||||||
SYSTEM_FACTIONS="${SYSTEM_ARCH}"
|
SYSTEM_FACTIONS="${SYSTEM_ARCH}"
|
||||||
elif [ -f $File_AlpineRelease ]; then
|
elif [ -f "${File_AlpineRelease}" ]; then
|
||||||
SYSTEM_FACTIONS="${SYSTEM_ALPINE}"
|
SYSTEM_FACTIONS="${SYSTEM_ALPINE}"
|
||||||
elif [ -f $File_GentooRelease ]; then
|
elif [ -f "${File_GentooRelease}" ]; then
|
||||||
SYSTEM_FACTIONS="${SYSTEM_GENTOO}"
|
SYSTEM_FACTIONS="${SYSTEM_GENTOO}"
|
||||||
elif [[ "${SYSTEM_NAME}" == *"openSUSE"* ]]; then
|
elif [[ "${SYSTEM_NAME}" == *"openSUSE"* ]]; then
|
||||||
SYSTEM_FACTIONS="${SYSTEM_OPENSUSE}"
|
SYSTEM_FACTIONS="${SYSTEM_OPENSUSE}"
|
||||||
@@ -685,7 +685,7 @@ function collect_system_info() {
|
|||||||
SYSTEM_JUDGMENT="$(lsb_release -is)"
|
SYSTEM_JUDGMENT="$(lsb_release -is)"
|
||||||
SYSTEM_VERSION_CODENAME="${DEBIAN_CODENAME:-"$(lsb_release -cs)"}"
|
SYSTEM_VERSION_CODENAME="${DEBIAN_CODENAME:-"$(lsb_release -cs)"}"
|
||||||
# Raspberry Pi OS
|
# Raspberry Pi OS
|
||||||
if [ -s $File_RaspberryPiRelease ]; then
|
if [ -s "${File_RaspberryPiOSRelease}" ]; then
|
||||||
SYSTEM_JUDGMENT="${SYSTEM_RASPBERRY_PI_OS}"
|
SYSTEM_JUDGMENT="${SYSTEM_RASPBERRY_PI_OS}"
|
||||||
SYSTEM_PRETTY_NAME="${SYSTEM_RASPBERRY_PI_OS}"
|
SYSTEM_PRETTY_NAME="${SYSTEM_RASPBERRY_PI_OS}"
|
||||||
fi
|
fi
|
||||||
@@ -1319,18 +1319,18 @@ function backup_original_mirrors() {
|
|||||||
## 自新版本的 Debian 与 Ubuntu 起,软件源文件格式统一为 DEB822 格式,涉及 Debian 12 的容器镜像、Ubuntu 24.04 和未来尚未发布的版本
|
## 自新版本的 Debian 与 Ubuntu 起,软件源文件格式统一为 DEB822 格式,涉及 Debian 12 的容器镜像、Ubuntu 24.04 和未来尚未发布的版本
|
||||||
# Debian DEB822 格式源文件
|
# Debian DEB822 格式源文件
|
||||||
if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_DEBIAN}" ]]; then
|
if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_DEBIAN}" ]]; then
|
||||||
[ -f $File_DebianSources ] && backup_file $File_DebianSources $File_DebianSourcesBackup "debian.sources"
|
[ -f "${File_DebianSources}" ] && backup_file $File_DebianSources $File_DebianSourcesBackup "debian.sources"
|
||||||
fi
|
fi
|
||||||
# Ubuntu DEB822 格式源文件
|
# Ubuntu DEB822 格式源文件
|
||||||
if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_UBUNTU}" ]]; then
|
if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_UBUNTU}" ]]; then
|
||||||
[ -f $File_UbuntuSources ] && backup_file $File_UbuntuSources $File_UbuntuSourcesBackup "ubuntu.sources"
|
[ -f "${File_UbuntuSources}" ] && backup_file $File_UbuntuSources $File_UbuntuSourcesBackup "ubuntu.sources"
|
||||||
fi
|
fi
|
||||||
# Armbian
|
# Armbian
|
||||||
if [ -f $File_ArmbianRelease ]; then
|
if [ -f "${File_ArmbianRelease}" ]; then
|
||||||
backup_file $File_ArmbianSourceList $File_ArmbianSourceListBackup "armbian.list"
|
backup_file $File_ArmbianSourceList $File_ArmbianSourceListBackup "armbian.list"
|
||||||
fi
|
fi
|
||||||
# Proxmox VE
|
# Proxmox VE
|
||||||
if [ -f $File_ProxmoxVersion ]; then
|
if [ -f "${File_ProxmoxVersion}" ]; then
|
||||||
backup_file $File_ProxmoxSourceList $File_ProxmoxSourceListBackup "pve-no-subscription.list"
|
backup_file $File_ProxmoxSourceList $File_ProxmoxSourceListBackup "pve-no-subscription.list"
|
||||||
fi
|
fi
|
||||||
# Linux Mint
|
# Linux Mint
|
||||||
@@ -1366,7 +1366,7 @@ function backup_original_mirrors() {
|
|||||||
backup_file $File_GentooReposConf $File_GentooReposConfBackup "gentoo.conf"
|
backup_file $File_GentooReposConf $File_GentooReposConfBackup "gentoo.conf"
|
||||||
;;
|
;;
|
||||||
"${SYSTEM_NIXOS}")
|
"${SYSTEM_NIXOS}")
|
||||||
[ ! -d $Dir_NixConfig ] && mkdir -p $Dir_NixConfig
|
[ ! -d "${Dir_NixConfig}" ] && mkdir -p "${Dir_NixConfig}"
|
||||||
# /etc/nix/nix.conf
|
# /etc/nix/nix.conf
|
||||||
backup_file $File_NixConf $File_NixConfBackup "nix.conf"
|
backup_file $File_NixConf $File_NixConfBackup "nix.conf"
|
||||||
;;
|
;;
|
||||||
@@ -1379,38 +1379,38 @@ function remove_original_mirrors() {
|
|||||||
case "${SYSTEM_FACTIONS}" in
|
case "${SYSTEM_FACTIONS}" in
|
||||||
"${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}")
|
"${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}")
|
||||||
if [[ "${SYSTEM_JUDGMENT}" != "${SYSTEM_LINUX_MINT}" ]]; then
|
if [[ "${SYSTEM_JUDGMENT}" != "${SYSTEM_LINUX_MINT}" ]]; then
|
||||||
[ -f $File_DebianSourceList ] && sed -i '1,$d' $File_DebianSourceList
|
[ -f "${File_DebianSourceList}" ] && sed -i '1,$d' $File_DebianSourceList
|
||||||
fi
|
fi
|
||||||
[ -d $Dir_DebianExtendSource ] || mkdir -p $Dir_DebianExtendSource
|
[ -d "${Dir_DebianExtendSource}" ] || mkdir -p $Dir_DebianExtendSource
|
||||||
## 自新版本的 Debian 与 Ubuntu 起,软件源文件格式统一为 DEB822 格式,涉及 Debian 12 的容器镜像、Ubuntu 24.04 和未来尚未发布的版本
|
## 自新版本的 Debian 与 Ubuntu 起,软件源文件格式统一为 DEB822 格式,涉及 Debian 12 的容器镜像、Ubuntu 24.04 和未来尚未发布的版本
|
||||||
# Debian DEB822 格式源文件
|
# Debian DEB822 格式源文件
|
||||||
if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_DEBIAN}" ]]; then
|
if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_DEBIAN}" ]]; then
|
||||||
[ -f $File_DebianSources ] && rm -rf $File_DebianSources
|
[ -f "${File_DebianSources}" ] && rm -rf "${File_DebianSources}"
|
||||||
fi
|
fi
|
||||||
# Ubuntu DEB822 格式源文件
|
# Ubuntu DEB822 格式源文件
|
||||||
if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_UBUNTU}" ]]; then
|
if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_UBUNTU}" ]]; then
|
||||||
[ -f $File_UbuntuSources ] && rm -rf $File_UbuntuSources
|
[ -f "${File_UbuntuSources}" ] && rm -rf "${File_UbuntuSources}"
|
||||||
fi
|
fi
|
||||||
# Armbian
|
# Armbian
|
||||||
if [ -f $File_ArmbianRelease ]; then
|
if [ -f "${File_ArmbianRelease}" ]; then
|
||||||
[ -f $File_ArmbianSourceList ] && sed -i '1,$d' $File_ArmbianSourceList
|
[ -f "${File_ArmbianSourceList}" ] && sed -i '1,$d' $File_ArmbianSourceList
|
||||||
fi
|
fi
|
||||||
# Proxmox VE
|
# Proxmox VE
|
||||||
if [ -f $File_ProxmoxVersion ]; then
|
if [ -f "${File_ProxmoxVersion}" ]; then
|
||||||
[ -f $File_ProxmoxSourceList ] && sed -i '1,$d' $File_ProxmoxSourceList
|
[ -f "${File_ProxmoxSourceList}" ] && sed -i '1,$d' $File_ProxmoxSourceList
|
||||||
fi
|
fi
|
||||||
# Linux Mint
|
# Linux Mint
|
||||||
if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_LINUX_MINT}" ]]; then
|
if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_LINUX_MINT}" ]]; then
|
||||||
[ -f $File_LinuxMintSourceList ] && sed -i '1,$d' $File_LinuxMintSourceList
|
[ -f "${File_LinuxMintSourceList}" ] && sed -i '1,$d' $File_LinuxMintSourceList
|
||||||
fi
|
fi
|
||||||
# Raspberry Pi OS
|
# Raspberry Pi OS
|
||||||
if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_RASPBERRY_PI_OS}" ]]; then
|
if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_RASPBERRY_PI_OS}" ]]; then
|
||||||
[ -f $File_RaspberryPiSourceList ] && sed -i '1,$d' $File_RaspberryPiSourceList
|
[ -f "${File_RaspberryPiSourceList}" ] && sed -i '1,$d' $File_RaspberryPiSourceList
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
"${SYSTEM_REDHAT}")
|
"${SYSTEM_REDHAT}")
|
||||||
if [ ! -d $Dir_YumRepos ]; then
|
if [ ! -d "${Dir_YumRepos}" ]; then
|
||||||
mkdir -p $Dir_YumRepos
|
mkdir -p "${Dir_YumRepos}"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_FEDORA}" ]]; then
|
if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_FEDORA}" ]]; then
|
||||||
@@ -1429,7 +1429,7 @@ function remove_original_mirrors() {
|
|||||||
rm -rf $Dir_YumRepos/centos.repo $Dir_YumRepos/centos-addons.repo
|
rm -rf $Dir_YumRepos/centos.repo $Dir_YumRepos/centos-addons.repo
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ -f $Dir_YumRepos/epel.repo ]; then
|
if [ -f "${Dir_YumRepos}/epel.repo" ]; then
|
||||||
ls $Dir_YumRepos/ | grep -Ev epel | xargs rm -rf
|
ls $Dir_YumRepos/ | grep -Ev epel | xargs rm -rf
|
||||||
else
|
else
|
||||||
rm -rf $Dir_YumRepos/*
|
rm -rf $Dir_YumRepos/*
|
||||||
@@ -1438,7 +1438,7 @@ function remove_original_mirrors() {
|
|||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
"${SYSTEM_CENTOS}")
|
"${SYSTEM_CENTOS}")
|
||||||
if [ -f $Dir_YumRepos/epel.repo ]; then
|
if [ -f "${Dir_YumRepos}/epel.repo" ]; then
|
||||||
ls $Dir_YumRepos/ | grep -Ev epel | xargs rm -rf
|
ls $Dir_YumRepos/ | grep -Ev epel | xargs rm -rf
|
||||||
else
|
else
|
||||||
rm -rf $Dir_YumRepos/*
|
rm -rf $Dir_YumRepos/*
|
||||||
@@ -1477,37 +1477,37 @@ function remove_original_mirrors() {
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
"${SYSTEM_OPENEULER}")
|
"${SYSTEM_OPENEULER}")
|
||||||
if [ ! -d $Dir_YumRepos ]; then
|
if [ ! -d "${Dir_YumRepos}" ]; then
|
||||||
mkdir -p $Dir_YumRepos
|
mkdir -p $Dir_YumRepos
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
rm -rf $Dir_YumRepos/openEuler.repo
|
rm -rf $Dir_YumRepos/openEuler.repo
|
||||||
;;
|
;;
|
||||||
"${SYSTEM_OPENCLOUDOS}")
|
"${SYSTEM_OPENCLOUDOS}")
|
||||||
if [ ! -d $Dir_YumRepos ]; then
|
if [ ! -d "${Dir_YumRepos}" ]; then
|
||||||
mkdir -p $Dir_YumRepos
|
mkdir -p $Dir_YumRepos
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
rm -rf $Dir_YumRepos/OpenCloudOS*
|
rm -rf $Dir_YumRepos/OpenCloudOS*
|
||||||
;;
|
;;
|
||||||
"${SYSTEM_ANOLISOS}")
|
"${SYSTEM_ANOLISOS}")
|
||||||
if [ ! -d $Dir_YumRepos ]; then
|
if [ ! -d "${Dir_YumRepos}" ]; then
|
||||||
mkdir -p $Dir_YumRepos
|
mkdir -p $Dir_YumRepos
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
rm -rf $Dir_YumRepos/AnolisOS*
|
rm -rf $Dir_YumRepos/AnolisOS*
|
||||||
;;
|
;;
|
||||||
"${SYSTEM_OPENSUSE}")
|
"${SYSTEM_OPENSUSE}")
|
||||||
[ -d $Dir_ZYppRepos ] && rm -rf $Dir_ZYppRepos/repo-*
|
[ -d "${Dir_ZYppRepos}" ] && rm -rf $Dir_ZYppRepos/repo-*
|
||||||
;;
|
;;
|
||||||
"${SYSTEM_ARCH}")
|
"${SYSTEM_ARCH}")
|
||||||
[ -f $File_ArchLinuxMirrorList ] && sed -i '1,$d' $File_ArchLinuxMirrorList
|
[ -f "${File_ArchLinuxMirrorList}" ] && sed -i '1,$d' $File_ArchLinuxMirrorList
|
||||||
;;
|
;;
|
||||||
"${SYSTEM_ALPINE}")
|
"${SYSTEM_ALPINE}")
|
||||||
[ -f $File_AlpineRepositories ] && sed -i '1,$d' $File_AlpineRepositories
|
[ -f "${File_AlpineRepositories}" ] && sed -i '1,$d' $File_AlpineRepositories
|
||||||
;;
|
;;
|
||||||
"${SYSTEM_GENTOO}")
|
"${SYSTEM_GENTOO}")
|
||||||
[ -f $File_GentooReposConf ] && sed -i '1,$d' $File_GentooReposConf
|
[ -f "${File_GentooReposConf}" ] && sed -i '1,$d' $File_GentooReposConf
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
@@ -1520,7 +1520,7 @@ function change_mirrors_main() {
|
|||||||
function diff_file() {
|
function diff_file() {
|
||||||
local diff_file=$1
|
local diff_file=$1
|
||||||
local origin_file=$2
|
local origin_file=$2
|
||||||
if [[ -s $diff_file ]] && [[ -s $origin_file ]]; then
|
if [ -s "${diff_file}" ] && [ -s "${origin_file}" ]; then
|
||||||
if [[ "$(cat "${diff_file}")" != "$(cat "${origin_file}")" ]]; then
|
if [[ "$(cat "${diff_file}")" != "$(cat "${origin_file}")" ]]; then
|
||||||
echo -e "\n${BLUE}${diff_file}${PLAIN} -> ${BLUE}${origin_file}${PLAIN}"
|
echo -e "\n${BLUE}${diff_file}${PLAIN} -> ${BLUE}${origin_file}${PLAIN}"
|
||||||
diff "${diff_file}" "${origin_file}" -d --color=always -I -B -E
|
diff "${diff_file}" "${origin_file}" -d --color=always -I -B -E
|
||||||
@@ -1543,11 +1543,11 @@ function change_mirrors_main() {
|
|||||||
diff_file $File_DebianSourceListBackup $File_DebianSourceList
|
diff_file $File_DebianSourceListBackup $File_DebianSourceList
|
||||||
fi
|
fi
|
||||||
# Armbian
|
# Armbian
|
||||||
if [ -f $File_ArmbianRelease ]; then
|
if [ -f "${File_ArmbianRelease}" ]; then
|
||||||
diff_file $File_ArmbianSourceListBackup $File_ArmbianSourceList
|
diff_file $File_ArmbianSourceListBackup $File_ArmbianSourceList
|
||||||
fi
|
fi
|
||||||
# Proxmox VE
|
# Proxmox VE
|
||||||
if [ -f $File_ProxmoxVersion ]; then
|
if [ -f "${File_ProxmoxVersion}" ]; then
|
||||||
diff_file $File_ProxmoxSourceListBackup $File_ProxmoxSourceList
|
diff_file $File_ProxmoxSourceListBackup $File_ProxmoxSourceList
|
||||||
fi
|
fi
|
||||||
# Linux Mint
|
# Linux Mint
|
||||||
@@ -1974,11 +1974,11 @@ deb ${base_url} ${base_system_codename} ${repository_sections}
|
|||||||
esac
|
esac
|
||||||
## 处理其它衍生操作系统的专用源
|
## 处理其它衍生操作系统的专用源
|
||||||
# Armbian
|
# Armbian
|
||||||
if [ -f $File_ArmbianRelease ]; then
|
if [ -f "${File_ArmbianRelease}" ]; then
|
||||||
echo "deb [signed-by=/usr/share/keyrings/armbian.gpg] ${WEB_PROTOCOL}://${SOURCE}/armbian ${SYSTEM_VERSION_CODENAME} main ${SYSTEM_VERSION_CODENAME}-utils ${SYSTEM_VERSION_CODENAME}-desktop" >>$File_ArmbianSourceList
|
echo "deb [signed-by=/usr/share/keyrings/armbian.gpg] ${WEB_PROTOCOL}://${SOURCE}/armbian ${SYSTEM_VERSION_CODENAME} main ${SYSTEM_VERSION_CODENAME}-utils ${SYSTEM_VERSION_CODENAME}-desktop" >>$File_ArmbianSourceList
|
||||||
fi
|
fi
|
||||||
# Proxmox VE
|
# Proxmox VE
|
||||||
if [ -f $File_ProxmoxVersion ]; then
|
if [ -f "${File_ProxmoxVersion}" ]; then
|
||||||
echo "deb ${WEB_PROTOCOL}://${SOURCE}/proxmox/debian/pve ${SYSTEM_VERSION_CODENAME} pve-no-subscription
|
echo "deb ${WEB_PROTOCOL}://${SOURCE}/proxmox/debian/pve ${SYSTEM_VERSION_CODENAME} pve-no-subscription
|
||||||
# deb ${WEB_PROTOCOL}://${SOURCE}/proxmox/debian/pbs ${SYSTEM_VERSION_CODENAME} pbs-no-subscription
|
# deb ${WEB_PROTOCOL}://${SOURCE}/proxmox/debian/pbs ${SYSTEM_VERSION_CODENAME} pbs-no-subscription
|
||||||
# deb ${WEB_PROTOCOL}://${SOURCE}/proxmox/debian/pbs-client ${SYSTEM_VERSION_CODENAME} pbs-client-no-subscription
|
# deb ${WEB_PROTOCOL}://${SOURCE}/proxmox/debian/pbs-client ${SYSTEM_VERSION_CODENAME} pbs-client-no-subscription
|
||||||
@@ -2388,7 +2388,7 @@ function change_mirrors_Gentoo() {
|
|||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
sed -i "/^GENTOO_MIRRORS=/d" $File_GentooMakeConf
|
sed -i "/^GENTOO_MIRRORS=/d" $File_GentooMakeConf
|
||||||
fi
|
fi
|
||||||
[ -f $File_GentooReposConf ] && rm -rf $File_GentooReposConf
|
[ -f "${File_GentooReposConf}" ] && rm -rf $File_GentooReposConf
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
## 修改源
|
## 修改源
|
||||||
@@ -2483,11 +2483,11 @@ function change_mirrors_or_install_EPEL() {
|
|||||||
rm -rf $Dir_YumRepos/epel*
|
rm -rf $Dir_YumRepos/epel*
|
||||||
fi
|
fi
|
||||||
## 删除原有 repo 源文件
|
## 删除原有 repo 源文件
|
||||||
if [ -d $Dir_YumRepos ]; then
|
if [ -d "${Dir_YumRepos}" ]; then
|
||||||
ls $Dir_YumRepos | grep epel -q
|
ls $Dir_YumRepos | grep epel -q
|
||||||
[ $? -eq 0 ] && rm -rf $Dir_YumRepos/epel*
|
[ $? -eq 0 ] && rm -rf $Dir_YumRepos/epel*
|
||||||
fi
|
fi
|
||||||
if [ -d $Dir_YumReposBackup ]; then
|
if [ -d "${Dir_YumReposBackup}" ]; then
|
||||||
ls $Dir_YumReposBackup | grep epel -q
|
ls $Dir_YumReposBackup | grep epel -q
|
||||||
[ $? -eq 0 ] && rm -rf $Dir_YumReposBackup/epel*
|
[ $? -eq 0 ] && rm -rf $Dir_YumReposBackup/epel*
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
## Author: SuperManito
|
## Author: SuperManito
|
||||||
## Modified: 2025-03-15
|
## Modified: 2025-03-16
|
||||||
## License: MIT
|
## License: MIT
|
||||||
## GitHub: https://github.com/SuperManito/LinuxMirrors
|
## GitHub: https://github.com/SuperManito/LinuxMirrors
|
||||||
## Website: https://linuxmirrors.cn
|
## Website: https://linuxmirrors.cn
|
||||||
@@ -84,7 +84,7 @@ File_LinuxRelease=/etc/os-release
|
|||||||
File_RedHatRelease=/etc/redhat-release
|
File_RedHatRelease=/etc/redhat-release
|
||||||
File_DebianVersion=/etc/debian_version
|
File_DebianVersion=/etc/debian_version
|
||||||
File_ArmbianRelease=/etc/armbian-release
|
File_ArmbianRelease=/etc/armbian-release
|
||||||
File_RaspberryPiRelease=/etc/rpi-issue
|
File_RaspberryPiOSRelease=/etc/rpi-issue
|
||||||
File_openEulerRelease=/etc/openEuler-release
|
File_openEulerRelease=/etc/openEuler-release
|
||||||
File_OpenCloudOSRelease=/etc/opencloudos-release
|
File_OpenCloudOSRelease=/etc/opencloudos-release
|
||||||
File_AnolisOSRelease=/etc/anolis-release
|
File_AnolisOSRelease=/etc/anolis-release
|
||||||
@@ -358,19 +358,19 @@ function collect_system_info() {
|
|||||||
## 定义系统ID
|
## 定义系统ID
|
||||||
SYSTEM_ID="$(cat $File_LinuxRelease | grep -E "^ID=" | awk -F '=' '{print$2}' | sed "s/[\'\"]//g")"
|
SYSTEM_ID="$(cat $File_LinuxRelease | grep -E "^ID=" | awk -F '=' '{print$2}' | sed "s/[\'\"]//g")"
|
||||||
## 判定当前系统派系
|
## 判定当前系统派系
|
||||||
if [ -s $File_DebianVersion ]; then
|
if [ -s "${File_DebianVersion}" ]; then
|
||||||
SYSTEM_FACTIONS="${SYSTEM_DEBIAN}"
|
SYSTEM_FACTIONS="${SYSTEM_DEBIAN}"
|
||||||
elif [ -s $File_RedHatRelease ]; then
|
elif [ -s "${File_RedHatRelease}" ]; then
|
||||||
SYSTEM_FACTIONS="${SYSTEM_REDHAT}"
|
SYSTEM_FACTIONS="${SYSTEM_REDHAT}"
|
||||||
elif [ -s $File_openEulerRelease ]; then
|
elif [ -s "${File_openEulerRelease}" ]; then
|
||||||
SYSTEM_FACTIONS="${SYSTEM_OPENEULER}"
|
SYSTEM_FACTIONS="${SYSTEM_OPENEULER}"
|
||||||
elif [ -s $File_OpenCloudOSRelease ]; then
|
elif [ -s "${File_OpenCloudOSRelease}" ]; then
|
||||||
# 拦截 OpenCloudOS 9 及以上版本,不支持从 Docker 官方仓库安装
|
# 拦截 OpenCloudOS 9 及以上版本,不支持从 Docker 官方仓库安装
|
||||||
if [[ "${SYSTEM_VERSION_NUMBER_MAJOR}" -ge 9 ]]; then
|
if [[ "${SYSTEM_VERSION_NUMBER_MAJOR}" -ge 9 ]]; then
|
||||||
output_error "不支持当前操作系统,请参考如下命令自行安装:\n\ndnf install -y docker\nsystemctl enable --now docker"
|
output_error "不支持当前操作系统,请参考如下命令自行安装:\n\ndnf install -y docker\nsystemctl enable --now docker"
|
||||||
fi
|
fi
|
||||||
SYSTEM_FACTIONS="${SYSTEM_OPENCLOUDOS}" # 自 9.0 版本起不再基于红帽
|
SYSTEM_FACTIONS="${SYSTEM_OPENCLOUDOS}" # 自 9.0 版本起不再基于红帽
|
||||||
elif [ -s $File_AnolisOSRelease ]; then
|
elif [ -s "${File_AnolisOSRelease}" ]; then
|
||||||
# 拦截 Anolis OS 8.8 及以上版本,不支持从 Docker 官方仓库安装,23 版本支持
|
# 拦截 Anolis OS 8.8 及以上版本,不支持从 Docker 官方仓库安装,23 版本支持
|
||||||
if [[ "${SYSTEM_VERSION_NUMBER_MAJOR}" == 8 ]]; then
|
if [[ "${SYSTEM_VERSION_NUMBER_MAJOR}" == 8 ]]; then
|
||||||
output_error "不支持当前操作系统,请参考如下命令自行安装:\n\ndnf install -y docker\nsystemctl enable --now docker"
|
output_error "不支持当前操作系统,请参考如下命令自行安装:\n\ndnf install -y docker\nsystemctl enable --now docker"
|
||||||
@@ -391,7 +391,7 @@ function collect_system_info() {
|
|||||||
SYSTEM_JUDGMENT="$(lsb_release -is)"
|
SYSTEM_JUDGMENT="$(lsb_release -is)"
|
||||||
SYSTEM_VERSION_CODENAME="${DEBIAN_CODENAME:-"$(lsb_release -cs)"}"
|
SYSTEM_VERSION_CODENAME="${DEBIAN_CODENAME:-"$(lsb_release -cs)"}"
|
||||||
# Raspberry Pi OS
|
# Raspberry Pi OS
|
||||||
if [ -s $File_RaspberryPiRelease ]; then
|
if [ -s "${File_RaspberryPiOSRelease}" ]; then
|
||||||
SYSTEM_JUDGMENT="${SYSTEM_RASPBERRY_PI_OS}"
|
SYSTEM_JUDGMENT="${SYSTEM_RASPBERRY_PI_OS}"
|
||||||
SYSTEM_PRETTY_NAME="${SYSTEM_RASPBERRY_PI_OS}"
|
SYSTEM_PRETTY_NAME="${SYSTEM_RASPBERRY_PI_OS}"
|
||||||
fi
|
fi
|
||||||
@@ -700,7 +700,7 @@ function close_firewall_service() {
|
|||||||
if [[ "${CLOSE_FIREWALL}" == "true" ]]; then
|
if [[ "${CLOSE_FIREWALL}" == "true" ]]; then
|
||||||
local SelinuxConfig=/etc/selinux/config
|
local SelinuxConfig=/etc/selinux/config
|
||||||
systemctl disable --now firewalld >/dev/null 2>&1
|
systemctl disable --now firewalld >/dev/null 2>&1
|
||||||
[ -s $SelinuxConfig ] && sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" $SelinuxConfig && setenforce 0 >/dev/null 2>&1
|
[ -s "${SelinuxConfig}" ] && sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" $SelinuxConfig && setenforce 0 >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -809,7 +809,7 @@ function configure_docker_ce_mirror() {
|
|||||||
## 处理 GPG 密钥
|
## 处理 GPG 密钥
|
||||||
local file_keyring="/etc/apt/keyrings/docker.asc"
|
local file_keyring="/etc/apt/keyrings/docker.asc"
|
||||||
apt-key del 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 >/dev/null 2>&1 # 删除旧的密钥
|
apt-key del 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 >/dev/null 2>&1 # 删除旧的密钥
|
||||||
[ -f $file_keyring ] && rm -rf $file_keyring
|
[ -f "${file_keyring}" ] && rm -rf $file_keyring
|
||||||
install -m 0755 -d /etc/apt/keyrings
|
install -m 0755 -d /etc/apt/keyrings
|
||||||
curl -fsSL https://${SOURCE}/linux/${SOURCE_BRANCH}/gpg -o $file_keyring >/dev/null
|
curl -fsSL https://${SOURCE}/linux/${SOURCE_BRANCH}/gpg -o $file_keyring >/dev/null
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
@@ -881,7 +881,7 @@ function install_docker_engine() {
|
|||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
export_version_list
|
export_version_list
|
||||||
if [ ! -s $DockerVersionFile ]; then
|
if [ ! -s "${DockerVersionFile}" ]; then
|
||||||
rm -rf $DockerVersionFile
|
rm -rf $DockerVersionFile
|
||||||
output_error "查询 Docker Engine 版本列表失败!"
|
output_error "查询 Docker Engine 版本列表失败!"
|
||||||
fi
|
fi
|
||||||
@@ -954,8 +954,8 @@ function install_docker_engine() {
|
|||||||
if [[ "${REGISTRY_SOURCEL}" == "registry.hub.docker.com" ]]; then
|
if [[ "${REGISTRY_SOURCEL}" == "registry.hub.docker.com" ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [ -d $DockerDir ] && [ -e $DockerConfig ]; then
|
if [ -d "${DockerDir}" ] && [ -e "${DockerConfig}" ]; then
|
||||||
if [ -e $DockerConfigBackup ]; then
|
if [ -e "${DockerConfigBackup}" ]; then
|
||||||
if [[ "${IGNORE_BACKUP_TIPS}" == "false" ]]; then
|
if [[ "${IGNORE_BACKUP_TIPS}" == "false" ]]; then
|
||||||
if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then
|
if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then
|
||||||
echo ''
|
echo ''
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ hide:
|
|||||||
| [上海交通大学](https://mirror.sjtu.edu.cn "mirror.sjtu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :incompatible: | :incompatible: | :supported: | :incompatible: | :supported: | :unsupport: | :supported: | :incompatible: | :unsupport: | :supported: | :supported: | :supported: |
|
| [上海交通大学](https://mirror.sjtu.edu.cn "mirror.sjtu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :incompatible: | :incompatible: | :supported: | :incompatible: | :supported: | :unsupport: | :supported: | :incompatible: | :unsupport: | :supported: | :supported: | :supported: |
|
||||||
| [重庆邮电大学](https://mirrors.cqupt.edu.cn "mirrors.cqu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :supported: | :supported: |
|
| [重庆邮电大学](https://mirrors.cqupt.edu.cn "mirrors.cqu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :supported: | :supported: |
|
||||||
| [中国科学技术大学](https://mirrors.ustc.edu.cn "mirrors.ustc.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: |
|
| [中国科学技术大学](https://mirrors.ustc.edu.cn "mirrors.ustc.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: |
|
||||||
| [中国科学院软件研究所](https://mirror.iscas.ac.cn "mirror.iscas.ac.cn") | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: |
|
| [中国科学院软件研究所](https://mirror.iscas.ac.cn "mirror.iscas.ac.cn") | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :incompatible: | :supported: | :supported: | :supported: |
|
||||||
|
|
||||||
???+ question "使用帮助"
|
???+ question "使用帮助"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user