mirror of
https://gitee.com/SuperManito/LinuxMirrors
synced 2025-11-04 00:10:27 +08:00
优化部分命令选项
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
## Author: SuperManito
|
||||
## Modified: 2025-05-11
|
||||
## Modified: 2025-05-13
|
||||
## License: MIT
|
||||
## GitHub: https://github.com/SuperManito/LinuxMirrors
|
||||
## Website: https://linuxmirrors.cn
|
||||
@@ -271,7 +271,7 @@ function handle_command_options() {
|
||||
--edu 使用中国大陆教育网软件源 无
|
||||
--source 指定软件源地址(域名或IP) 地址
|
||||
--source-epel 指定 EPEL 附加软件包仓库的软件源地址(域名或IP) 地址
|
||||
--source-security 指定 Debian 系统 security 仓库的软件源地址(域名或IP) 地址
|
||||
--source-security 指定 Debian / Ubuntu 系统 security 仓库的软件源地址(域名或IP) 地址
|
||||
--source-vault 指定 CentOS / AlmaLinux 系统 vault 仓库的软件源地址(域名或IP) 地址
|
||||
--source-portage 指定 Gentoo 系统 portage 仓库的软件源地址(域名或IP) 地址
|
||||
--source-base-system 指定 Linux Mint / Raspberry Pi OS 底层系统的软件源地址(域名或IP) 地址
|
||||
@@ -977,7 +977,7 @@ function collect_system_info() {
|
||||
## 命令选项兼容性判断
|
||||
function check_command_options() {
|
||||
if [[ "${USE_ABROAD_SOURCE}" == "true" && "${USE_EDU_SOURCE}" == "true" ]]; then
|
||||
output_error "两种模式不可同时使用!"
|
||||
output_error "不可同时使用两种软件源模式,请确认后重试!"
|
||||
fi
|
||||
if [[ "${DEBIAN_CODENAME}" ]]; then
|
||||
if [[ "${SYSTEM_FACTIONS}" != "${SYSTEM_DEBIAN}" && "${SYSTEM_FACTIONS}" != "${SYSTEM_OPENKYLIN}" ]]; then
|
||||
@@ -988,29 +988,14 @@ function check_command_options() {
|
||||
case "${SYSTEM_FACTIONS}" in
|
||||
"${SYSTEM_REDHAT}")
|
||||
if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_FEDORA}" ]]; then
|
||||
output_error "当前系统不支持安装 EPEL 附件软件包故无法使用相关命令选项,请确认后重试!"
|
||||
output_error "当前系统不支持安装 EPEL 附件软件包,请确认后重试!"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
output_error "当前系统不支持安装 EPEL 附件软件包故无法使用相关命令选项,请确认后重试!"
|
||||
output_error "当前系统不支持安装 EPEL 附件软件包,请确认后重试!"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [[ "${SOURCE_SECURITY}" == "true" || "${SOURCE_SECURITY_BRANCH}" == "true" ]]; then
|
||||
if [[ "${SYSTEM_JUDGMENT}" != "${SYSTEM_DEBIAN}" ]] || [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_RASPBERRY_PI_OS}" && "${DEVICE_ARCH_RAW}" != "x86_64" && "${DEVICE_ARCH_RAW}" != "aarch64" ]]; then
|
||||
output_error "当前系统不支持使用 security 仓库相关命令选项,请确认后重试!"
|
||||
fi
|
||||
fi
|
||||
if [[ "${SOURCE_VAULT}" == "true" || "${SOURCE_VAULT_BRANCH}" == "true" ]]; then
|
||||
if [[ "${SYSTEM_JUDGMENT}" != "${SYSTEM_CENTOS}" && "${SYSTEM_JUDGMENT}" != "${SYSTEM_RHEL}" && "${SYSTEM_JUDGMENT}" != "${SYSTEM_ALMALINUX}" ]]; then
|
||||
output_error "当前系统不支持使用 vault 仓库相关命令选项,请确认后重试!"
|
||||
fi
|
||||
fi
|
||||
if [[ "${SOURCE_PORTAGE}" == "true" || "${SOURCE_PORTAGE_BRANCH}" == "true" ]]; then
|
||||
if [[ "${SYSTEM_JUDGMENT}" != "${SYSTEM_GENTOO}" ]]; then
|
||||
output_error "当前系统不支持使用 portage 仓库相关命令选项,请确认后重试!"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
## 选择软件源
|
||||
@@ -1883,10 +1868,6 @@ deb ${1} ${2}-backports ${3}
|
||||
# deb-src ${1} ${2} ${3}
|
||||
deb ${1} ${2}-updates ${3}
|
||||
# deb-src ${1} ${2}-updates ${3}"
|
||||
}
|
||||
function gen_debian_security_source() {
|
||||
echo "deb ${1} ${2}-security ${3}
|
||||
# deb-src ${1} ${2}-security ${3}"
|
||||
}
|
||||
function gen_ubuntu_source() {
|
||||
echo "deb ${1} ${2} ${3}
|
||||
@@ -1895,13 +1876,16 @@ deb ${1} ${2}-updates ${3}
|
||||
# deb-src ${1} ${2}-updates ${3}
|
||||
deb ${1} ${2}-backports ${3}
|
||||
# deb-src ${1} ${2}-backports ${3}
|
||||
deb ${1} ${2}-security ${3}
|
||||
# deb-src ${1} ${2}-security ${3}
|
||||
|
||||
## 预发布软件源(不建议启用)
|
||||
# deb ${1} ${2}-proposed ${3}
|
||||
# deb-src ${1} ${2}-proposed ${3}"
|
||||
}
|
||||
function gen_security_source() {
|
||||
echo "## 安全更新软件源
|
||||
deb ${1} ${2}-security ${3}
|
||||
# deb-src ${1} ${2}-security ${3}"
|
||||
}
|
||||
|
||||
## 使用官方源
|
||||
if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then
|
||||
@@ -1939,9 +1923,9 @@ deb ${1} ${2}-security ${3}
|
||||
if [[ "${SYSTEM_VERSION_CODENAME}" != "sid" ]]; then
|
||||
echo "${tips}
|
||||
$(gen_debian_source "${base_url}" "${SYSTEM_VERSION_CODENAME}" "${repository_sections}")" >>$File_DebianSourceList
|
||||
# 处理 debian-security 仓库源
|
||||
# 处理 security 仓库源
|
||||
base_url="${WEB_PROTOCOL}://${SOURCE_SECURITY:-"${SOURCE}"}/${SOURCE_SECURITY_BRANCH:-"${SOURCE_BRANCH}-security"}/"
|
||||
echo "$(gen_debian_security_source "${base_url}" "${SYSTEM_VERSION_CODENAME}" "${repository_sections}")" >>$File_DebianSourceList
|
||||
echo "$(gen_security_source "${base_url}" "${SYSTEM_VERSION_CODENAME}" "${repository_sections}")" >>$File_DebianSourceList
|
||||
else
|
||||
echo "${tips}
|
||||
deb ${base_url} ${SYSTEM_VERSION_CODENAME} ${repository_sections}
|
||||
@@ -1952,6 +1936,10 @@ deb ${base_url} ${SYSTEM_VERSION_CODENAME} ${repository_sections}
|
||||
repository_sections="main restricted universe multiverse"
|
||||
echo "${tips}
|
||||
$(gen_ubuntu_source "${base_url}" "${SYSTEM_VERSION_CODENAME}" "${repository_sections}")" >>$File_DebianSourceList
|
||||
# 处理 security 仓库源
|
||||
base_url="${WEB_PROTOCOL}://${SOURCE_SECURITY:-${SOURCE}}/${SOURCE_BRANCH}/"
|
||||
echo "
|
||||
$(gen_security_source "${base_url}" "${SYSTEM_VERSION_CODENAME}" "${repository_sections}")" >>$File_DebianSourceList
|
||||
;;
|
||||
"${SYSTEM_KALI}")
|
||||
repository_sections="main contrib non-free non-free-firmware"
|
||||
@@ -1983,9 +1971,9 @@ deb ${base_url} ${SYSTEM_VERSION_CODENAME} ${repository_sections}" >>$File_Linux
|
||||
repository_sections="main contrib non-free non-free-firmware"
|
||||
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 仓库源
|
||||
# 处理 security 仓库源
|
||||
base_url="${WEB_PROTOCOL}://${SOURCE_SECURITY:-${SOURCE_BASE_SYSTEM:-${SOURCE}}}/${SOURCE_SECURITY_BRANCH:-${SOURCE_BASE_SYSTEM_BRANCH:-debian-security}}/"
|
||||
echo "$(gen_debian_security_source "${base_url}" "${base_system_codename}" "${repository_sections}")" >>$File_LinuxMintSourceList
|
||||
echo "$(gen_security_source "${base_url}" "${base_system_codename}" "${repository_sections}")" >>$File_LinuxMintSourceList
|
||||
else
|
||||
# Ubuntu 版
|
||||
if [[ "${DEVICE_ARCH_RAW}" == "x86_64" || "${DEVICE_ARCH_RAW}" == *i?86* ]]; then
|
||||
@@ -2010,6 +1998,10 @@ deb ${base_url} ${SYSTEM_VERSION_CODENAME} ${repository_sections}" >>$File_Linux
|
||||
repository_sections="main restricted universe multiverse"
|
||||
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
|
||||
# 处理 security 仓库源
|
||||
base_url="${WEB_PROTOCOL}://${SOURCE_SECURITY:-${SOURCE_BASE_SYSTEM:-${SOURCE}}}/${SOURCE_BASE_SYSTEM_BRANCH:-"${base_system_branch}"}/"
|
||||
echo "
|
||||
$(gen_security_source "${base_url}" "${base_system_codename}" "${repository_sections}")" >>$File_LinuxMintSourceList
|
||||
fi
|
||||
;;
|
||||
"${SYSTEM_RASPBERRY_PI_OS}")
|
||||
@@ -2050,9 +2042,9 @@ deb ${base_url} ${SYSTEM_VERSION_CODENAME} ${repository_sections}
|
||||
base_url="${WEB_PROTOCOL}://${SOURCE_BASE_SYSTEM:-"${SOURCE}"}/${SOURCE_BASE_SYSTEM_BRANCH:-"${base_system_branch}"}/"
|
||||
echo "${tips}
|
||||
$(gen_debian_source_no_backports "${base_url}" "${base_system_codename}" "${repository_sections}")" >>$File_DebianSourceList
|
||||
# 处理 debian-security 仓库源
|
||||
# 处理 security 仓库源
|
||||
base_url="${WEB_PROTOCOL}://${SOURCE_SECURITY:-${SOURCE_BASE_SYSTEM:-${SOURCE}}}/${SOURCE_SECURITY_BRANCH:-${SOURCE_BASE_SYSTEM_BRANCH:-debian-security}}/"
|
||||
echo "$(gen_debian_security_source "${base_url}" "${base_system_codename}" "${repository_sections}")" >>$File_DebianSourceList
|
||||
echo "$(gen_security_source "${base_url}" "${base_system_codename}" "${repository_sections}")" >>$File_DebianSourceList
|
||||
;;
|
||||
*)
|
||||
base_system_branch="raspbian"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
:root {
|
||||
--md-text-font: system-ui, -apple-system, 'Roboto', 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', 'Segoe UI', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
||||
--md-text-font: 'Maple Mono NF CN', system-ui, -apple-system, 'Roboto', 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', 'Segoe UI', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
||||
--md-code-font: 'SF Mono';
|
||||
--md-primary-fg-color--light: hsl(0, 0%, 100%, 0.33);
|
||||
--md-default-bg-color--light: #ffffff;
|
||||
|
||||
@@ -437,7 +437,7 @@ $ bash <(curl -sSL https://linuxmirrors.cn/main.sh) --help
|
||||
--edu 使用中国大陆教育网软件源 无
|
||||
--source 指定软件源地址(域名或IP) 地址
|
||||
--source-epel 指定 EPEL 附加软件包仓库的软件源地址(域名或IP) 地址
|
||||
--source-security 指定 Debian 系统 security 仓库的软件源地址(域名或IP) 地址
|
||||
--source-security 指定 Debian / Ubuntu 系统 security 仓库的软件源地址(域名或IP) 地址
|
||||
--source-vault 指定 CentOS / AlmaLinux 系统 vault 仓库的软件源地址(域名或IP) 地址
|
||||
--source-portage 指定 Gentoo 系统 portage 仓库的软件源地址(域名或IP) 地址
|
||||
--source-base-system 指定 Linux Mint / Raspberry Pi OS 底层系统的软件源地址(域名或IP) 地址
|
||||
@@ -469,7 +469,7 @@ $ bash <(curl -sSL https://linuxmirrors.cn/main.sh) --help
|
||||
| `--edu` | 使用中国大陆教育网软件源 | 无 |
|
||||
| `--source` | 指定软件源地址(域名或IP) | `地址` |
|
||||
| `--source-epel` | 指定 EPEL 附加软件包仓库的软件源地址(域名或IP) | `地址` |
|
||||
| `--source-security` | 指定 Debian 系统 security 仓库的软件源地址(域名或IP) | `地址` |
|
||||
| `--source-security` | 指定 Debian / Ubuntu 系统 security 仓库的软件源地址(域名或IP) | `地址` |
|
||||
| `--source-vault` | 指定 CentOS / AlmaLinux 系统 vault 仓库的软件源地址(域名或IP) | `地址` |
|
||||
| `--source-portage` | 指定 Gentoo 系统 portage 仓库的软件源地址(域名或IP) | `地址` |
|
||||
| `--source-base-system` | 指定 Linux Mint / Raspberry Pi OS 底层系统的软件源地址(域名或IP) | `地址` |
|
||||
@@ -691,7 +691,7 @@ $ bash <(curl -sSL https://linuxmirrors.cn/main.sh) --help
|
||||
| :-: | :-: | :-: |
|
||||
| `SOURCE` | 指定软件源地址(域名或IP) | `地址` |
|
||||
| `SOURCE_EPEL` | 指定 EPEL 附加软件包仓库的软件源地址(域名或IP) | `地址` |
|
||||
| `SOURCE_SECURITY` | 指定 Debian 系统 security 仓库的软件源地址(域名或IP) | `地址` |
|
||||
| `SOURCE_SECURITY` | 指定 Debian / Ubuntu 系统 security 仓库的软件源地址(域名或IP) | `地址` |
|
||||
| `SOURCE_VAULT` | 指定 CentOS / AlmaLinux 系统 vault 仓库的软件源地址(域名或IP) | `地址` |
|
||||
| `SOURCE_PORTAGE` | 指定 Gentoo 系统 portage 仓库的软件源地址(域名或IP) | `地址` |
|
||||
| `SOURCE_BASE_SYSTEM` | 指定 Linux Mint / Raspberry Pi OS 底层系统的软件源地址(域名或IP) | `地址` |
|
||||
|
||||
Reference in New Issue
Block a user