mirror of
https://gitee.com/SuperManito/LinuxMirrors
synced 2026-02-01 19:35:49 +08:00
优化
This commit is contained in:
1
.github/workflows/build-docs.yml
vendored
1
.github/workflows/build-docs.yml
vendored
@@ -27,6 +27,7 @@ jobs:
|
||||
mkdocs-material-
|
||||
- run: pip install -r ./requirements.txt
|
||||
- run: cp -rvf ./ChangeMirrors.sh ./docs/main.sh
|
||||
- run: cp -rvf ./ChangeMirrorsLite.sh ./docs/main-lite.sh
|
||||
- run: cp -rvf ./DockerInstallation.sh ./docs/docker.sh
|
||||
- run: cp -rvf ./DockerInstallationLite.sh ./docs/docker-lite.sh
|
||||
- run: mkdocs gh-deploy --force --quiet
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
## Author: SuperManito
|
||||
## Modified: 2026-01-16
|
||||
## Modified: 2026-01-19
|
||||
## License: MIT
|
||||
## GitHub: https://github.com/SuperManito/LinuxMirrors
|
||||
## Website: https://linuxmirrors.cn
|
||||
@@ -1525,10 +1525,6 @@ function backup_original_mirrors() {
|
||||
if [[ "${BACKUP}" == "true" ]]; then
|
||||
case "${SYSTEM_FACTIONS}" in
|
||||
"${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}")
|
||||
# /etc/apt/sources.list
|
||||
if [[ "${SYSTEM_JUDGMENT}" != "${SYSTEM_LINUX_MINT}" && -s "${File_AptSourceList}" ]]; then
|
||||
backup_file $File_AptSourceList $File_AptSourceListBackup "sources.list"
|
||||
fi
|
||||
# Debian DEB822 格式源文件
|
||||
if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_DEBIAN}" ]] && [ -f "${File_DebianSources}" ]; then
|
||||
backup_file $File_DebianSources $File_DebianSourcesBackup "debian.sources"
|
||||
@@ -1539,6 +1535,17 @@ function backup_original_mirrors() {
|
||||
backup_file $File_UbuntuSources $File_UbuntuSourcesBackup "ubuntu.sources"
|
||||
USE_DEB822_FORMAT="true"
|
||||
fi
|
||||
# /etc/apt/sources.list
|
||||
if [[ "${SYSTEM_JUDGMENT}" != "${SYSTEM_LINUX_MINT}" && -s "${File_AptSourceList}" ]]; then
|
||||
if [[ "${USE_DEB822_FORMAT}" == "true" ]]; then
|
||||
grep -Eqv '^#|^$' $File_AptSourceList
|
||||
if [ $? -eq 0 ]; then
|
||||
backup_file $File_AptSourceList $File_AptSourceListBackup "sources.list"
|
||||
fi
|
||||
else
|
||||
backup_file $File_AptSourceList $File_AptSourceListBackup "sources.list"
|
||||
fi
|
||||
fi
|
||||
# Armbian
|
||||
if [ -f "${File_ArmbianRelease}" ]; then
|
||||
backup_file $File_ArmbianSourceList $File_ArmbianSourceListBackup "armbian.list"
|
||||
@@ -1865,7 +1872,9 @@ function change_mirrors_main() {
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ -z "${SOURCE}" ]]; then
|
||||
USE_OFFICIAL_SOURCE="true"
|
||||
fi
|
||||
## 调用换源函数
|
||||
case "${SYSTEM_FACTIONS}" in
|
||||
"${SYSTEM_DEBIAN}")
|
||||
@@ -3210,6 +3219,9 @@ function change_mirrors_or_install_EPEL() {
|
||||
if [[ "${INSTALL_EPEL}" != "true" ]]; then
|
||||
return
|
||||
fi
|
||||
if [[ -z "${SOURCE}" && -z "${SOURCE_EPEL}" ]]; then
|
||||
USE_OFFICIAL_SOURCE_EPEL="true"
|
||||
fi
|
||||
## 确定安装版本(不支持安装的系统直接跳出此方法)
|
||||
local epel_version
|
||||
case "${SYSTEM_FACTIONS}" in
|
||||
|
||||
7535
ChangeMirrorsLite.sh
Executable file
7535
ChangeMirrorsLite.sh
Executable file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
## Author: SuperManito
|
||||
## Modified: 2026-01-06
|
||||
## Modified: 2026-01-19
|
||||
## License: MIT
|
||||
## GitHub: https://github.com/SuperManito/LinuxMirrors
|
||||
## Website: https://linuxmirrors.cn
|
||||
@@ -1124,6 +1124,9 @@ function install_dependency_packages() {
|
||||
|
||||
## 配置 Docker CE 源
|
||||
function configure_docker_ce_mirror() {
|
||||
if [[ -z "${SOURCE}" ]]; then
|
||||
SOURCE="download.docker.com"
|
||||
fi
|
||||
local -a commands=()
|
||||
case "${SYSTEM_FACTIONS}" in
|
||||
"${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}")
|
||||
@@ -1488,14 +1491,29 @@ function install_docker_engine() {
|
||||
|
||||
## 修改 Docker Registry 镜像仓库源
|
||||
function change_docker_registry_mirror() {
|
||||
if [[ -z "${SOURCE_REGISTRY}" ]]; then
|
||||
SOURCE_REGISTRY="registry.hub.docker.com"
|
||||
fi
|
||||
## 使用官方 Docker Hub
|
||||
if [[ "${REGISTRY_SOURCEL}" == "registry.hub.docker.com" ]]; then
|
||||
if [[ "${SOURCE_REGISTRY}" == "registry.hub.docker.com" ]]; then
|
||||
if [ -s "${File_DockerConfig}" ]; then
|
||||
## 安装 jq
|
||||
local package_manager="$(get_package_manager)"
|
||||
$package_manager install -y jq
|
||||
case "${SYSTEM_FACTIONS}" in
|
||||
"${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}")
|
||||
apt-get install -y jq
|
||||
;;
|
||||
"${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}")
|
||||
local package_manager="$(get_package_manager)"
|
||||
$package_manager install -y jq
|
||||
;;
|
||||
esac
|
||||
if command_exists jq; then
|
||||
jq 'del(.["registry-mirrors"])' $File_DockerConfig >$File_DockerConfig.tmp && mv $File_DockerConfig.tmp $File_DockerConfig
|
||||
# 删除空的配置文件
|
||||
jq -rcM . $File_DockerConfig 2>&1 | grep -Eq '^{}$'
|
||||
if [ $? -eq 0 ]; then
|
||||
rm -rf $File_DockerConfig
|
||||
fi
|
||||
# 重启服务
|
||||
systemctl daemon-reload
|
||||
if [[ "$(systemctl is-active docker 2>/dev/null)" == "active" ]]; then
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#!/bin/bash
|
||||
## Author: SuperManito
|
||||
## Modified: 2026-01-06
|
||||
## Modified: 2026-01-19
|
||||
## License: MIT
|
||||
## GitHub: https://github.com/SuperManito/LinuxMirrors
|
||||
## Website: https://linuxmirrors.cn
|
||||
|
||||
SOURCE="download.docker.com"
|
||||
SOURCE_REGISTRY="registry.hub.docker.com"
|
||||
WEB_PROTOCOL="https"
|
||||
INSTALL_LATESTED_DOCKER="true"
|
||||
IGNORE_BACKUP_TIPS="true"
|
||||
@@ -683,6 +681,9 @@ function install_dependency_packages() {
|
||||
|
||||
## 配置 Docker CE 源
|
||||
function configure_docker_ce_mirror() {
|
||||
if [[ -z "${SOURCE}" ]]; then
|
||||
SOURCE="download.docker.com"
|
||||
fi
|
||||
local -a commands=()
|
||||
case "${SYSTEM_FACTIONS}" in
|
||||
"${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}")
|
||||
@@ -1047,14 +1048,29 @@ function install_docker_engine() {
|
||||
|
||||
## 修改 Docker Registry 镜像仓库源
|
||||
function change_docker_registry_mirror() {
|
||||
if [[ -z "${SOURCE_REGISTRY}" ]]; then
|
||||
SOURCE_REGISTRY="registry.hub.docker.com"
|
||||
fi
|
||||
## 使用官方 Docker Hub
|
||||
if [[ "${REGISTRY_SOURCEL}" == "registry.hub.docker.com" ]]; then
|
||||
if [[ "${SOURCE_REGISTRY}" == "registry.hub.docker.com" ]]; then
|
||||
if [ -s "${File_DockerConfig}" ]; then
|
||||
## 安装 jq
|
||||
local package_manager="$(get_package_manager)"
|
||||
$package_manager install -y jq
|
||||
case "${SYSTEM_FACTIONS}" in
|
||||
"${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}")
|
||||
apt-get install -y jq
|
||||
;;
|
||||
"${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}")
|
||||
local package_manager="$(get_package_manager)"
|
||||
$package_manager install -y jq
|
||||
;;
|
||||
esac
|
||||
if command_exists jq; then
|
||||
jq 'del(.["registry-mirrors"])' $File_DockerConfig >$File_DockerConfig.tmp && mv $File_DockerConfig.tmp $File_DockerConfig
|
||||
# 删除空的配置文件
|
||||
jq -rcM . $File_DockerConfig 2>&1 | grep -Eq '^{}$'
|
||||
if [ $? -eq 0 ]; then
|
||||
rm -rf $File_DockerConfig
|
||||
fi
|
||||
# 重启服务
|
||||
systemctl daemon-reload
|
||||
if [[ "$(systemctl is-active docker 2>/dev/null)" == "active" ]]; then
|
||||
|
||||
@@ -473,7 +473,7 @@ Command options(name/meaning/value):
|
||||
|
||||
## Lite Version
|
||||
|
||||
The project also provides a simplified version, which is a copy of the main script, designed for enterprise products and large open-source community projects. It has the following features:
|
||||
The project also provides a simplified version, which is a copy of the main script, designed for enterprise products and open-source projects. It has the following features:
|
||||
|
||||
- Single display language `English`, no I18n internationalization
|
||||
- Uses the official source by default, removing the interactive selection of built-in software sources
|
||||
|
||||
@@ -473,7 +473,7 @@ $ bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --help
|
||||
|
||||
## 精简版(Lite)
|
||||
|
||||
项目额外提供一个精简版本,是主脚本的复制,面向企业产品、大型开源社区项目使用,具有以下特性:
|
||||
额外提供一个精简版本,是主脚本的复制,面向企业产品、开源项目使用,具有以下特性:
|
||||
|
||||
- 单一显示语言 `English`,无 I18n 国际化功能
|
||||
- 默认使用官方源,去除了交互选择内置软件源功能
|
||||
|
||||
@@ -473,7 +473,7 @@ $ bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --zh-hant --help
|
||||
|
||||
## 精簡版(Lite)
|
||||
|
||||
專案額外提供一個精簡版本,是主腳本的複製,面向企業產品、大型開源社群專案使用,具有以下特性:
|
||||
額外提供一個精簡版本,是主腳本的複製,面向企業產品、開源專案使用,具有以下特性:
|
||||
|
||||
- 單一顯示語言 `English`,無 I18n 國際化功能
|
||||
- 預設使用官方來源,去除了互動選擇內建軟體源功能
|
||||
|
||||
@@ -782,7 +782,23 @@ Below are some advanced usage examples
|
||||
|
||||
---
|
||||
|
||||
## Customizing the Script
|
||||
## Lite Version
|
||||
|
||||
The project also provides a simplified version, which is a copy of the main script, designed for enterprise products and open-source projects. It has the following features:
|
||||
|
||||
- Single display language `English`, no I18n internationalization
|
||||
- Uses the official source by default, removing the interactive selection of built-in software sources
|
||||
- Removes irrelevant printouts
|
||||
- Retains core logic and command option design
|
||||
|
||||
``` bash
|
||||
bash <(curl -sSL https://linuxmirrors.cn/main-lite.sh)
|
||||
```
|
||||
> Please familiarize yourself with this project before using it. It is not recommended for novice users.
|
||||
|
||||
---
|
||||
|
||||
## Customizing
|
||||
|
||||
If you are a developer of another project and want to create a custom script based on this project, refer to the following. Some maintainers of China education network mirrors have already done so.
|
||||
|
||||
|
||||
@@ -784,6 +784,22 @@ $ bash <(curl -sSL https://linuxmirrors.cn/main.sh) --help
|
||||
|
||||
---
|
||||
|
||||
## 精简版(Lite)
|
||||
|
||||
额外提供一个精简版本,是主脚本的复制,面向企业产品、开源项目使用,具有以下特性:
|
||||
|
||||
- 单一显示语言 `English`,无 I18n 国际化功能
|
||||
- 默认使用官方源,去除了交互选择内置软件源功能
|
||||
- 去除了无关的打印内容
|
||||
- 保留核心逻辑与命令选项设计
|
||||
|
||||
``` bash
|
||||
bash <(curl -sSL https://linuxmirrors.cn/main-lite.sh)
|
||||
```
|
||||
> 请熟悉本项目后再使用,不建议新手用户使用
|
||||
|
||||
---
|
||||
|
||||
## 定制脚本
|
||||
|
||||
如果你是其它项目的开发者希望通过本项目来制作专属脚本那么请参考下面提到的内容,目前已经有国内教育单位镜像站的维护者这样做了。
|
||||
|
||||
@@ -784,6 +784,22 @@ $ bash <(curl -sSL https://linuxmirrors.cn/main.sh) --zh-hant --help
|
||||
|
||||
---
|
||||
|
||||
## 精簡版(Lite)
|
||||
|
||||
額外提供一個精簡版本,是主腳本的複製,面向企業產品、開源專案使用,具有以下特性:
|
||||
|
||||
- 單一顯示語言 `English`,無 I18n 國際化功能
|
||||
- 預設使用官方來源,去除了互動選擇內建軟體源功能
|
||||
- 去除了無關的列印內容
|
||||
- 保留核心邏輯與指令選項設計
|
||||
|
||||
``` bash
|
||||
bash <(curl -sSL https://linuxmirrors.cn/main-lite.sh)
|
||||
```
|
||||
> 請熟悉本項目後再使用,不建議新手使用者使用
|
||||
|
||||
---
|
||||
|
||||
## 客製化腳本
|
||||
|
||||
如果你是其它專案的開發者希望透過本專案來製作專屬腳本,那麼請參考下面提到的內容,目前已經有中國大陸教育單位鏡像站的維護者這樣做了。
|
||||
|
||||
Reference in New Issue
Block a user