Skip to content

Commit

Permalink
适配 Linux Mint 22
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperManito committed Nov 8, 2024
1 parent b5a3432 commit f6b2f6c
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 39 deletions.
50 changes: 38 additions & 12 deletions ChangeMirrors.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
## Author: SuperManito
## Modified: 2024-11-02
## Modified: 2024-11-08
## License: MIT
## GitHub: https://github.com/SuperManito/LinuxMirrors
## Website: https://linuxmirrors.cn
Expand Down Expand Up @@ -254,20 +254,22 @@ function main() {
function handle_command_options() {
## 命令帮助
function output_command_help() {
echo -e "\n命令选项(名称/含义/选项值):
echo -e "\n命令选项(名称/含义/):
--abroad 使用海外软件源
--abroad 使用境外以及海外软件源
--edu 使用中国大陆教育网软件源 无
--source 指定软件源地址(域名或IP) 地址
--source-epel 指定 EPEL 附加软件包仓库的软件源地址(域名或IP) 地址
--source-security 指定 Debian 系统 security 仓库的软件源地址(域名或IP) 地址
--source-vault 指定 CentOS/AlmaLinux 系统 vault 仓库的软件源地址(域名或IP) 地址
--source-portage 指定 Gentoo 系统 portage 仓库的软件源地址(域名或IP) 地址
--source-base-system 指定 Linux Mint 系统底层系统的软件源地址(域名或IP) 地址
--branch 指定软件源分支(路径) 分支名
--branch-epel 指定 EPEL 附加软件包仓库的软件源分支(路径) 分支名
--branch-security 指定 Debian 系统 security 仓库的软件源分支(路径) 分支名
--branch-vault 指定 CentOS/AlmaLinux 系统 vault 仓库的软件源分支(路径) 分支名
--branch-portage 指定 Gentoo 系统 portage 仓库的软件源分支(路径) 分支名
--branch-base-system 指定 Linux Mint 系统底层系统的软件源分支(路径) 分支名
--codename 指定 Debian 系操作系统的版本代号 代号名称
--protocol 指定 WEB 协议 http 或 https
--use-intranet-source 是否优先使用内网软件源地址 true 或 false
Expand Down Expand Up @@ -361,6 +363,19 @@ function handle_command_options() {
output_error "命令选项 ${BLUE}$1${PLAIN} 无效,请在该选项后指定软件源地址!"
fi
;;
--source-base-system)
if [ "$2" ]; then
echo "$2" | grep -Eq "\(|\)|\[|\]|\{|\}"
if [ $? -eq 0 ]; then
output_error "命令选项 ${BLUE}$2${PLAIN} 无效,请在该选项后指定有效的地址!"
else
SOURCE_BASE_SYSTEM="$(echo "$2" | sed -e 's,^http[s]\?://,,g' -e 's,/$,,')"
shift
fi
else
output_error "命令选项 ${BLUE}$1${PLAIN} 无效,请在该选项后指定软件源地址!"
fi
;;
## 指定软件源分支
--branch)
if [ "$2" ]; then
Expand Down Expand Up @@ -402,6 +417,14 @@ function handle_command_options() {
output_error "命令选项 ${BLUE}$1${PLAIN} 无效,请在该选项后指定软件源分支!"
fi
;;
--branch-base-system)
if [ "$2" ]; then
SOURCE_BASE_SYSTEM_BRANCH="$2"
shift
else
output_error "命令选项 ${BLUE}$1${PLAIN} 无效,请在该选项后指定软件源分支!"
fi
;;
## 指定 Debian 系操作系统的版本代号
--codename)
if [ "$2" ]; then
Expand Down Expand Up @@ -622,7 +645,7 @@ function collect_system_info() {
elif [ -s $File_RedHatRelease ]; then
SYSTEM_FACTIONS="${SYSTEM_REDHAT}"
elif [ -s $File_OpenCloudOSRelease ]; then
SYSTEM_FACTIONS="${SYSTEM_OPENCLOUDOS}" # 注:RedHat 判断优先级需要高于 OpenCloudOS,因为官方宣称8版本基于红帽而9版本不是
SYSTEM_FACTIONS="${SYSTEM_OPENCLOUDOS}" # 注:RedHat 判断优先级需要高于 OpenCloudOS,自 9.0 版本起不再基于红帽
elif [[ "${SYSTEM_NAME}" == *"openSUSE"* ]]; then
SYSTEM_FACTIONS="${SYSTEM_OPENSUSE}"
else
Expand Down Expand Up @@ -666,7 +689,7 @@ function collect_system_info() {
fi
;;
"${SYSTEM_LINUX_MINT}")
if [[ "${SYSTEM_VERSION_NUMBER:0:2}" != 19 && "${SYSTEM_VERSION_NUMBER:0:2}" != 2[0-1] && "${SYSTEM_VERSION_NUMBER:0:2}" != 6 ]]; then
if [[ "${SYSTEM_VERSION_NUMBER:0:2}" != 19 && "${SYSTEM_VERSION_NUMBER:0:2}" != 2[0-2] && "${SYSTEM_VERSION_NUMBER:0:2}" != 6 ]]; then
is_supported="false"
fi
;;
Expand Down Expand Up @@ -1698,25 +1721,28 @@ deb ${base_url} ${repository_sections}
deb ${base_url} ${SYSTEM_VERSION_CODENAME} ${repository_sections}
" >>$File_LinuxMintSourceList
## 底层系统软件源
local base_system_source_branch base_system_codename
local base_system_branch base_system_codename
if [[ "${SYSTEM_VERSION_NUMBER}" == 6 ]]; then
# Debian 版(LMDE)
base_system_source_branch="debian"
base_system_branch="debian"
base_system_codename="bookworm"
repository_sections="main contrib non-free non-free-firmware"
base_url="${WEB_PROTOCOL}://${SOURCE}/${base_system_source_branch}"
base_url="${WEB_PROTOCOL}://${SOURCE_BASE_SYSTEM:-"${SOURCE}"}/${SOURCE_BASE_SYSTEM_BRANCH:-"${base_system_branch}"}"
echo "$(gen_debian_source "${base_url}" "${base_system_codename}" "${repository_sections}")" >>$File_LinuxMintSourceList
# 处理 debian-security 仓库源
base_url="${WEB_PROTOCOL}://${SOURCE_SECURITY:-"${SOURCE}"}/${SOURCE_SECURITY_BRANCH:-"${base_system_source_branch}-security"}"
base_url="${WEB_PROTOCOL}://${SOURCE_SECURITY:-${SOURCE_BASE_SYSTEM:-${SOURCE}}}/${SOURCE_SECURITY_BRANCH:-${SOURCE_BASE_SYSTEM_BRANCH:-${base_system_branch}-security}}"
echo "$(gen_debian_security_source "${base_url}" "${base_system_codename}" "${repository_sections}")" >>$File_LinuxMintSourceList
else
# Ubuntu 版
if [[ "${DEVICE_ARCH}" == "x86_64" ]] || [[ "${DEVICE_ARCH}" == *i?86* ]]; then
base_system_source_branch="ubuntu"
base_system_branch="ubuntu"
else
base_system_source_branch="ubuntu-ports"
base_system_branch="ubuntu-ports"
fi
case "${SYSTEM_VERSION_NUMBER:0:2}" in
22)
base_system_codename="noble"
;;
21)
base_system_codename="jammy"
;;
Expand All @@ -1728,7 +1754,7 @@ deb ${base_url} ${SYSTEM_VERSION_CODENAME} ${repository_sections}
;;
esac
repository_sections="main restricted universe multiverse"
base_url="${WEB_PROTOCOL}://${SOURCE}/${base_system_source_branch}"
base_url="${WEB_PROTOCOL}://${SOURCE_BASE_SYSTEM:-"${SOURCE}"}/${SOURCE_BASE_SYSTEM_BRANCH:-"${base_system_branch}"}"
echo "$(gen_ubuntu_source "${base_url}" "${base_system_codename}" "${repository_sections}")" >>$File_LinuxMintSourceList
fi
;;
Expand Down
4 changes: 2 additions & 2 deletions DockerInstallation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function handle_command_options() {
## 命令帮助
function output_command_help() {
echo -e "
命令选项(名称/含义/选项值):
命令选项(名称/含义/):
--source 指定 Docker CE 源地址 地址
--source-registry 指定 Docker Registry 源地址 地址
Expand Down Expand Up @@ -283,7 +283,7 @@ function collect_system_info() {
if [[ "${SYSTEM_VERSION_NUMBER:0:1}" == 9 ]]; then
output_error "不支持当前操作系统,请参考如下命令自行安装:\n\ndnf install -y docker\nsystemctl enable --now docker"
fi
# SYSTEM_FACTIONS="${SYSTEM_OPENCLOUDOS}" # 注:RedHat 判断优先级需要高于 OpenCloudOS,因为官方宣称8版本基于红帽而9版本不是
# SYSTEM_FACTIONS="${SYSTEM_OPENCLOUDOS}" # 注:RedHat 判断优先级需要高于 OpenCloudOS,自 9.0 版本起不再基于红帽
else
output_error "无法判断当前运行环境或不支持当前操作系统!"
fi
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
<table align="center">
<tr>
<td><a href="https://www.debian.org" target="_blank"><img src="./docs/assets/images/icon/debian.svg" width="16" height="16" style="vertical-align: -0.45em"></a>&nbsp;Debian</td>
<td align="center">8.0 ~ 13</td>
<td align="center">8 ~ 13</td>
</tr>
<tr>
<td><a href="https://cn.ubuntu.com" target="_blank"><img src="./docs/assets/images/icon/ubuntu.svg" width="16" height="16" style="vertical-align: -0.15em"></a>&nbsp;Ubuntu</td>
<td align="center">14.04 ~ 24</td>
<td align="center">14 ~ 24</td>
</tr>
<tr>
<td><a href="https://www.kali.org" target="_blank"><img src="./docs/assets/images/icon/kali-linux.svg" width="16" height="16" style="vertical-align: -0.15em"></a>&nbsp;Kali Linux</td>
<td align="center">all</td>
</tr>
<tr>
<td><a href="https://linuxmint.com" target="_blank"><img src="./docs/assets/images/icon/linux-mint.ico" width="16" height="16" style="vertical-align: -0.15em"></a>&nbsp;Linux Mint</td>
<td align="center">19.0 ~ 21 / LMDE 6</td>
<td align="center">19 ~ 22 / LMDE 6</td>
</tr>
<tr>
<td><a href="https://www.deepin.org" target="_blank"><img src="./docs/assets/images/icon/deepin.png" width="16" height="16" style="vertical-align: -0.15em"></a>&nbsp;deepin</td>
Expand All @@ -52,15 +52,15 @@
</tr>
<tr>
<td><a href="https://access.redhat.com/products/red-hat-enterprise-linux" target="_blank"><img src="./docs/assets/images/icon/redhat.svg" width="16" height="16" style="vertical-align: -0.1em"></a>&nbsp;Red Hat Enterprise Linux</td>
<td align="center">7.0 ~ 9</td>
<td align="center">7 ~ 9</td>
</tr>
<tr>
<td><a href="https://fedoraproject.org/zh-Hans" target="_blank"><img src="./docs/assets/images/icon/fedora.ico" width="16" height="16" style="vertical-align: -0.2em"></a>&nbsp;Fedora</td>
<td align="center">30 ~ 41</td>
</tr>
<tr>
<td><a href="https://www.centos.org" target="_blank"><img src="./docs/assets/images/icon/centos.svg" width="16" height="16" style="vertical-align: -0.2em"></a>&nbsp;CentOS</td>
<td align="center">7.0 ~ 8.5 / Stream 8 ~ 9</td>
<td align="center">7 ~ 8 / Stream 8 ~ 9</td>
</tr>
<tr>
<td><a href="https://rockylinux.org" target="_blank"><img src="./docs/assets/images/icon/rocky-linux.svg" width="16" height="16" style="vertical-align: -0.25em"></a>&nbsp;Rocky Linux</td>
Expand All @@ -76,7 +76,7 @@
</tr>
<tr>
<td><a href="https://www.openeuler.org/zh" target="_blank"><img src="./docs/assets/images/icon/openeuler.ico" width="16" height="16" style="vertical-align: -0.2em"></a>&nbsp;openEuler</td>
<td align="center">21.03 ~ 24</td>
<td align="center">21 ~ 24</td>
</tr>
<tr>
<td><a href="https://openanolis.cn" target="_blank"><img src="./docs/assets/images/icon/anolis.png" width="16" height="16" style="vertical-align: -0.1em"></a>&nbsp;Anolis OS</td>
Expand Down
12 changes: 6 additions & 6 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,21 @@ hide:

| 操作系统 | 适配版本 |
| --- | :---: |
| <a href="https://www.debian.org" target="_blank"><img src="/assets/images/icon/debian.svg" width="16" height="16" style="vertical-align: -0.35em"></a> Debian | _8.0 ~ 13_ |
| <a href="https://cn.ubuntu.com" target="_blank"><img src="/assets/images/icon/ubuntu.svg" width="16" height="16" style="vertical-align: -0.1em"></a> Ubuntu :material-information-outline:{ title="支持乌班图家族衍生操作系统,例如 <code>优麒麟</code> <code>Kubuntu</code> 等<br/>由于迭代速度较快并不直接支持所有非 LTS 的版本,具体详见使用文档中的高级用法" } | _14.04 ~ 24_ |
| <a href="https://www.debian.org" target="_blank"><img src="/assets/images/icon/debian.svg" width="16" height="16" style="vertical-align: -0.35em"></a> Debian | _8 ~ 13_ |
| <a href="https://cn.ubuntu.com" target="_blank"><img src="/assets/images/icon/ubuntu.svg" width="16" height="16" style="vertical-align: -0.1em"></a> Ubuntu :material-information-outline:{ title="支持乌班图家族衍生操作系统,例如 <code>优麒麟</code> <code>Kubuntu</code> 等<br/>由于迭代速度较快并不直接支持所有非 LTS 的版本,具体详见使用文档中的高级用法" } | _14 ~ 24_ |
| <a href="https://www.kali.org" target="_blank"><img src="/assets/images/icon/kali-linux.svg" width="16" height="16"></a> Kali Linux | _all_ |
| <a href="https://linuxmint.com" target="_blank"><img src="/assets/images/icon/linux-mint.ico" width="16" height="16" style="vertical-align: -0.2em"></a> Linux Mint | _19.0 ~ 21 / LMDE 6_ |
| <a href="https://linuxmint.com" target="_blank"><img src="/assets/images/icon/linux-mint.ico" width="16" height="16" style="vertical-align: -0.2em"></a> Linux Mint | _19 ~ 22 / LMDE 6_ |
| <a href="https://www.deepin.org" target="_blank"><img src="/assets/images/icon/deepin.png" width="16" height="16" style="vertical-align: -0.25em"></a> Deepin | _all_ |
| <a href="https://zorin.com/os" target="_blank"><img src="/assets/images/icon/zorin-os.png" width="16" height="16" style="vertical-align: -0.15em"></a> Zorin OS | _all_ |
| <a href="https://www.armbian.com" target="_blank"><img src="/assets/images/icon/armbian.png" width="16" height="16" style="vertical-align: -0.2em"></a> Armbian | _all_ |
| <a href="https://www.proxmox.com" target="_blank"><img src="/assets/images/icon/proxmox.svg" width="16" height="16" style="vertical-align: -0.2em"></a> Proxmox | _all_ |
| <a href="https://access.redhat.com/products/red-hat-enterprise-linux" target="_blank"><img src="/assets/images/icon/redhat.svg" width="16" height="16" style="vertical-align: -0.1em"></a> Red Hat Enterprise Linux :material-information-outline:{ title="使用 <code>CentOS Stream</code> 或 <code>CentOS</code> 源" } | _7.0 ~ 9_ |
| <a href="https://access.redhat.com/products/red-hat-enterprise-linux" target="_blank"><img src="/assets/images/icon/redhat.svg" width="16" height="16" style="vertical-align: -0.1em"></a> Red Hat Enterprise Linux :material-information-outline:{ title="使用 <code>CentOS Stream</code> 或 <code>CentOS</code> 源" } | _7 ~ 9_ |
| <a href="https://fedoraproject.org/zh-Hans" target="_blank"><img src="/assets/images/icon/fedora.ico" width="16" height="16" style="vertical-align: -0.2em"></a> Fedora | _30 ~ 41_ |
| <a href="https://www.centos.org" target="_blank"><img src="/assets/images/icon/centos.svg" width="16" height="16" style="vertical-align: -0.2em"></a> CentOS | _7.0 ~ 8.5 / Stream 8 ~ 9_ |
| <a href="https://www.centos.org" target="_blank"><img src="/assets/images/icon/centos.svg" width="16" height="16" style="vertical-align: -0.2em"></a> CentOS | _7 ~ 8 / Stream 8 ~ 9_ |
| <a href="https://rockylinux.org" target="_blank"><img src="/assets/images/icon/rocky-linux.svg" width="16" height="16" style="vertical-align: -0.25em"></a> Rocky Linux | _8 ~ 9_ |
| <a href="https://almalinux.org/zh-hans" target="_blank"><img src="/assets/images/icon/almalinux.svg" width="16" height="16" style="vertical-align: -0.15em"></a> AlmaLinux | _8 ~ 9_ |
| <a href="https://www.opencloudos.org" target="_blank"><img src="/assets/images/icon/opencloudos.png" width="16" height="16" style="vertical-align: -0.25em"></a> OpenCloudOS | _8 ~ 9_ |
| <a href="https://www.openeuler.org/zh" target="_blank"><img src="/assets/images/icon/openeuler.ico" width="16" height="16" style="vertical-align: -0.2em"></a> openEuler | _21.03 ~ 24_ |
| <a href="https://www.openeuler.org/zh" target="_blank"><img src="/assets/images/icon/openeuler.ico" width="16" height="16" style="vertical-align: -0.2em"></a> openEuler | _21 ~ 24_ |
| <a href="https://openanolis.cn" target="_blank"><img src="/assets/images/icon/anolis.png" width="16" height="16" style="vertical-align: -0.1em"></a> Anolis OS | _23_ |
| <a href="https://www.opensuse.org" target="_blank"><img src="/assets/images/icon/opensuse.svg" width="16" height="16"></a> openSUSE | _Leep 15 / Tumbleweed_ |
| <a href="https://archlinux.org" target="_blank"><img src="/assets/images/icon/arch-linux.ico" width="16" height="16" style="vertical-align: -0.15em"></a> Arch Linux | _all_ |
Expand Down
Loading

0 comments on commit f6b2f6c

Please sign in to comment.