diff --git a/ChangeMirrors.sh b/ChangeMirrors.sh index 4982d96..9de0b9a 100755 --- a/ChangeMirrors.sh +++ b/ChangeMirrors.sh @@ -1,6 +1,6 @@ #!/bin/bash ## Author: SuperManito -## Modified: 2024-02-04 +## Modified: 2024-02-27 ## License: MIT ## GitHub: https://github.com/SuperManito/LinuxMirrors ## Website: https://linuxmirrors.cn @@ -26,7 +26,6 @@ mirror_list_default=( ) # 海外格式:"洲 · 软件源名称 · 国家/地区@软件源地址",修改前请先前往官网阅读添加规范 mirror_list_abroad=( - "亚洲 · 科盈电信 · 香港@mirror.hkt.cc" "亚洲 · xTom · 香港@mirrors.xtom.hk" "亚洲 · 01Link · 香港@mirror.01link.hk" "亚洲 · 新加坡国立大学(NUS) · 新加坡@download.nus.edu.sg/mirror" @@ -175,12 +174,15 @@ File_OpenCloudOSRelease=/etc/opencloudos-release File_openEulerRelease=/etc/openEuler-release File_ArchRelease=/etc/arch-release File_AlpineRelease=/etc/alpine-release +File_ProxmoxVersion=/etc/pve/.version ## 定义软件源相关文件或目录 File_DebianSourceList=/etc/apt/sources.list File_DebianSourceListBackup=/etc/apt/sources.list.bak File_ArmbianSourceList=/etc/apt/sources.list.d/armbian.list File_ArmbianSourceListBackup=/etc/apt/sources.list.d/armbian.list.bak +File_ProxmoxSourceList=/etc/apt/sources.list.d/pve-no-subscription.list +File_ProxmoxSourceListBackup=/etc/apt/sources.list.d/pve-no-subscription.list.bak Dir_DebianExtendSource=/etc/apt/sources.list.d Dir_DebianExtendSourceBackup=/etc/apt/sources.list.d.bak File_ArchMirrorList=/etc/pacman.d/mirrorlist @@ -285,12 +287,12 @@ function EnvJudgment() { ## 判断系统和其版本是否受本脚本支持 case "${SYSTEM_JUDGMENT}" in "${SYSTEM_DEBIAN}") - if [[ "${SYSTEM_VERSION_NUMBER:0:1}" != [8-9] && "${SYSTEM_VERSION_NUMBER:0:2}" != 1[0-2] ]]; then + if [[ "${SYSTEM_VERSION_NUMBER:0:1}" != [8-9] && "${SYSTEM_VERSION_NUMBER:0:2}" != 1[0-3] ]]; then Output_Error "当前系统版本不在本脚本的支持范围内" fi ;; "${SYSTEM_UBUNTU}") - if [[ "${SYSTEM_VERSION_NUMBER:0:2}" != 1[4-9] && "${SYSTEM_VERSION_NUMBER:0:2}" != 2[0-3] ]]; then + if [[ "${SYSTEM_VERSION_NUMBER:0:2}" != 1[4-9] && "${SYSTEM_VERSION_NUMBER:0:2}" != 2[0-4] ]]; then Output_Error "当前系统版本不在本脚本的支持范围内" fi ;; @@ -310,7 +312,7 @@ function EnvJudgment() { fi ;; "${SYSTEM_FEDORA}") - if [[ "${SYSTEM_VERSION_NUMBER:0:2}" != 3[0-8] ]]; then + if [[ "${SYSTEM_VERSION_NUMBER:0:2}" != [3-4][0-9] ]]; then Output_Error "当前系统版本不在本脚本的支持范围内" fi ;; @@ -802,6 +804,10 @@ function BackupOriginalMirrors() { if [ -f $File_ArmbianRelease ]; then BackupFile $File_ArmbianSourceList $File_ArmbianSourceListBackup "armbian.list" fi + ## Proxmox + if [ -f $File_ProxmoxVersion ]; then + BackupFile $File_ProxmoxSourceList $File_ProxmoxSourceListBackup "pve-no-subscription.list" + fi ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_OPENEULER}") # /etc/yum.repos.d @@ -833,6 +839,10 @@ function RemoveOriginMirrors() { if [ -f $File_ArmbianRelease ]; then [ -f $File_ArmbianSourceList ] && sed -i '1,$d' $File_ArmbianSourceList fi + ## Proxmox + if [ -f $File_ProxmoxVersion ]; then + [ -f $File_ProxmoxSourceList ] && sed -i '1,$d' $File_ProxmoxSourceList + fi ;; "${SYSTEM_REDHAT}") if [ ! -d $Dir_YumRepos ]; then @@ -945,6 +955,10 @@ function ChangeMirrors() { if [ -f $File_ArmbianRelease ]; then DiffFile $File_ArmbianSourceListBackup $File_ArmbianSourceList fi + ## Proxmox + if [ -f $File_ProxmoxVersion ]; then + DiffFile $File_ProxmoxSourceListBackup $File_ProxmoxSourceList + fi ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_OPENEULER}") DiffDir $Dir_YumReposBackup $Dir_YumRepos @@ -1142,33 +1156,29 @@ function DebianMirrors() { case "${SYSTEM_JUDGMENT}" in "${SYSTEM_DEBIAN}") case "${SYSTEM_VERSION_NUMBER}" in - 12) - source_suffix="main contrib non-free non-free-firmware" - ;; - *) + 8 | 9 | 10 | 11) source_suffix="main contrib non-free" ;; + *) + source_suffix="main contrib non-free non-free-firmware" + ;; esac - echo "${tips} + if [[ "${SYSTEM_VERSION_CODENAME}" != "sid" ]]; then + echo "${tips} deb ${basic_url} ${SYSTEM_VERSION_CODENAME} ${source_suffix} # deb-src ${basic_url} ${SYSTEM_VERSION_CODENAME} ${source_suffix} deb ${basic_url} ${SYSTEM_VERSION_CODENAME}-updates ${source_suffix} # deb-src ${basic_url} ${SYSTEM_VERSION_CODENAME}-updates ${source_suffix} deb ${basic_url} ${SYSTEM_VERSION_CODENAME}-backports ${source_suffix} # deb-src ${basic_url} ${SYSTEM_VERSION_CODENAME}-backports ${source_suffix}" >>$File_DebianSourceList - ## 处理 debian-security 仓库 - local security_url="${SOURCE_SECURITY:-"${SOURCE}"}" - if [[ -z "${SOURCE_SECURITY}" ]]; then - if [[ "${USE_ABROAD_SOURCE}" == "true" ]]; then - local security_url="https://security.debian.org/${SOURCE_BRANCH_SECURITY:-"${SOURCE_BRANCH}-security"}" - else - local security_url="${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH_SECURITY:-"${SOURCE_BRANCH}-security"}" - fi - else - local security_url="${WEB_PROTOCOL}://${SOURCE_SECURITY}/${SOURCE_BRANCH_SECURITY:-"${SOURCE_BRANCH}-security"}" - fi - echo "deb ${security_url} ${SYSTEM_VERSION_CODENAME}-security ${source_suffix} + ## 处理 debian-security 仓库源 + local security_url="${WEB_PROTOCOL}://${SOURCE_SECURITY:-"${SOURCE}"}/${SOURCE_BRANCH_SECURITY:-"${SOURCE_BRANCH}-security"}" + echo "deb ${security_url} ${SYSTEM_VERSION_CODENAME}-security ${source_suffix} # deb-src ${security_url} ${SYSTEM_VERSION_CODENAME}-security ${source_suffix}" >>$File_DebianSourceList + else + echo "deb ${basic_url} ${SYSTEM_VERSION_CODENAME} ${source_suffix} +# deb-src ${basic_url} ${SYSTEM_VERSION_CODENAME} ${source_suffix}" >>$File_DebianSourceList + fi ;; "${SYSTEM_UBUNTU}") source_suffix="main restricted universe multiverse" @@ -1199,10 +1209,18 @@ deb ${basic_url} ${source_suffix} # deb-src ${basic_url} ${source_suffix}" >>$File_DebianSourceList ;; esac - ## Armbian + ## 处理其它衍生系统的专用源 + # Armbian 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 fi + # Proxmox + if [ -f $File_ProxmoxVersion ]; then + 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-client ${SYSTEM_VERSION_CODENAME} pbs-client-no-subscription +# deb ${WEB_PROTOCOL}://${SOURCE}/proxmox/debian/pmg ${SYSTEM_VERSION_CODENAME} pmg-no-subscription" >>$File_ProxmoxSourceList + fi } ## 更换基于 RedHat 系 Linux 发行版软件源 diff --git a/README.md b/README.md index d3093a2..1a9546c 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ - + @@ -38,6 +38,10 @@ + + + + diff --git a/docs/assets/images/icon/proxmox.svg b/docs/assets/images/icon/proxmox.svg new file mode 100644 index 0000000..8341679 --- /dev/null +++ b/docs/assets/images/icon/proxmox.svg @@ -0,0 +1,234 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/docs/index.md b/docs/index.md index a694f1d..13506f1 100644 --- a/docs/index.md +++ b/docs/index.md @@ -58,11 +58,12 @@ hide: | 系统名称 | 适配版本 | | --- | :---: | -| Debian | 8.0 ~ 12 | +| Debian | 8.0 ~ 13 | | Ubuntu :material-information-outline:{ title="支持乌班图家族衍生操作系统,例如 优麒麟Kubuntu 等" } | 14.04 ~ 23 | | Kali Linux | 2.0 ~ 2023 | | Deepin | all | | Armbian | all | +| Proxmox | all | | Red Hat Enterprise Linux :material-information-outline:{ title="使用 Rocky LinuxCentOS 源" } | 7.0 ~ 9 | | Fedora | 30 ~ 39 | | CentOS | 7.0 ~ 8.5 / Stream 8 ~ 9 | diff --git a/docs/mirrors/index.md b/docs/mirrors/index.md index 975d74d..7e6320f 100644 --- a/docs/mirrors/index.md +++ b/docs/mirrors/index.md @@ -10,23 +10,23 @@ hide: > 下方列表中的镜像站均支持 `Debian` `Ubuntu` `CentOS` `openSUSE` 软件源,列表根据单位性质、地理位置、名称长度进行排序,与实际速度无关 -| 镜像站 | IPv6 | Arch | Kali | Deepin | Rocky | AlmaLinux | EPEL | Fedora | openEuler | OpenCloudOS | Alpine | Armbian | -| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | -| [阿里云](https://mirrors.aliyun.com "mirrors.aliyun.com") | :supported: | :supported: | :supported: | :supported: | :incompatible: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | -| [腾讯云](https://mirrors.tencent.com "mirrors.tencent.com") | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | -| [华为云](https://mirrors.huaweicloud.com "mirrors.huaweicloud.com") | :unsupport: | :supported: | :supported: | :supported: | :incompatible: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | -| [网易](https://mirrors.163.com "mirrors.163.com") | :unsupport: | :supported: | :unsupport: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :unsupport: | :unsupport: | -| [搜狐](https://mirrors.sohu.com "mirrors.sohu.com") | :unsupport: | :supported: | :unsupport: | :supported: | :incompatible: | :unsupport: | :unsupport: | :supported: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | -| [火山引擎](https://mirrors.volces.com "mirrors.volces.com") | :unsupport: | :unsupport: | :supported: | :supported: | :incompatible: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | -| [清华大学](https://mirrors.tuna.tsinghua.edu.cn "mirrors.tuna.tsinghua.edu.cn") | :supported: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | -| [北京大学](https://mirrors.pku.edu.cn/Mirrors "mirrors.pku.edu.cn/Mirrors") | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :unsupport: | :supported: | :unsupport: | :supported: | :supported: | :unsupport: | :unsupport: | -| [浙江大学](https://mirrors.zju.edu.cn "mirrors.zju.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | -| [南京大学](https://mirrors.nju.edu.cn "mirrors.nju.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | -| [兰州大学](https://mirror.lzu.edu.cn "mirror.lzu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | -| [上海交通大学](https://mirror.sjtu.edu.cn "mirror.sjtu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :incompatible: | :supported: | :supported: | :supported: | :unsupport: | :supported: | -| [重庆邮电大学](https://mirrors.cqupt.edu.cn "mirrors.cqu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | -| [中国科学技术大学](https://mirrors.ustc.edu.cn "mirrors.ustc.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | -| [中国科学院软件研究所](https://mirror.iscas.ac.cn "mirror.iscas.ac.cn") | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | +| 镜像站 | IPv6 | Arch | Kali | Deepin | Rocky | AlmaLinux | EPEL | Fedora | openEuler | OpenCloudOS | Alpine | Armbian | Proxmox | +| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | +| [阿里云](https://mirrors.aliyun.com "mirrors.aliyun.com") | :supported: | :supported: | :supported: | :supported: | :incompatible: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :unsupport: | +| [腾讯云](https://mirrors.tencent.com "mirrors.tencent.com") | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | +| [华为云](https://mirrors.huaweicloud.com "mirrors.huaweicloud.com") | :unsupport: | :supported: | :supported: | :supported: | :incompatible: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | :unsupport: | +| [网易](https://mirrors.163.com "mirrors.163.com") | :unsupport: | :supported: | :unsupport: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | +| [搜狐](https://mirrors.sohu.com "mirrors.sohu.com") | :unsupport: | :supported: | :unsupport: | :supported: | :incompatible: | :unsupport: | :unsupport: | :supported: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | +| [火山引擎](https://mirrors.volces.com "mirrors.volces.com") | :unsupport: | :unsupport: | :supported: | :supported: | :incompatible: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | :unsupport: | +| [清华大学](https://mirrors.tuna.tsinghua.edu.cn "mirrors.tuna.tsinghua.edu.cn") | :supported: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | +| [北京大学](https://mirrors.pku.edu.cn/Mirrors "mirrors.pku.edu.cn/Mirrors") | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :unsupport: | :supported: | :unsupport: | :supported: | :supported: | :unsupport: | :unsupport: | :unsupport: | +| [浙江大学](https://mirrors.zju.edu.cn "mirrors.zju.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | :unsupport: | +| [南京大学](https://mirrors.nju.edu.cn "mirrors.nju.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | +| [兰州大学](https://mirror.lzu.edu.cn "mirror.lzu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | :unsupport: | +| [上海交通大学](https://mirror.sjtu.edu.cn "mirror.sjtu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :incompatible: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | +| [重庆邮电大学](https://mirrors.cqupt.edu.cn "mirrors.cqu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | +| [中国科学技术大学](https://mirrors.ustc.edu.cn "mirrors.ustc.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :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: | ???+ question "使用帮助" @@ -74,7 +74,6 @@ hide: | 镜像站名称 | 镜像站地址 | | :- | :-: | - | 亚洲 · 科盈电信 · 香港 :flag-HK: | [mirror.hkt.cc](https://mirror.hkt.cc "https://mirror.hkt.cc") | | 亚洲 · xTom · 香港 :flag-HK: | [mirrors.xtom.hk](https://mirrors.xtom.hk "https://mirrors.xtom.hk") | | 亚洲 · 01Link · 香港 :flag-HK: | [mirror.01link.hk](https://mirror.01link.hk "https://mirror.01link.hk") | | 亚洲 · 新加坡国立大学(NUS) · 新加坡 :flag-SG: | [download.nus.edu.sg/mirror](https://download.nus.edu.sg "https://download.nus.edu.sg") | @@ -174,7 +173,6 @@ hide: | 镜像站名称 | 镜像站地址 | | :- | :-: | - | 亚洲 · 科盈电信 · 香港 :flag-HK: | [mirror.hkt.cc](https://mirror.hkt.cc "https://mirror.hkt.cc") | | 亚洲 · xTom · 香港 :flag-HK: | [mirrors.xtom.hk](https://mirrors.xtom.hk "https://mirrors.xtom.hk") | | 亚洲 · 01Link · 香港 :flag-HK: | [mirror.01link.hk](https://mirror.01link.hk "https://mirror.01link.hk") | | 亚洲 · 新加坡国立大学(NUS) · 新加坡 :flag-SG: | [download.nus.edu.sg/mirror](https://download.nus.edu.sg "https://download.nus.edu.sg") | diff --git a/docs/use/command-options.md b/docs/use/command-options.md index 7202d2b..b5ac89f 100644 --- a/docs/use/command-options.md +++ b/docs/use/command-options.md @@ -49,6 +49,7 @@ bash <(curl -sSL https://linuxmirrors.cn/main.sh) \ | Kali Linux | kali | | Deepin | deepin | | Armbian | armbian | +| Proxmox | proxmox | | Red Hat Enterprise Linux :material-information-outline:{ title="9版本使用 Rocky Linux, 7、8版本使用CentOS" } | centos / centos-altarch / rocky | | Fedora | fedora | | CentOS | centos / centos-stream / centos-altarch / centos-vault | @@ -101,13 +102,22 @@ bash <(curl -sSL https://linuxmirrors.cn/main.sh) \ ### 指定 Debian 系 Linux 版本代号 -大多数情况下自定义版本代号用于升级系统版本,请看下面的例子 +大多数情况下自定义版本代号用于更换系统版本,请看下面的例子 -``` { .bash .no-copy title="升级 Debian 至最新 12 版本 Bookworm" } +``` { .bash title="升级 Debian 至最新 12 版本 Bookworm" } bash <(curl -sSL https://linuxmirrors.cn/main.sh) \ --codename bookworm ``` -更换软件源后还需要执行系统更新命令才能实现更新操作,并且建议在更新完成并重启系统后重新执行本换源脚本,因为仅更换软件源配置中的系统版本代号可能会在后期使用时产生一些兼容性问题 +``` { .bash title="将 Debian 版本切换到测试分支" } +bash <(curl -sSL https://linuxmirrors.cn/main.sh) \ + --codename testing +``` + +更换软件源后还需要执行系统更新命令 `apt-get dist-upgrade`,并且建议在更新完成并重启系统后重新执行本换源脚本,因为仅更换软件源配置中的系统版本代号可能会在后期使用时产生一些兼容性问题 + +``` { .bash title="若脚本无法实现指定版本代号,你也可以在执行脚本后手动替换" } +sed -i "s/$(lsb_release -cs)/指定版本代号/g" /etc/apt/sources.list +``` ## 无人值守 diff --git a/requirements.txt b/requirements.txt index 9a99f59..02c02e1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -mkdocs-material==9.5.9 +mkdocs-material==9.5.11 mkdocs-glightbox==0.3.5 mkdocs-exclude-search==0.6.6 \ No newline at end of file
 Debian8.0 ~ 128.0 ~ 13
 Ubuntu Armbian all
 Proxmoxall
 Red Hat Enterprise Linux 7.0 ~ 9