Repository: SuperManito/LinuxMirrors Branch: main Commit: 9d4be510b336 Files: 97 Total size: 1.3 MB Directory structure: gitextract_40_yqrag/ ├── .gitee/ │ └── issue_template.md ├── .github/ │ ├── CONTRIBUTING.md │ ├── ISSUE_TEMPLATE/ │ │ ├── bug.yml │ │ ├── config.yml │ │ └── feature.yml │ └── workflows/ │ ├── auto-sync.yml │ └── build-docs.yml ├── .gitignore ├── CHANGELOG.en-US.md ├── CHANGELOG.md ├── CHANGELOG.zh-Hant.md ├── CODE_OF_CONDUCT.md ├── ChangeMirrors.sh ├── ChangeMirrorsLite.sh ├── DockerInstallation.sh ├── DockerInstallationLite.sh ├── LICENSE ├── README.en-US.md ├── README.md ├── README.zh-Hant.md ├── SECURITY.md ├── docs/ │ ├── assets/ │ │ ├── css/ │ │ │ └── orama-ui.css │ │ └── js/ │ │ ├── common.js │ │ ├── component.js │ │ ├── components/ │ │ │ ├── mirrors-table/ │ │ │ │ ├── data.js │ │ │ │ └── index.js │ │ │ └── orama-ui/ │ │ │ ├── config.js │ │ │ ├── index-native.js │ │ │ └── index.js │ │ ├── modules/ │ │ │ └── tdesign-theme.js │ │ └── useThemeTransition.js │ ├── changelog/ │ │ ├── index.en.md │ │ ├── index.md │ │ ├── index.zh-Hant.md │ │ ├── sitemap.en.xml │ │ ├── sitemap.xml │ │ └── sitemap.zh-Hant.xml │ ├── community/ │ │ ├── index.en.md │ │ ├── index.md │ │ ├── index.zh-Hant.md │ │ ├── sitemap.en.xml │ │ ├── sitemap.xml │ │ └── sitemap.zh-Hant.xml │ ├── index.en.md │ ├── index.md │ ├── index.zh-Hant.md │ ├── mirrors/ │ │ ├── index.en.md │ │ ├── index.md │ │ ├── index.zh-Hant.md │ │ ├── sitemap.en.xml │ │ ├── sitemap.xml │ │ └── sitemap.zh-Hant.xml │ ├── other/ │ │ ├── example1.md │ │ ├── example2.md │ │ ├── index.en.md │ │ ├── index.md │ │ ├── index.zh-Hant.md │ │ ├── sitemap.en.xml │ │ ├── sitemap.xml │ │ └── sitemap.zh-Hant.xml │ ├── sitemap.en.xml │ ├── sitemap.xml │ ├── sitemap.zh-Hant.xml │ ├── sponsor/ │ │ ├── index.en.md │ │ ├── index.md │ │ ├── index.zh-Hant.md │ │ ├── main.html │ │ ├── sitemap.en.xml │ │ ├── sitemap.xml │ │ └── sitemap.zh-Hant.xml │ ├── stylesheets/ │ │ ├── extra.css │ │ └── fonts/ │ │ └── SF-Mono-Regular.otf │ ├── theme/ │ │ ├── main.html │ │ └── partials/ │ │ ├── comments.html │ │ ├── content.html │ │ ├── copyright.html │ │ ├── header.html │ │ ├── palette.html │ │ ├── search.html │ │ └── toc.html │ └── use/ │ ├── index.en.md │ ├── index.md │ ├── index.zh-Hant.md │ ├── repo-branchs.md │ ├── sitemap.en.xml │ ├── sitemap.xml │ └── sitemap.zh-Hant.xml ├── giscus.json ├── locales/ │ ├── docker/ │ │ ├── en.sh │ │ ├── zh-hans.sh │ │ └── zh-hant.sh │ └── linux/ │ ├── en.sh │ ├── zh-hans.sh │ └── zh-hant.sh ├── mkdocs.yml ├── netlify.toml └── requirements.txt ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitee/issue_template.md ================================================ ## 1. 操作系统 - [ ] `Debian` - [ ] `Ubuntu` - [ ] `Kali Linux` - [ ] `Linux Mint` - [ ] `Deepin` - [ ] `Zorin OS` - [ ] `Armbian` - [ ] `Proxmox VE` - [ ] `Raspberry Pi OS` - [ ] `Red Hat Enterprise Linux` - [ ] `Fedora` - [ ] `CentOS` - [ ] `Rocky Linux` - [ ] `AlmaLinux` - [ ] `Oracle Linux` - [ ] `openEuler` - [ ] `OpenCloudOS` - [ ] `openKylin` - [ ] `Anolis OS` - [ ] `openSUSE` - [ ] `Arch Linux` - [ ] `Manjaro` - [ ] `EndeavourOS` - [ ] `Alpine Linux` - [ ] `Gentoo` - [ ] `NixOS` ## 2. 处理器架构 - [ ] `x86_64` `x86_32` - [ ] `arm64` `arm/v8` `arm/v7` `arm/v6` - [ ] `ppc64le` `s390x` - [ ] `其它` ## 3. 系统详细信息 ``` ``` ## 4. 环境信息 ``` ``` ## 5. 描述遇到的问题 ### (1) 具体问题 A: ### (2) 详细的执行日志 ``` ``` ================================================ FILE: .github/CONTRIBUTING.md ================================================ # 参与共建 这篇指南会指导你如何为 LinuxMirrors 贡献自己的一份力量,请你在提 issue 或者 pull request 之前花几分钟来阅读一遍这篇指南。 ## 行为准则 我们有一份 [行为准则](https://github.com/SuperManito/LinuxMirrors/blob/main/CODE_OF_CONDUCT.md),希望所有的贡献者都能遵守,请花时间阅读一遍全文以确保你能明白哪些是可以做的,哪些是不可以做的。 ## 透明的开发 我们所有的工作都会放在 [GitHub](https://github.com/SuperManito/LinuxMirrors) 上。不管是核心团队的成员还是外部贡献者的 pull request 都需要经过同样流程的 review。 ## Pull Request 请确保你的代码符合我们的编码规范,并且通过了所有的测试。提交前请务必在本地客户端进行测试,确保脚本的功能和性能符合预期,不会出现任何致命性的错误。 --- # Contributing to LinuxMirrors The following is a set of guidelines for contributing to LinuxMirrors. Please spend several minutes reading these guidelines before you create an issue or pull request. ## Code of Conduct We have adopted a [Code of Conduct](https://github.com/SuperManito/LinuxMirrors/blob/main/CODE_OF_CONDUCT.md) that we expect project participants to adhere to. Please read the full text so that you can understand what actions will and will not be tolerated. ## Open Development All work on LinuxMirrors happens directly on [GitHub](https://github.com/SuperManito/LinuxMirrors). Both core team members and external contributors send pull requests which go through the same review process. ## Pull Request Please ensure that your code complies with our coding standards and passes all tests. Before submitting, be sure to test it on your local client to ensure that the script's functionality and performance meet expectations and that there are no fatal errors. ================================================ FILE: .github/ISSUE_TEMPLATE/bug.yml ================================================ name: 🐞 上报错误 description: Report bug labels: ["bug"] body: - type: dropdown id: script_type attributes: label: 脚本类型 options: - Linux - Docker description: "请在创建此 Issue 前排除软件源(镜像站)故障等非本项目脚本自身问题,建议先尝试重新运行脚本并检查网络连接。" validations: required: true - type: dropdown id: os attributes: label: 操作系统 options: - Debian - Ubuntu - Kali Linux - Linux Mint - Deepin - Zorin OS - Armbian - Proxmox VE - Raspberry Pi OS - Red Hat Enterprise Linux - Fedora - CentOS - Rocky Linux - AlmaLinux - Oracle Linux - openEuler - OpenCloudOS - openKylin - Anolis OS - openSUSE - Arch Linux - Manjaro - EndeavourOS - Alpine Linux - Gentoo - NixOS validations: required: true - type: dropdown id: architecture attributes: label: 处理器架构 options: - x86_64 / x86_32 - arm64 / arm/v8 / arm/v7 / arm/v6 - ppc64le / s390x - 其它 validations: required: true - type: textarea id: os_release attributes: label: 系统详细信息 description: "请执行命令 `cat /etc/os-release`,并将输出结果粘贴在下方" render: "shell" validations: required: true - type: input id: os_uname attributes: label: 环境信息 description: "请执行命令 `uname -a`,并将输出结果粘贴在下方" validations: required: true - type: textarea id: logs attributes: label: 详细的执行日志 placeholder: 日志内容 description: "请务必粘贴完整的日志内容,不要掺杂其它无用信息,如果是日志图片请在下方描述问题表单项添加文件" render: "shell" validations: required: true - type: textarea id: what-happened attributes: label: 描述遇到的问题 validations: required: true ================================================ FILE: .github/ISSUE_TEMPLATE/config.yml ================================================ blank_issues_enabled: false ================================================ FILE: .github/ISSUE_TEMPLATE/feature.yml ================================================ name: 💡 功能请求与建议 description: Feature request labels: ["enhancement"] body: - type: textarea id: content attributes: label: '描述您的功能请求或建议' validations: required: false ================================================ FILE: .github/workflows/auto-sync.yml ================================================ name: Sync to mirror repo on: push: branches: - main jobs: repo-sync: env: dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} dst_token: ${{ secrets.GITEE_TOKEN }} gitee_user: ${{ secrets.GITEE_USER }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: persist-credentials: false - name: sync to gitee uses: Yikun/hub-mirror-action@master if: env.dst_key && env.dst_token && env.gitee_user with: src: github/SuperManito dst: gitee/SuperManito dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} dst_token: ${{ secrets.GITEE_TOKEN }} static_list: "LinuxMirrors" force_update: true ================================================ FILE: .github/workflows/build-docs.yml ================================================ name: Build docs website on: push: branches: - master - main permissions: contents: write jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Configure Git Credentials run: | git config user.name github-actions[bot] git config user.email 41898282+github-actions[bot]@users.noreply.github.com - uses: actions/setup-python@v5 with: python-version: 3.x - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV - uses: actions/cache@v4 with: key: mkdocs-material-${{ env.cache_id }} path: .cache restore-keys: | 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 ================================================ FILE: .gitignore ================================================ .DS_Store site/ dist/ node_modules # local env files .env.local .env.*.local # Log files npm-debug.log* yarn-debug.log* yarn-error.log* pnpm-debug.log* # Editor directories and files .idea *.suo *.ntvs* *.njsproj *.sln *.sw? ================================================ FILE: CHANGELOG.en-US.md ================================================ 2026-01-04 * Added support for EndeavourOS [#30310f5](https://github.com/SuperManito/LinuxMirrors/commit/30310f5508b1943b647b54834dd60c206d9fb366) 2025-11-02 * Adapted for Kylin Server to docker script [#1ddf1fb](https://github.com/SuperManito/LinuxMirrors/commit/1ddf1fb708987cf59c4ef56b0a0410caf1b8e726) 2025-10-12 * Added support for I18n [#bf2adc1](https://github.com/SuperManito/LinuxMirrors/commit/bf2adc1adf4f2de4820f617a23aabf247a47281c) 2025-09-28 * Adapted for openSUSE 16 [#a934676](https://github.com/SuperManito/LinuxMirrors/commit/a934676aeb4dfc1d008b2b46ecea5811d7382317) 2025-09-26 * Added `Specify Docker CE source repository version` command option to docker script [#4c7860d](https://github.com/SuperManito/LinuxMirrors/commit/4c7860d48cfefded15c32f1baa0f544fde18e8ce) 2025-08-07 * Adapted for TencentOS Server & Alibaba Cloud Linux to docker script [#00f3b19](https://github.com/SuperManito/LinuxMirrors/commit/00f3b19edfcb152f22337306e7fc25e135e75c14) 2025-08-03 * Adapted for Huawei Cloud EulerOS to docker script [#b19f748](https://github.com/SuperManito/LinuxMirrors/commit/b19f748154d66fa6a385726ae899db5740499a7e) 2025-07-18 * Added support for Oracle Linux OS [#76b8b08](https://github.com/SuperManito/LinuxMirrors/commit/76b8b0834ae493ed8731c83440c4a8f4dcad17dc) 2025-06-15 * Adapted for Rocky Linux 10 [#dafaa13](https://github.com/SuperManito/LinuxMirrors/commit/dafaa13e44209d719b5b6f06f4cc3c4f2ef24d3b) 2025-06-03 * Added support for Manjaro OS [#a93f23e](https://github.com/SuperManito/LinuxMirrors/commit/a93f23e48d4ffbffb0e04efcf33138fc7218b560) 2025-05-29 * Adapted for Red Hat Enterprise Linux 10 & AlmaLinux 10 [#26f493a](https://github.com/SuperManito/LinuxMirrors/commit/26f493a762221569404d45a6556afd7945ac75f8) 2025-05-13 * Enabled DEB822 format for new versions of Debian and Ubuntu repositories [#c3d0d5f](https://github.com/SuperManito/LinuxMirrors/commit/c3d0d5fa2c0993e104711f55e37fa8ada1031b5e) 2025-05-12 * Added `Only Replace Mirror Accelerator` command option to docker script [#3f13f40](https://github.com/SuperManito/LinuxMirrors/commit/3f13f40111fa3631555ca7104cea21b4bb5adefa) 2025-05-11 * Adapted for Anolis OS 8.10 [#582b1d1](https://github.com/SuperManito/LinuxMirrors/commit/582b1d1fbcc3cab4899d4d400cf9a51023773aad) 2025-04-05 * Added `Clean Mode` command option [#e63dea7](https://github.com/SuperManito/LinuxMirrors/commit/e63dea7e64fa6c31ecee3c02b143924ab12917b4) 2025-03-16 * Adapted for EPEL 10 [#b71c0b9](https://github.com/SuperManito/LinuxMirrors/commit/b71c0b9790cc1dfb431729b817e726d6dd19a555) 2025-03-15 * Added support for Raspberry Pi OS [#c08000c](https://github.com/SuperManito/LinuxMirrors/commit/c08000cb645994d669e5ca2678d429a9d9eb3c90) 2025-03-14 * Adapted for CentOS Stream 10 [#12eb98c](https://github.com/SuperManito/LinuxMirrors/commit/12eb98ce2945294873bfaa7b422fda175d9f8c10) 2025-02-20 * Added support for NixOS [#4d91f7d](https://github.com/SuperManito/LinuxMirrors/commit/4d91f7d1b2ddd58f7794cc7620d0ea7e4f9af02b) ...... ================================================ FILE: CHANGELOG.md ================================================ 2026-01-04 * 新增适配 EndeavourOS 操作系统 [#30310f5](https://github.com/SuperManito/LinuxMirrors/commit/30310f5508b1943b647b54834dd60c206d9fb366) 2025-11-02 * Docker 脚本新增适配 Kylin Server 操作系统 [#1ddf1fb](https://github.com/SuperManito/LinuxMirrors/commit/1ddf1fb708987cf59c4ef56b0a0410caf1b8e726) 2025-10-12 * 新增适配 I18n [#bf2adc1](https://github.com/SuperManito/LinuxMirrors/commit/bf2adc1adf4f2de4820f617a23aabf247a47281c) 2025-09-28 * 适配 openSUSE 16 [#a934676](https://github.com/SuperManito/LinuxMirrors/commit/a934676aeb4dfc1d008b2b46ecea5811d7382317) 2025-09-26 * Docker 脚本新增 `指定 Docker CE 软件源仓库版本` 命令选项 [#4c7860d](https://github.com/SuperManito/LinuxMirrors/commit/4c7860d48cfefded15c32f1baa0f544fde18e8ce) 2025-08-07 * Docker 脚本新增适配 TencentOS Server & Alibaba Cloud Linux 操作系统 [#00f3b19](https://github.com/SuperManito/LinuxMirrors/commit/00f3b19edfcb152f22337306e7fc25e135e75c14) 2025-08-03 * Docker 脚本新增适配 Huawei Cloud EulerOS 操作系统 [#b19f748](https://github.com/SuperManito/LinuxMirrors/commit/b19f748154d66fa6a385726ae899db5740499a7e) 2025-07-18 * 新增适配 Oracle Linux 操作系统 [#76b8b08](https://github.com/SuperManito/LinuxMirrors/commit/76b8b0834ae493ed8731c83440c4a8f4dcad17dc) 2025-06-15 * 适配 Rocky Linux 10 [#dafaa13](https://github.com/SuperManito/LinuxMirrors/commit/dafaa13e44209d719b5b6f06f4cc3c4f2ef24d3b) 2025-06-03 * 新增适配 Manjaro 操作系统 [#a93f23e](https://github.com/SuperManito/LinuxMirrors/commit/a93f23e48d4ffbffb0e04efcf33138fc7218b560) 2025-05-29 * 适配 Red Hat Enterprise Linux 10 & AlmaLinux 10 [#26f493a](https://github.com/SuperManito/LinuxMirrors/commit/26f493a762221569404d45a6556afd7945ac75f8) 2025-05-13 * 为 Debian 和 Ubuntu 的新版本软件源启用 DEB822 格式 [#c3d0d5f](https://github.com/SuperManito/LinuxMirrors/commit/c3d0d5fa2c0993e104711f55e37fa8ada1031b5e) 2025-05-12 * Docker 脚本新增 `仅更换镜像加速器` 命令选项 [#3f13f40](https://github.com/SuperManito/LinuxMirrors/commit/3f13f40111fa3631555ca7104cea21b4bb5adefa) 2025-05-11 * 适配 Anolis OS 8.10 [#582b1d1](https://github.com/SuperManito/LinuxMirrors/commit/582b1d1fbcc3cab4899d4d400cf9a51023773aad) 2025-04-05 * 命令选项新增 `纯净模式` [#e63dea7](https://github.com/SuperManito/LinuxMirrors/commit/e63dea7e64fa6c31ecee3c02b143924ab12917b4) 2025-03-16 * 适配 EPEL 10 [#b71c0b9](https://github.com/SuperManito/LinuxMirrors/commit/b71c0b9790cc1dfb431729b817e726d6dd19a555) 2025-03-15 * 新增适配 Raspberry Pi OS 操作系统 [#c08000c](https://github.com/SuperManito/LinuxMirrors/commit/c08000cb645994d669e5ca2678d429a9d9eb3c90) 2025-03-14 * 适配 CentOS Stream 10 [#12eb98c](https://github.com/SuperManito/LinuxMirrors/commit/12eb98ce2945294873bfaa7b422fda175d9f8c10) 2025-02-20 * 新增适配 NixOS 操作系统 [#4d91f7d](https://github.com/SuperManito/LinuxMirrors/commit/4d91f7d1b2ddd58f7794cc7620d0ea7e4f9af02b) ...... ================================================ FILE: CHANGELOG.zh-Hant.md ================================================ 2026-01-04 * 新增適配 EndeavourOS 作業系統 [#30310f5](https://github.com/SuperManito/LinuxMirrors/commit/30310f5508b1943b647b54834dd60c206d9fb366) 2025-11-02 * Docker 腳本新增適配 Kylin Server 作業系統 [#1ddf1fb](https://github.com/SuperManito/LinuxMirrors/commit/1ddf1fb708987cf59c4ef56b0a0410caf1b8e726) 2025-10-12 * 新增適配 I18n [#bf2adc1](https://github.com/SuperManito/LinuxMirrors/commit/bf2adc1adf4f2de4820f617a23aabf247a47281c) 2025-09-28 * 適配 openSUSE 16 [#a934676](https://github.com/SuperManito/LinuxMirrors/commit/a934676aeb4dfc1d008b2b46ecea5811d7382317) 2025-09-26 * Docker 腳本新增 `指定 Docker CE 軟體源倉庫版本` 命令選項 [#4c7860d](https://github.com/SuperManito/LinuxMirrors/commit/4c7860d48cfefded15c32f1baa0f544fde18e8ce) 2025-08-07 * Docker 腳本新增適配 TencentOS Server & Alibaba Cloud Linux 作業系統 [#00f3b19](https://github.com/SuperManito/LinuxMirrors/commit/00f3b19edfcb152f22337306e7fc25e135e75c14) 2025-08-03 * Docker 腳本新增適配 Huawei Cloud EulerOS 作業系統 [#b19f748](https://github.com/SuperManito/LinuxMirrors/commit/b19f748154d66fa6a385726ae899db5740499a7e) 2025-07-18 * 新增適配 Oracle Linux 作業系統 [#76b8b08](https://github.com/SuperManito/LinuxMirrors/commit/76b8b0834ae493ed8731c83440c4a8f4dcad17dc) 2025-06-15 * 適配 Rocky Linux 10 [#dafaa13](https://github.com/SuperManito/LinuxMirrors/commit/dafaa13e44209d719b5b6f06f4cc3c4f2ef24d3b) 2025-06-03 * 新增適配 Manjaro 作業系統 [#a93f23e](https://github.com/SuperManito/LinuxMirrors/commit/a93f23e48d4ffbffb0e04efcf33138fc7218b560) 2025-05-29 * 適配 Red Hat Enterprise Linux 10 & AlmaLinux 10 [#26f493a](https://github.com/SuperManito/LinuxMirrors/commit/26f493a762221569404d45a6556afd7945ac75f8) 2025-05-13 * 為 Debian 和 Ubuntu 的新版本軟體源啟用 DEB822 格式 [#c3d0d5f](https://github.com/SuperManito/LinuxMirrors/commit/c3d0d5fa2c0993e104711f55e37fa8ada1031b5e) 2025-05-12 * Docker 腳本新增 `僅更換鏡像加速器` 命令選項 [#3f13f40](https://github.com/SuperManito/LinuxMirrors/commit/3f13f40111fa3631555ca7104cea21b4bb5adefa) 2025-05-11 * 適配 Anolis OS 8.10 [#582b1d1](https://github.com/SuperManito/LinuxMirrors/commit/582b1d1fbcc3cab4899d4d400cf9a51023773aad) 2025-04-05 * 命令選項新增 `純淨模式` [#e63dea7](https://github.com/SuperManito/LinuxMirrors/commit/e63dea7e64fa6c31ecee3c02b143924ab12917b4) 2025-03-16 * 適配 EPEL 10 [#b71c0b9](https://github.com/SuperManito/LinuxMirrors/commit/b71c0b9790cc1dfb431729b817e726d6dd19a555) 2025-03-15 * 新增適配 Raspberry Pi OS 作業系統 [#c08000c](https://github.com/SuperManito/LinuxMirrors/commit/c08000cb645994d669e5ca2678d429a9d9eb3c90) 2025-03-14 * 適配 CentOS Stream 10 [#12eb98c](https://github.com/SuperManito/LinuxMirrors/commit/12eb98ce2945294873bfaa7b422fda175d9f8c10) 2025-02-20 * 新增適配 NixOS 作業系統 [#4d91f7d](https://github.com/SuperManito/LinuxMirrors/commit/4d91f7d1b2ddd58f7794cc7620d0ea7e4f9af02b) ...... ================================================ FILE: CODE_OF_CONDUCT.md ================================================ # Contributor Covenant Code of Conduct ## Our Pledge We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. ## Our Standards Examples of behavior that contributes to a positive environment for our community include: - Demonstrating empathy and kindness toward other people - Being respectful of differing opinions, viewpoints, and experiences - Giving and gracefully accepting constructive feedback - Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience - Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: - The use of sexualized language or imagery, and sexual attention or advances of any kind - Trolling, insulting or derogatory comments, and personal or political attacks - Public or private harassment - Publishing others' private information, such as a physical or email address, without their explicit permission - Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. ## Scope This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official email address, posting via an official social media account, or acting as an appointed representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [@SuperManito](https://github.com/SuperManito). All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident. ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: ### 1. Correction **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. ### 2. Warning **Community Impact**: A violation through a single incident or series of actions. **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. ### 3. Temporary Ban **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within the community. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 2.1, available at . Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/inclusion). For answers to common questions about this code of conduct, see the FAQ at . Translations are available at . ================================================ FILE: ChangeMirrors.sh ================================================ #!/bin/bash ## Author: SuperManito ## Modified: 2026-03-04 ## License: MIT ## GitHub: https://github.com/SuperManito/LinuxMirrors ## Website: https://linuxmirrors.cn ## 定制方法 # 只需要在头部(此处)定义全局变量即可,具体详见官网文档,简单写几个例子 # SOURCE="www.example.com" # 指定软件源地址 # BRANCH="branch" # 指定软件源仓库 # WEB_PROTOCOL="https" # 指定 Web 协议 ## 软件源列表 # 中国大陆默认 mirror_list_default=( "mirrors.aliyun.com" "mirrors.tencent.com" "mirrors.huaweicloud.com" "mirrors.cmecloud.cn" "mirrors.ctyun.cn" "mirrors.163.com" "mirrors.volces.com" "mirrors.tuna.tsinghua.edu.cn" "mirrors.pku.edu.cn" "mirrors.zju.edu.cn" "mirrors.nju.edu.cn" "mirror.lzu.edu.cn" "mirror.sjtu.edu.cn" "mirrors.cqupt.edu.cn" "mirrors.ustc.edu.cn" "mirror.iscas.ac.cn" "__OFFICIAL_SOURCE_TAG__" ) # 中国大陆教育网 mirror_list_edu=( "mirrors.pku.edu.cn" "mirror.bjtu.edu.cn" "mirrors.bfsu.edu.cn" "mirrors.bupt.edu.cn" "mirrors.cqu.edu.cn" "mirrors.cqupt.edu.cn" "mirrors.neusoft.edu.cn" "mirrors.uestc.cn" "mirrors.scau.edu.cn" "mirrors.hust.edu.cn" "mirrors.jlu.edu.cn" "mirrors.jcut.edu.cn" "mirrors.jxust.edu.cn" "mirror.lzu.edu.cn" "mirrors.nju.edu.cn" "mirrors.njtech.edu.cn" "mirrors.njupt.edu.cn" "mirrors.sustech.edu.cn" "mirror.nyist.edu.cn" "mirrors.qlu.edu.cn" "mirrors.tuna.tsinghua.edu.cn" "mirrors.sdu.edu.cn" "mirrors.shanghaitech.edu.cn" "mirror.sjtu.edu.cn" "mirrors.sjtug.sjtu.edu.cn" "mirrors.wsyu.edu.cn" "mirrors.xjtu.edu.cn" "mirrors.nwafu.edu.cn" "mirrors.zju.edu.cn" "mirrors.ustc.edu.cn" "__OFFICIAL_SOURCE_TAG__" ) # 境外以及海外地区 mirror_list_abroad=( "mirrors.xtom.hk" "mirror.01link.hk" "download.nus.edu.sg/mirror" "mirror.sg.gs" "mirrors.xtom.sg" "free.nchc.org.tw" "mirror.ossplanet.net" "linux.cs.nctu.edu.tw" "ftp.tku.edu.tw" "mirror.twds.com.tw" "mirror.anigil.com" "ftp.udx.icscoe.jp/Linux" "ftp.jaist.ac.jp/pub/Linux" "linux2.yz.yamagata-u.ac.jp/pub/Linux" "mirrors.xtom.jp" "mirrors.gbnetwork.com" "mirror.kku.ac.th" "mirror.vorboss.net" "mirror.quickhost.uk" "mirror.dogado.de" "mirrors.xtom.de" "ftp.halifax.rwth-aachen.de" "ftp.agdsn.de" "mirror.in2p3.fr/pub/linux" "mirrors.ircam.fr/pub" "eclats.crans.org" "ftp.crihan.fr" "mirrors.xtom.nl" "mirror.datapacket.com" "eu.edge.kernel.org" "mirrors.xtom.ee" "mirror.netsite.dk" "mirrors.dotsrc.org" "mirror.accum.se" "ftp.lysator.liu.se" "mirror.yandex.ru" "mirror.linux-ia64.org" "mirror.truenetwork.ru" "ftp.belnet.be/mirror" "ftp.cc.uoc.gr/mirrors/linux" "ftp.fi.muni.cz/pub/linux" "ftp.sh.cvut.cz" "mirror.karneval.cz/pub/linux" "mirrors.nic.cz" "mirror.ethz.ch" "mirrors.kernel.org" "mirrors.mit.edu" "mirror.math.princeton.edu/pub" "ftp-chi.osuosl.org/pub" "mirror.fcix.net" "mirrors.xtom.com" "mirror.steadfast.net" "mirror.it.ubc.ca" "mirror.xenyth.net" "mirrors.switch.ca" "mirror.pop-sc.rnp.br/mirror" "mirror.uepg.br" "mirror.ufscar.br" "mirrors.eze.sysarmy.com" "gsl-syd.mm.fcix.net" "mirror.aarnet.edu.au/pub" "mirror.datamossa.io" "mirror.amaze.com.au" "mirrors.xtom.au" "mirror.overthewire.com.au" "mirror.fsmg.org.nz" "mirror.liquidtelecom.com" "mirror.dimensiondata.com" "__OFFICIAL_SOURCE_TAG__" ) ## 配置需要区分公网地址和内网地址的软件源(不分地域) # 需要同时在两个数组变量中分别定义软件源地址,并且保证排列顺序一致 # 软件源公网地址列表 mirror_list_extranet=( "mirrors.aliyun.com" "mirrors.tencent.com" "mirrors.huaweicloud.com" "mirrors.ctyun.cn" "mirrors.volces.com" ) # 软件源内网地址列表 mirror_list_intranet=( "mirrors.cloud.aliyuncs.com" "mirrors.tencentyun.com" "mirrors.myhuaweicloud.com" "internal.mirrors.ctyun.cn" "mirrors.ivolces.com" ) ## 赞助商广告 SPONSOR_ADS=( "1Panel · Linux 面板|极简运维 ➜ \033[3mhttps://1panel.cn\033[0m" "多途云 · 智能化防护,每一次连接皆在安全之下 ➜ \033[3mhttps://www.duotuyun.com\033[0m" "毫秒镜像 · 专为中国开发者提供Docker镜像加速下载服务 ➜ \033[3mhttps://1ms.run\033[0m" "林枫云 · 专注独立IP高频VPS|R9/i9系列定制 ➜ \033[3mhttps://www.dkdun.cn\033[0m" "不死鸟CDN · 香港日本高防CDN,免实名/免备案,轻松阻断DDOS/CC攻击 ➜ \033[3mhttps://bsncdn.ai\033[0m" "青叶云 · 香港1T高防|自助防火墙,无视CC|大带宽回国优化线路 ➜ \033[3mhttps://www.qingyeyun.com\033[0m" "莱卡云 · 专业云计算服务器提供商 ➜ \033[3mhttps://www.lcayun.com\033[0m" "云悠YUNYOO · 全球高性价比云服务器|低至15.99元起 ➜ \033[3mhttps://yunyoo.cc\033[0m" "HKGserver · 全球家宽|双ISP|住宅原生云服务器54元/月起 ➜ \033[3mhttps://www.hkgserver.com\033[0m" "无忧云 · BGP多线高性能、高主频自动化云、物理服务器 ➜ \033[3mhttps://www.wuyouyun.com\033[0m" "速维云 · 大陆香港美日全球千兆大带宽、BGP多线、高频云、物理服务器 ➜ \033[3mhttps://www.svyun.com\033[0m" "酷盾安全 · 集分布式DDoS防护、CC防护、WAF防护、BOT行为分析一体化防护 ➜ \033[3mhttps://www.kd.cn\033[0m" "酷番云 · 安全、稳定、可信赖的企业级云服务提供商 ➜ \033[3mhttps://www.kufanyun.com\033[0m" "语鹿云盾 · 专业CDN加速、防御,亚太百兆三网优化CDN低至9元起 ➜ \033[3mhttps://www.lucdn.cn\033[0m" "不二云 · 国内外建站快响应服务器的不二之选 ➜ \033[3mhttps://cb2.cn\033[0m" "润信云 · 国内挂机宝海外云服务器低至9.9元/月 ➜ \033[3mhttps://www.runxinyun.com\033[0m" "蓝易云 · 高防CDN,国内BGP多线/香港/死扛CC/DDos攻击 ➜ \033[3mhttps://www.tsycdn.com\033[0m" "慈云数据 · 香港直连2H2G 99元/年 ➜ \033[3mhttps://www.ciyundata.com\033[0m" "浪浪云 · BGP网络让每一次连接都纵享丝滑,明码标价、无套路续费 ➜ \033[3mhttps://langlangy.cn\033[0m" ) ############################################################################## ## 定义系统判定变量 SYSTEM_DEBIAN="Debian" SYSTEM_UBUNTU="Ubuntu" SYSTEM_KALI="Kali" SYSTEM_DEEPIN="Deepin" SYSTEM_LINUX_MINT="Linuxmint" SYSTEM_ZORIN="Zorin" SYSTEM_RASPBERRY_PI_OS="Raspberry Pi OS" SYSTEM_REDHAT="RedHat" SYSTEM_RHEL="Red Hat Enterprise Linux" SYSTEM_CENTOS="CentOS" SYSTEM_CENTOS_STREAM="CentOS Stream" SYSTEM_ROCKY="Rocky" SYSTEM_ALMALINUX="AlmaLinux" SYSTEM_FEDORA="Fedora" SYSTEM_ORACLE="Oracle Linux" SYSTEM_OPENCLOUDOS="OpenCloudOS" SYSTEM_OPENCLOUDOS_STREAM="OpenCloudOS Stream" SYSTEM_TENCENTOS="TencentOS" SYSTEM_OPENEULER="openEuler" SYSTEM_ANOLISOS="Anolis" SYSTEM_KYLIN_DESKTOP="Kylin Desktop" SYSTEM_KYLIN_SERVER="Kylin Server" SYSTEM_OPENKYLIN="openKylin" SYSTEM_OPENSUSE="openSUSE" SYSTEM_ARCH="Arch" SYSTEM_MANJARO="Manjaro" SYSTEM_ALPINE="Alpine" SYSTEM_GENTOO="Gentoo" SYSTEM_NIXOS="NixOS" ## 定义系统版本文件 File_LinuxRelease=/etc/os-release File_RedHatRelease=/etc/redhat-release File_DebianVersion=/etc/debian_version File_ArmbianRelease=/etc/armbian-release File_RaspberryPiOSRelease=/etc/rpi-issue File_openEulerRelease=/etc/openEuler-release File_HuaweiCloudEulerOSRelease=/etc/hce-release File_OpenCloudOSRelease=/etc/opencloudos-release File_TencentOSServerRelease=/etc/tlinux-release File_AnolisOSRelease=/etc/anolis-release File_AlibabaCloudLinuxRelease=/etc/alinux-release File_OracleLinuxRelease=/etc/oracle-release File_ArchLinuxRelease=/etc/arch-release File_ManjaroRelease=/etc/manjaro-release File_AlpineRelease=/etc/alpine-release File_GentooRelease=/etc/gentoo-release File_KylinRelease=/etc/kylin-release File_kylinVersion=/etc/kylin-version/kylin-system-version.conf File_ProxmoxVersion=/etc/pve/.version ## 定义软件源相关文件或目录 Dir_AptAdditionalSources=/etc/apt/sources.list.d Dir_AptAdditionalSourcesBackup=$Dir_AptAdditionalSources.bak Dir_YumRepos=/etc/yum.repos.d Dir_YumReposBackup=$Dir_YumRepos.bak Dir_ZYppRepos=/etc/zypp/repos.d Dir_ZYppReposBackup=$Dir_ZYppRepos.bak Dir_GentooReposConf=/etc/portage/repos.conf Dir_NixConfig=/etc/nix File_AptSourceList=/etc/apt/sources.list File_AptSourceListBackup=$File_AptSourceList.bak File_DebianSources=$Dir_AptAdditionalSources/debian.sources File_DebianSourcesBackup=$File_DebianSources.bak File_UbuntuSources=$Dir_AptAdditionalSources/ubuntu.sources File_UbuntuSourcesBackup=$File_UbuntuSources.bak File_ArmbianSourceList=$Dir_AptAdditionalSources/armbian.list File_ArmbianSourceListBackup=$File_ArmbianSourceList.bak File_ProxmoxSourceList=$Dir_AptAdditionalSources/pve-no-subscription.list File_ProxmoxSourceListBackup=$File_ProxmoxSourceList.bak File_ProxmoxSources=$Dir_AptAdditionalSources/pve-no-subscription.sources File_ProxmoxSourcesBackup=$File_ProxmoxSources.bak File_ProxmoxCephSourceList=$Dir_AptAdditionalSources/ceph.list File_ProxmoxCephSourceListBackup=$File_ProxmoxCephSourceList.bak File_ProxmoxCephSources=$Dir_AptAdditionalSources/ceph.sources File_ProxmoxCephSourcesBackup=$File_ProxmoxCephSources.bak File_LinuxMintSourceList=$Dir_AptAdditionalSources/official-package-repositories.list File_LinuxMintSourceListBackup=$File_LinuxMintSourceList.bak File_RaspberryPiSourceList=$Dir_AptAdditionalSources/raspi.list File_RaspberryPiSourceListBackup=$File_RaspberryPiSourceList.bak File_PacmanMirrorList=/etc/pacman.d/mirrorlist File_PacmanMirrorListBackup=$File_PacmanMirrorList.bak File_PacmanEndeavourOSMirrorList=/etc/pacman.d/endeavouros-mirrorlist File_PacmanEndeavourOSMirrorListBackup=$File_PacmanEndeavourOSMirrorList.bak File_AlpineRepositories=/etc/apk/repositories File_AlpineRepositoriesBackup=$File_AlpineRepositories.bak File_GentooMakeConf=/etc/portage/make.conf File_GentooMakeConfBackup=$File_GentooMakeConf.bak File_GentooReposConf=/etc/portage/repos.conf/gentoo.conf File_GentooReposConfBackup=$File_GentooReposConf.bak File_NixConf=/etc/nix/nix.conf File_NixConfBackup=$File_NixConf.bak ## 定义颜色和样式变量 RED='\033[31m' GREEN='\033[32m' YELLOW='\033[33m' BLUE='\033[34m' PURPLE='\033[35m' AZURE='\033[36m' PLAIN='\033[0m' BOLD='\033[1m' SUCCESS="\033[1;32m✔${PLAIN}" COMPLETE="\033[1;32m✔${PLAIN}" WARN="\033[1;43m WARN ${PLAIN}" ERROR="\033[1;31m✘${PLAIN}" FAIL="\033[1;31m✘${PLAIN}" TIP="\033[1;44m TIP ${PLAIN}" WORKING="\033[1;36m◉${PLAIN}" function main() { permission_judgment collect_system_info check_command_options run_start choose_mirrors choose_protocol choose_install_epel_packages backup_original_mirrors remove_original_mirrors change_mirrors_main upgrade_software run_end } function handle_command_options() { while [ $# -gt 0 ]; do case "$1" in ## 海外模式 --abroad) USE_ABROAD_SOURCE="true" ;; ## 中国大陆教育网模式 --edu) USE_EDU_SOURCE="true" ;; ## 指定软件源地址 --source) if [ "$2" ]; then echo "$2" | grep -Eq "\(|\)|\[|\]|\{|\}" if [ $? -eq 0 ]; then command_error "$2" "$(msg "error.cmd.options.validAddress")" else SOURCE="$(echo "$2" | sed -e 's,^http[s]\?://,,g' -e 's,/$,,')" shift fi else command_error "$1" "$(msg "error.cmd.options.sourceAddress")" fi ;; --source-epel) if [ "$2" ]; then echo "$2" | grep -Eq "\(|\)|\[|\]|\{|\}" if [ $? -eq 0 ]; then command_error "$2" "$(msg "error.cmd.options.validAddress")" else SOURCE_EPEL="$(echo "$2" | sed -e 's,^http[s]\?://,,g' -e 's,/$,,')" shift fi else command_error "$1" "$(msg "error.cmd.options.sourceAddress")" fi ;; --source-security) if [ "$2" ]; then echo "$2" | grep -Eq "\(|\)|\[|\]|\{|\}" if [ $? -eq 0 ]; then command_error "$2" "$(msg "error.cmd.options.validAddress")" else SOURCE_SECURITY="$(echo "$2" | sed -e 's,^http[s]\?://,,g' -e 's,/$,,')" shift fi else command_error "$1" "$(msg "error.cmd.options.sourceAddress")" fi ;; --source-vault) if [ "$2" ]; then echo "$2" | grep -Eq "\(|\)|\[|\]|\{|\}" if [ $? -eq 0 ]; then command_error "$2" "$(msg "error.cmd.options.validAddress")" else SOURCE_VAULT="$(echo "$2" | sed -e 's,^http[s]\?://,,g' -e 's,/$,,')" shift fi else command_error "$1" "$(msg "error.cmd.options.sourceAddress")" fi ;; --source-portage) if [ "$2" ]; then echo "$2" | grep -Eq "\(|\)|\[|\]|\{|\}" if [ $? -eq 0 ]; then command_error "$2" "$(msg "error.cmd.options.validAddress")" else SOURCE_PORTAGE="$(echo "$2" | sed -e 's,^http[s]\?://,,g' -e 's,/$,,')" shift fi else command_error "$1" "$(msg "error.cmd.options.sourceAddress")" fi ;; --source-base-system) if [ "$2" ]; then echo "$2" | grep -Eq "\(|\)|\[|\]|\{|\}" if [ $? -eq 0 ]; then command_error "$2" "$(msg "error.cmd.options.validAddress")" else SOURCE_BASE_SYSTEM="$(echo "$2" | sed -e 's,^http[s]\?://,,g' -e 's,/$,,')" shift fi else command_error "$1" "$(msg "error.cmd.options.sourceAddress")" fi ;; ## 指定软件源仓库 --branch) if [ "$2" ]; then SOURCE_BRANCH="$2" shift else command_error "$1" "$(msg "error.cmd.options.sourceRepository")" fi ;; --branch-epel) if [ "$2" ]; then SOURCE_EPEL_BRANCH="$2" shift else command_error "$1" "$(msg "error.cmd.options.sourceRepository")" fi ;; --branch-security) if [ "$2" ]; then SOURCE_SECURITY_BRANCH="$2" shift else command_error "$1" "$(msg "error.cmd.options.sourceRepository")" fi ;; --branch-vault) if [ "$2" ]; then SOURCE_VAULT_BRANCH="$2" shift else command_error "$1" "$(msg "error.cmd.options.sourceRepository")" fi ;; --branch-portage) if [ "$2" ]; then SOURCE_PORTAGE_BRANCH="$2" shift else command_error "$1" "$(msg "error.cmd.options.sourceRepository")" fi ;; --branch-base-system) if [ "$2" ]; then SOURCE_BASE_SYSTEM_BRANCH="$2" shift else command_error "$1" "$(msg "error.cmd.options.sourceRepository")" fi ;; ## 指定 Debian 系操作系统的版本代号 --codename) if [ "$2" ]; then DEBIAN_CODENAME="$2" shift else command_error "$1" "$(msg "error.cmd.options.codename")" fi ;; ## 使用官方源 --use-official-source) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) USE_OFFICIAL_SOURCE="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.boolean")" ;; esac else command_error "$1" "$(msg "error.cmd.options.boolean")" fi ;; ## EPEL 使用 官方源 --use-official-source-epel) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) USE_OFFICIAL_SOURCE_EPEL="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.boolean")" ;; esac else command_error "$1" "$(msg "error.cmd.options.boolean")" fi ;; ## 使用内网地址 --intranet | --use-intranet-source) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) USE_INTRANET_SOURCE="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.boolean")" ;; esac else command_error "$1" "$(msg "error.cmd.options.boolean")" fi ;; ## Web 协议(HTTP/HTTPS) --protocol | --web-protocol) if [ "$2" ]; then case "$2" in http | https | HTTP | HTTPS) WEB_PROTOCOL="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.protocol")" ;; esac else ocommand_error "$1" "$(msg "error.cmd.options.needProtocol")" fi ;; ## 安装 EPEL 附加软件包 --install-epel) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) INSTALL_EPEL="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.boolean")" ;; esac else command_error "$1" "$(msg "error.cmd.options.boolean")" fi ;; --only-epel) ONLY_EPEL="true" INSTALL_EPEL="true" ;; ## 备份原有软件源 --backup) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) BACKUP="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.boolean")" ;; esac else command_error "$1" "$(msg "error.cmd.options.boolean")" fi ;; ## 忽略覆盖备份提示 --ignore-backup-tips) IGNORE_BACKUP_TIPS="true" ;; ## 更新软件包 --upgrade-software | --updata-software) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) UPGRADE_SOFTWARE="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.boolean")" ;; esac else command_error "$1" "$(msg "error.cmd.options.boolean")" fi ;; ## 在更新软件包后清理下载缓存 --clean-cache) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) CLEAN_CACHE="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.boolean")" ;; esac else command_error "$1" "$(msg "error.cmd.options.boolean")" fi ;; ## Locale --lang) if [ "$2" ]; then local lang_norm="${2//_/-}" lang_norm="${lang_norm,,}" case "$lang_norm" in zh | zh-cn | zh-hans | zh-hans-*) init_msg_pack "zh-hans" shift ;; zh-hant | zh-hant-* | zh-tw | zh-hk) init_msg_pack "zh-hant" shift ;; en | en-us | en-*) init_msg_pack "en" shift ;; auto) choose_display_language shift ;; *) command_error "$2" "$(msg "error.cmd.options.validLangKey")" ;; esac else command_error "$1" "$(msg "error.cmd.options.langKey")" fi ;; --zh | --zh-[Cc][Nn]) init_msg_pack "zh-hans" ;; --en | --en-[Uu][Ss]) init_msg_pack "en" ;; --zh-[Hh]an[st]) init_msg_pack "$1" ;; ## 清除屏幕上的所有内容 --clean-screen) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) CLEAN_SCREEN="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.boolean")" ;; esac else command_error "$1" "$(msg "error.cmd.options.boolean")" fi ;; ## 打印源文件修改前后差异 --print-diff) PRINT_DIFF="true" ;; ## 纯净模式 --pure-mode) PURE_MODE="true" ;; ## 命令帮助 --help) echo -e "\n$(msg "commands.help" "https://github.com/SuperManito/LinuxMirrors/issues")\n" exit ;; *) command_error "$1" ;; esac shift done ## 设置部分功能的默认值 ONLY_EPEL="${ONLY_EPEL:-"false"}" BACKUP="${BACKUP:-"true"}" USE_OFFICIAL_SOURCE="${USE_OFFICIAL_SOURCE:-"false"}" IGNORE_BACKUP_TIPS="${IGNORE_BACKUP_TIPS:-"false"}" PRINT_DIFF="${PRINT_DIFF:-"false"}" PURE_MODE="${PURE_MODE:-"false"}" } function run_start() { if [ -z "${CLEAN_SCREEN}" ]; then [ -z "${SOURCE}" ] && clear elif [ "${CLEAN_SCREEN}" == "true" ]; then clear fi if [[ "${PURE_MODE}" == "true" ]]; then return fi local system_name="${SYSTEM_PRETTY_NAME:-"${SYSTEM_NAME} ${SYSTEM_VERSION_ID}"}" local arch="${DEVICE_ARCH}" local date_time="$(date "+%Y-%m-%d %H:%M")" local time_zone="$(timedatectl status 2>/dev/null | grep "Time zone" | awk -F ':' '{print$2}' | awk -F ' ' '{print$1}')" echo -e "+-----------------------------------+" echo -e "| \033[0;1;35;95m⡇\033[0m \033[0;1;33;93m⠄\033[0m \033[0;1;32;92m⣀⡀\033[0m \033[0;1;36;96m⡀\033[0;1;34;94m⢀\033[0m \033[0;1;35;95m⡀⢀\033[0m \033[0;1;31;91m⡷\033[0;1;33;93m⢾\033[0m \033[0;1;32;92m⠄\033[0m \033[0;1;36;96m⡀⣀\033[0m \033[0;1;34;94m⡀\033[0;1;35;95m⣀\033[0m \033[0;1;31;91m⢀⡀\033[0m \033[0;1;33;93m⡀\033[0;1;32;92m⣀\033[0m \033[0;1;36;96m⢀⣀\033[0m |" echo -e "| \033[0;1;31;91m⠧\033[0;1;33;93m⠤\033[0m \033[0;1;32;92m⠇\033[0m \033[0;1;36;96m⠇⠸\033[0m \033[0;1;34;94m⠣\033[0;1;35;95m⠼\033[0m \033[0;1;31;91m⠜⠣\033[0m \033[0;1;33;93m⠇\033[0;1;32;92m⠸\033[0m \033[0;1;36;96m⠇\033[0m \033[0;1;34;94m⠏\033[0m \033[0;1;35;95m⠏\033[0m \033[0;1;33;93m⠣⠜\033[0m \033[0;1;32;92m⠏\033[0m \033[0;1;34;94m⠭⠕\033[0m |" echo -e "+-----------------------------------+" echo -e "$(msg "start.welcome")" echo -e '' echo -e "$(msg "start.runtimeEnv") ${BLUE}${system_name} ${arch}${PLAIN}" echo -e "$(msg "start.dateTime") ${BLUE}${date_time} ${time_zone}${PLAIN}" sleep 1 >/dev/null 2>&1 } function run_end() { if [[ "${PURE_MODE}" == "true" ]]; then echo '' return fi echo -e "\n✨ $(msg "end.moreInfo") 👉 \033[3mhttps://linuxmirrors.cn\033[0m" if [[ "${#SPONSOR_ADS[@]}" -gt 0 ]]; then echo -e "\n\033[2m$(msg "end.sponsorAds")\033[0m" _str_width() { local s="$1" shopt -s extglob s="${s//\\033\[+([0-9;])[a-zA-Z]/}" local width=0 i len val local LC_ALL=C len=${#s} for ((i = 0; i < len; )); do printf -v val '%d' "'${s:i:1}" ((val < 0)) && ((val += 256)) if ((val < 128)); then ((width += 1, i += 1)) elif ((val < 192)); then ((i += 1)) elif ((val < 224)); then ((width += 1, i += 2)) elif ((val < 240)); then ((width += 2, i += 3)) else ((width += 2, i += 4)) fi done echo $width } local -a _c1 _c2 _c3 _w1 _w2 local _max1=0 _max2=0 _w _a _b for _entry in "${SPONSOR_ADS[@]}"; do _a="${_entry%% · *}" _b="${_entry#* · }" _c1+=("$_a") _c2+=("${_b%% ➜ *}") _c3+=("${_b##* ➜ }") _w=$(_str_width "$_a") _w1+=("$_w") [[ $_w -gt $_max1 ]] && _max1=$_w _w=$(_str_width "${_b%% ➜ *}") _w2+=("$_w") [[ $_w -gt $_max2 ]] && _max2=$_w done local _pad1 _pad2 for ((_i = 0; _i < ${#SPONSOR_ADS[@]}; _i++)); do sleep 0.1 printf -v _pad1 '%*s' $((_max1 - _w1[_i])) '' printf -v _pad2 '%*s' $((_max2 - _w2[_i])) '' echo -e " \033[2m${_c1[_i]}${_pad1} ${_c2[_i]}${_pad2} ${_c3[_i]}\033[0m" done fi echo -e "\n\033[3;1mPowered by \033[34mLinuxMirrors\033[0m\n" } function output_error() { [ "$1" ] && echo -e "\n$ERROR $1\n" exit 1 } function command_error() { local tmp_text="$(msg "error.cmd.options.needConfirm")" if [[ "${2}" ]]; then tmp_text="$(msg "error.cmd.options.needSpecify" "${2}")" fi output_error "$(msg "error.cmd.options.invalid" "${BLUE}$1${PLAIN}" "${tmp_text}")" } function unsupport_system_error() { output_error "$(msg "error.unsupportSystem" "${1}")" } function input_error() { echo -e "\n$WARN $(msg "error.input" "${1}")" } function command_exists() { command -v "$@" &>/dev/null } function permission_judgment() { if [ $UID -ne 0 ]; then local change_cmd="su root" if command_exists sudo; then change_cmd="sudo -i" fi output_error "$(msg "error.needRoot" "${BLUE}${change_cmd}${PLAIN}")" fi } function get_os_release_value() { grep -E "^${1}=" $File_LinuxRelease | cut -d= -f2- | sed "s/[\'\"]//g" } function collect_system_info() { if [ ! -s "${File_LinuxRelease}" ]; then unsupport_system_error "$(msg "error.unknownSystem")" fi ## 定义系统名称 SYSTEM_NAME="$(get_os_release_value NAME)" SYSTEM_PRETTY_NAME="$(get_os_release_value PRETTY_NAME)" ## 定义系统版本号 SYSTEM_VERSION_ID="$(get_os_release_value VERSION_ID)" SYSTEM_VERSION_ID_MAJOR="${SYSTEM_VERSION_ID%%.*}" SYSTEM_VERSION_ID_MINOR="${SYSTEM_VERSION_ID#*.}" ## 定义系统ID SYSTEM_ID="$(get_os_release_value ID)" ## 判定当前系统派系 if [ -s "${File_DebianVersion}" ]; then SYSTEM_FACTIONS="${SYSTEM_DEBIAN}" elif [ -s "${File_RedHatRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_REDHAT}" elif [ -s "${File_openEulerRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_OPENEULER}" elif [ -s "${File_OpenCloudOSRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_OPENCLOUDOS}" # 自 9.0 版本起不再基于红帽 elif [ -s "${File_AnolisOSRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_ANOLISOS}" # 自 8.8 版本起不再基于红帽 elif [ -s "${File_kylinVersion}" ] && [[ "${SYSTEM_ID}" == *"openkylin"* ]]; then SYSTEM_FACTIONS="${SYSTEM_OPENKYLIN}" elif [ -f "${File_ArchLinuxRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_ARCH}" elif [ -f "${File_AlpineRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_ALPINE}" elif [ -f "${File_GentooRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_GENTOO}" elif [[ "${SYSTEM_NAME}" == *"openSUSE"* ]]; then SYSTEM_FACTIONS="${SYSTEM_OPENSUSE}" elif [[ "${SYSTEM_NAME}" == *"NixOS"* ]]; then SYSTEM_FACTIONS="${SYSTEM_NIXOS}" else unsupport_system_error "$(msg "error.unknownSystem")" fi ## 判定系统类型、版本、版本号 case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") if command_exists lsb_release; then SYSTEM_JUDGMENT="$(lsb_release -is)" SYSTEM_VERSION_CODENAME="${DEBIAN_CODENAME:-"$(lsb_release -cs)"}" else ## https://codeberg.org/gioele/lsb-release-minimal SYSTEM_JUDGMENT="${SYSTEM_ID^}" if [ "${SYSTEM_NAME}" ]; then if [[ "${SYSTEM_ID,,}" == "${SYSTEM_NAME,,}" ]]; then SYSTEM_JUDGMENT="${SYSTEM_NAME}" fi fi SYSTEM_VERSION_CODENAME="${DEBIAN_CODENAME:-"$(get_os_release_value VERSION_CODENAME)"}" fi ## Raspberry Pi OS 判定 if [[ "${SYSTEM_FACTIONS}" == "${SYSTEM_DEBIAN}" ]] && [ -s "${File_RaspberryPiOSRelease}" ]; then SYSTEM_JUDGMENT="${SYSTEM_RASPBERRY_PI_OS}" SYSTEM_PRETTY_NAME="${SYSTEM_RASPBERRY_PI_OS}" fi ## 针对特定系统的判定 if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_DEBIAN}" ]]; then ## 尚未正式发布的版本 if [[ -z "${SYSTEM_VERSION_ID}" && "${SYSTEM_VERSION_CODENAME}" == "trixie" ]]; then SYSTEM_VERSION_ID="13" SYSTEM_VERSION_ID_MAJOR="${SYSTEM_VERSION_ID%%.*}" SYSTEM_VERSION_ID_MINOR="${SYSTEM_VERSION_ID#*.}" fi ## 是否使用 DEB822 格式 if [[ "${SYSTEM_VERSION_ID_MAJOR}" && "${SYSTEM_VERSION_ID_MAJOR}" -ge 13 ]]; then USE_DEB822_FORMAT="true" fi fi if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_UBUNTU}" ]]; then ## 是否使用 DEB822 格式 if [[ "${SYSTEM_VERSION_ID_MAJOR}" && "${SYSTEM_VERSION_ID_MAJOR}" -ge 24 ]]; then USE_DEB822_FORMAT="true" fi fi ;; "${SYSTEM_REDHAT}") SYSTEM_JUDGMENT="$(awk '{printf $1}' $File_RedHatRelease)" ## 针对特定系统的判定 # Red Hat Enterprise Linux grep -q "${SYSTEM_RHEL}" $File_RedHatRelease && SYSTEM_JUDGMENT="${SYSTEM_RHEL}" # CentOS Stream grep -q "${SYSTEM_CENTOS_STREAM}" $File_RedHatRelease && SYSTEM_JUDGMENT="${SYSTEM_CENTOS_STREAM}" # Oracle Linux [ -s "${File_OracleLinuxRelease}" ] && SYSTEM_JUDGMENT="${SYSTEM_ORACLE}" ;; "${SYSTEM_ARCH}") if [ -f "${File_ManjaroRelease}" ]; then SYSTEM_JUDGMENT="${SYSTEM_MANJARO}" else SYSTEM_JUDGMENT="${SYSTEM_FACTIONS}" fi ;; *) SYSTEM_JUDGMENT="${SYSTEM_FACTIONS}" ;; esac ## 判断系统及版本是否适配 local is_supported="true" case "${SYSTEM_JUDGMENT}" in "${SYSTEM_DEBIAN}") if [[ ! "${SYSTEM_VERSION_ID_MAJOR}" =~ ^(1[0-3]|[8-9])$ ]]; then is_supported="false" fi if [[ "${SYSTEM_VERSION_CODENAME}" == "sid" ]]; then if [[ "${PURE_MODE}" != "true" ]]; then echo -e "\n${WARN} $(msg "warn.unstableDebian" "${BLUE}unstable(sid)${PLAIN}")\n" fi fi ;; "${SYSTEM_UBUNTU}") if [[ ! "${SYSTEM_VERSION_ID_MAJOR}" =~ ^(1[4-9]|2[0-5])$ ]]; then is_supported="false" fi ;; "${SYSTEM_LINUX_MINT}") if [[ "${SYSTEM_NAME}" == *"LMDE"* ]]; then if [[ "${SYSTEM_VERSION_ID_MAJOR}" != [6-7] ]]; then is_supported="false" fi else if [[ ! "${SYSTEM_VERSION_ID_MAJOR}" =~ ^(19|2[0-2])$ ]]; then is_supported="false" fi fi ;; "${SYSTEM_RHEL}") if [[ ! "${SYSTEM_VERSION_ID_MAJOR}" =~ ^([7-9]|10)$ ]]; then is_supported="false" fi ;; "${SYSTEM_CENTOS}") if [[ "${SYSTEM_VERSION_ID_MAJOR}" != [7-8] ]]; then is_supported="false" fi ;; "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ROCKY}" | "${SYSTEM_ALMALINUX}" | "${SYSTEM_ORACLE}") if [[ ! "${SYSTEM_VERSION_ID_MAJOR}" =~ ^([8-9]|10)$ ]]; then is_supported="false" fi ;; "${SYSTEM_FEDORA}") if [[ "${SYSTEM_VERSION_ID}" != [3-4][0-9] ]]; then is_supported="false" fi ;; "${SYSTEM_OPENEULER}") if [[ "${SYSTEM_VERSION_ID_MAJOR}" != 2[0-5] ]]; then is_supported="false" fi ;; "${SYSTEM_OPENCLOUDOS}") if [[ ! "${SYSTEM_VERSION_ID_MAJOR}" =~ ^([8-9]|23)$ ]] || [[ "${SYSTEM_VERSION_ID_MAJOR}" == 8 && "${SYSTEM_VERSION_ID_MINOR}" -lt 6 ]]; then is_supported="false" fi ;; "${SYSTEM_ANOLISOS}") if [[ ! "${SYSTEM_VERSION_ID_MAJOR}" =~ ^(8|23)$ ]]; then is_supported="false" fi ;; "${SYSTEM_OPENSUSE}") case "${SYSTEM_ID}" in "opensuse-leap") if [[ "${SYSTEM_VERSION_ID_MAJOR}" != 1[5-6] ]]; then is_supported="false" fi ;; "opensuse-tumbleweed") ;; *) is_supported="false" ;; esac ;; # 理论全部支持或不作判断 "${SYSTEM_KALI}" | "${SYSTEM_DEEPIN}" | "${SYSTEM_ZORIN}" | "${SYSTEM_RASPBERRY_PI_OS}" | "${SYSTEM_OPENKYLIN}") ;; "${SYSTEM_ARCH}" | "${SYSTEM_MANJARO}" | "${SYSTEM_ALPINE}" | "${SYSTEM_GENTOO}" | "${SYSTEM_NIXOS}") ;; *) unsupport_system_error "$(msg "error.unknownVersion")" ;; esac if [[ "${is_supported}" == "false" ]]; then unsupport_system_error "$(msg "error.unsupportVersion")" fi ## 判定系统处理器架构 DEVICE_ARCH_RAW="$(uname -m)" case "${DEVICE_ARCH_RAW}" in x86_64) DEVICE_ARCH="x86_64" ;; aarch64) DEVICE_ARCH="ARM64" ;; armv8l) DEVICE_ARCH="ARMv8_32" ;; armv7l) DEVICE_ARCH="ARMv7" ;; armv6l) DEVICE_ARCH="ARMv6" ;; armv5tel) DEVICE_ARCH="ARMv5" ;; i686) DEVICE_ARCH="x86_32" ;; *) DEVICE_ARCH="${DEVICE_ARCH_RAW}" ;; esac ## 定义软件源仓库名称 if [[ -z "${SOURCE_BRANCH}" ]]; then ## 默认为系统名称小写,替换空格 SOURCE_BRANCH="${SYSTEM_JUDGMENT,,}" SOURCE_BRANCH="${SOURCE_BRANCH// /-}" ## 处理特殊的仓库名称 case "${SYSTEM_JUDGMENT}" in "${SYSTEM_DEBIAN}") case "${SYSTEM_VERSION_ID_MAJOR}" in 8 | 9 | 10 | 11) SOURCE_BRANCH="debian-archive/debian" ;; *) SOURCE_BRANCH="debian" ;; esac ;; "${SYSTEM_UBUNTU}" | "${SYSTEM_ZORIN}") if [[ "${DEVICE_ARCH_RAW}" == "x86_64" || "${DEVICE_ARCH_RAW}" == *i?86* ]]; then SOURCE_BRANCH="ubuntu" else SOURCE_BRANCH="ubuntu-ports" fi ;; "${SYSTEM_RASPBERRY_PI_OS}") SOURCE_BRANCH="raspberrypi" ;; "${SYSTEM_RHEL}") case "${SYSTEM_VERSION_ID_MAJOR}" in 7 | 8) if [[ "${DEVICE_ARCH_RAW}" == "x86_64" ]]; then SOURCE_BRANCH="centos-vault" else SOURCE_BRANCH="centos-altarch" fi ;; *) SOURCE_BRANCH="centos-stream" # 使用 CentOS Stream 仓库 ;; esac ;; "${SYSTEM_CENTOS}") if [[ "${DEVICE_ARCH_RAW}" == "x86_64" ]]; then SOURCE_BRANCH="centos-vault" else SOURCE_BRANCH="centos-altarch" fi ;; "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ORACLE}") # 自 CentOS Stream 9 开始使用 centos-stream 仓库,旧版本使用 centos 仓库 case "${SYSTEM_VERSION_ID_MAJOR}" in 8) if [[ "${DEVICE_ARCH_RAW}" == "x86_64" ]]; then SOURCE_BRANCH="centos-vault" else SOURCE_BRANCH="centos-altarch" fi ;; *) SOURCE_BRANCH="centos-stream" ;; esac ;; "${SYSTEM_FEDORA}") if [[ "${SYSTEM_VERSION_ID}" -lt 39 ]]; then SOURCE_BRANCH="fedora-archive" fi ;; "${SYSTEM_ARCH}") if [[ "${DEVICE_ARCH_RAW}" == "x86_64" || "${DEVICE_ARCH_RAW}" == *i?86* ]]; then SOURCE_BRANCH="archlinux" else SOURCE_BRANCH="archlinuxarm" fi # EndeavourOS if [[ "${SYSTEM_NAME}" == *"EndeavourOS"* ]] && [[ -f "${File_PacmanEndeavourOSMirrorList}" ]]; then SOURCE_BRANCH="archlinux" fi ;; "${SYSTEM_OPENCLOUDOS}") # OpenCloudOS Stream grep -q "${SYSTEM_OPENCLOUDOS_STREAM}" $File_OpenCloudOSRelease if [ $? -eq 0 ]; then SOURCE_BRANCH="${SYSTEM_OPENCLOUDOS_STREAM,,}" SOURCE_BRANCH="${SOURCE_BRANCH// /-}" fi ;; "${SYSTEM_NIXOS}") SOURCE_BRANCH="nix-channels" ;; esac fi ## 定义软件源更新文字 case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_ALPINE}" | "${SYSTEM_OPENKYLIN}") SYNC_MIRROR_TEXT="$(msg "source.sync.text1")" ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}") SYNC_MIRROR_TEXT="$(msg "source.sync.text2")" ;; "${SYSTEM_OPENSUSE}") SYNC_MIRROR_TEXT="$(msg "source.sync.text3")" ;; "${SYSTEM_ARCH}" | "${SYSTEM_GENTOO}") SYNC_MIRROR_TEXT="$(msg "source.sync.text4")" ;; "${SYSTEM_NIXOS}") SYNC_MIRROR_TEXT="$(msg "source.sync.text5")" ;; esac ## 判断是否可以使用高级交互式选择器 CAN_USE_ADVANCED_INTERACTIVE_SELECTION="false" if command_exists tput; then CAN_USE_ADVANCED_INTERACTIVE_SELECTION="true" fi } ## 命令选项兼容性判断 function check_command_options() { if [[ "${USE_ABROAD_SOURCE}" == "true" && "${USE_EDU_SOURCE}" == "true" ]]; then output_error "$(msg "error.cmd.options.unsupportTwoSourceMode")" fi if [[ "${DEBIAN_CODENAME}" ]]; then if [[ "${SYSTEM_FACTIONS}" != "${SYSTEM_DEBIAN}" && "${SYSTEM_FACTIONS}" != "${SYSTEM_OPENKYLIN}" ]]; then output_error "$(msg "error.cmd.options.unsupportCodename")" fi fi if [[ "${ONLY_EPEL}" == "true" ]]; then case "${SYSTEM_FACTIONS}" in "${SYSTEM_REDHAT}") if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_FEDORA}" ]]; then output_error "$(msg "error.cmd.options.unsupportEPEL")" fi ;; *) output_error "$(msg "error.cmd.options.unsupportEPEL")" ;; esac fi } ## 选择显示语言 function choose_display_language() { local result if command_exists tput; then local -a lang_key_labels=() local language_text for ((i = 0; i < ${#MESSAGE_LANG_KEYS[@]}; i++)); do language_text="${MESSAGE_LANG_DISPLAY[${MESSAGE_LANG_KEYS[$i]}]}" if [[ "${language_text}" ]]; then lang_key_labels+=("${language_text}") else lang_key_labels+=("") fi done interactive_select_list "MESSAGE_LANG_KEYS" "\n ${BOLD}Please select the display language:${PLAIN}\n" "lang_key_labels" result="${_SELECT_RESULT%%@@*}" else echo '' for ((i = 0; i < ${#MESSAGE_LANG_KEYS[@]}; i++)); do echo -e " $((i + 1)). ${MESSAGE_LANG_DISPLAY[${MESSAGE_LANG_KEYS[$i]}]}" done local CHOICE="$(echo -e "\n${BOLD}└─ Please select and enter the display language [ 1-${#MESSAGE_LANG_KEYS[@]} ]:${PLAIN}")" while true; do read -rp "${CHOICE}" INPUT case "${INPUT}" in [1-9] | [1-9][0-9]) local tmp_result="${MESSAGE_LANG_KEYS[$((INPUT - 1))]}" if [[ -z "${tmp_result}" ]]; then echo -e "\n$WARN $(msg "warn.needValidNumberIndex")" else result="${tmp_result}" break fi ;; *) echo -e "\n$WARN $(msg "warn.needInputNumberIndex")" ;; esac done fi init_msg_pack "${result}" } ## 选择软件源 function choose_mirrors() { ## 打印软件源列表 function print_mirrors_list() { local tmp_name tmp_index i j function StringLength() { local text=$1 echo "${#text}" } local -a list_arr=() local list_arr_sum="$(eval echo \${#$1[@]})" for ((i = 0; i < $list_arr_sum; i++)); do list_arr[$i]="$(eval echo \${$1[i]})" done local name_width=${2:-"30"} local -a list_labels=() if [[ "${3}" ]]; then eval "list_labels=(\"\${${3}[@]}\")" fi if command_exists printf; then local tmp_uchar_1 tmp_uchar_2 tmp_uchar_3 tmp_uchar_4 tmp_default_length tmp_length tmp_unicode_length tmp_spaces_nums tmp_max_length for ((i = 0; i < ${#list_arr[@]}; i++)); do if [[ "${list_labels[$i]}" ]]; then tmp_name="${list_labels[$i]}" else tmp_name="${list_arr[i]}" fi tmp_index=$((i + 1)) tmp_default_length="${name_width}" tmp_uchar_1=$(echo "${tmp_name}" | grep -c "“") tmp_uchar_2=$(echo "${tmp_name}" | grep -c "”") tmp_uchar_3=$(echo "${tmp_name}" | grep -c "‘") tmp_uchar_4=$(echo "${tmp_name}" | grep -c "’") [[ "${tmp_uchar_1}" -gt 0 ]] && ((tmp_default_length += tmp_uchar_1)) [[ "${tmp_uchar_2}" -gt 0 ]] && ((tmp_default_length += tmp_uchar_2)) [[ "${tmp_uchar_3}" -gt 0 ]] && ((tmp_default_length += tmp_uchar_3)) [[ "${tmp_uchar_4}" -gt 0 ]] && ((tmp_default_length += tmp_uchar_4)) tmp_length=$(StringLength "${tmp_name}") tmp_unicode_length=$(StringLength "$(echo "${tmp_name}" | sed "s|[0-9a-zA-Z -~]||g; s| ||g")") tmp_max_length=$((tmp_default_length + tmp_unicode_length)) tmp_spaces_nums=$((((tmp_default_length - tmp_unicode_length - tmp_length)) / 2)) if [[ $tmp_spaces_nums -gt 0 ]]; then tmp_name="${tmp_name}$(printf '%*s' ${tmp_spaces_nums} '')" fi printf "❖ %-${tmp_max_length}s %4s\n" "${tmp_name}" "${tmp_index})" done else for ((i = 0; i < ${#list_arr[@]}; i++)); do if [[ "${list_labels[$i]}" ]]; then tmp_name="${list_labels[$i]}" else tmp_name="${list_arr[i]}" fi tmp_index=$((i + 1)) echo -e " ❖ $tmp_index. ${tmp_name}" done fi } ## 选择使用软件源内网地址 function choose_use_intranet_address() { local intranet_source for ((i = 0; i < ${#mirror_list_extranet[@]}; i++)); do if [[ "${SOURCE}" == "${mirror_list_extranet[i]}" ]]; then intranet_source="${mirror_list_intranet[i]}" break else continue fi done if [[ -z "${USE_INTRANET_SOURCE}" ]]; then if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then echo '' interactive_select_boolean "${BOLD}$(msg "interaction.source.type.select")${PLAIN}" "$(msg "interaction.source.type.public")" "$(msg "interaction.source.type.intranet")" if [[ "${_SELECT_RESULT}" == "false" ]]; then SOURCE="${intranet_source}" ONLY_HTTP="true" # 强制使用 HTTP 协议 [[ "${PURE_MODE}" != "true" ]] && echo -e "\n$WARN $(msg "warn.usedIntranetSource")" fi else local CHOICE="$(echo -e "\n${BOLD}└─ $(msg "interaction.source.type.usePublicAddress")? [Y/n] ${PLAIN}")" read -rp "${CHOICE}" INPUT [[ -z "${INPUT}" ]] && INPUT=Y case "${INPUT}" in [Yy] | [Yy][Ee][Ss]) ;; [Nn] | [Nn][Oo]) SOURCE="${intranet_source}" ONLY_HTTP="true" # 强制使用 HTTP 协议 [[ "${PURE_MODE}" != "true" ]] && echo -e "\n$WARN $(msg "warn.usedIntranetSource")" ;; *) input_error "$(msg "error.defaultBehavior.noUseIntranetSource")" ;; esac fi elif [[ "${USE_INTRANET_SOURCE}" == "true" ]]; then SOURCE="${intranet_source}" fi } if [[ -z "${SOURCE}" ]]; then ## 使用官方源 if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then return fi local mirror_list_name mirror_list_label_msg_prefix mirror_list_print_length if [[ "${USE_ABROAD_SOURCE}" = "true" ]]; then mirror_list_name="mirror_list_abroad" mirror_list_label_msg_prefix="mirrors.abroad" mirror_list_print_length=56 elif [[ "${USE_EDU_SOURCE}" = "true" ]]; then mirror_list_name="mirror_list_edu" mirror_list_label_msg_prefix="mirrors.edu" mirror_list_print_length=32 else mirror_list_name="mirror_list_default" mirror_list_label_msg_prefix="mirrors.default" mirror_list_print_length=32 fi local -a mirror_list_labels=() local mirror_list_length=$(eval "echo \${#${mirror_list_name}[@]}") local label_msg_index label_msg_content for ((i = 0; i < ${mirror_list_length}; i++)); do label_msg_index="${mirror_list_label_msg_prefix}.${i}" label_msg_content="$(msg "${label_msg_index}")" if [[ "${label_msg_content}" == "${label_msg_index}" ]]; then mirror_list_labels+=("") else mirror_list_labels+=("${label_msg_content}") fi done if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then interactive_select_list "${mirror_list_name}" "\n ${BOLD}$(msg "interaction.source.select")${PLAIN}\n" "mirror_list_labels" SOURCE="${_SELECT_RESULT%%@@*}" echo -e "\n${GREEN}➜${PLAIN} ${BOLD}${_SELECT_RESULT#*@@}${PLAIN}" | sed "s| · |-|g" else echo '' print_mirrors_list "${mirror_list_name}" "${mirror_list_print_length}" "mirror_list_labels" local CHOICE="$(echo -e "\n${BOLD}└─ $(msg "interaction.source.selectAndInput") [ 1-$(eval echo \${#${mirror_list_name}[@]}) ]:${PLAIN}")" while true; do read -rp "${CHOICE}" INPUT case "${INPUT}" in [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) local tmp_result="$(eval echo \${${mirror_list_name}[$((INPUT - 1))]})" if [[ -z "${tmp_result}" ]]; then echo -e "\n$WARN $(msg "warn.needValidNumberIndex")" else SOURCE="${tmp_result}" break fi ;; *) echo -e "\n$WARN $(msg "warn.needInputNumberIndex")" ;; esac done fi ## 使用官方源 if [[ "${SOURCE}" == "__OFFICIAL_SOURCE_TAG__" ]]; then USE_OFFICIAL_SOURCE="true" SOURCE="" return fi fi ## 选择软件源内网地址 if [[ "${mirror_list_extranet[*]}" =~ (^|[^[:alpha:]])"${SOURCE}"([^[:alpha:]]|$) ]]; then choose_use_intranet_address fi } ## 选择同步或更新软件源所使用的 Web 协议( HTTP/HTTPS) function choose_protocol() { if [[ -z "${WEB_PROTOCOL}" ]]; then if [[ "${ONLY_HTTP}" == "true" ]]; then WEB_PROTOCOL="http" else if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then echo '' interactive_select_boolean "${BOLD}$(msg "interaction.protocol.select")${PLAIN}" "HTTP" "HTTPS" if [[ "${_SELECT_RESULT}" == "true" ]]; then WEB_PROTOCOL="http" else WEB_PROTOCOL="https" fi else local CHOICE="$(echo -e "\n${BOLD}└─ $(msg "interaction.protocol.useHttp")? [Y/n] ${PLAIN}")" read -rp "${CHOICE}" INPUT [[ -z "${INPUT}" ]] && INPUT=Y case "${INPUT}" in [Yy] | [Yy][Ee][Ss]) WEB_PROTOCOL="http" ;; [Nn] | [Nn][Oo]) WEB_PROTOCOL="https" ;; *) input_error "$(msg "error.defaultBehavior.https")" WEB_PROTOCOL="https" ;; esac fi fi fi WEB_PROTOCOL="${WEB_PROTOCOL,,}" } # 选择安装/换源 EPEL 附加软件包(适用于部分红帽系统) function choose_install_epel_packages() { function check_install_status() { ## 判断是否已安装 EPEL 软件包 rpm -qa | grep epel-release -q VERIFICATION_EPEL=$? } ## 判断是否支持且需要处理 EPEL 附加软件包 case "${SYSTEM_FACTIONS}" in "${SYSTEM_REDHAT}") if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_FEDORA}" ]] || [[ "${INSTALL_EPEL}" == "false" ]]; then INSTALL_EPEL="false" return else check_install_status fi ;; *) INSTALL_EPEL="false" return ;; esac ## 选择是否安装 EPEL 附加软件包 if [[ -z "${INSTALL_EPEL}" ]]; then local ask_text if [ $VERIFICATION_EPEL -eq 0 ]; then ask_text="$(msg "interaction.epel.skipReplace")" else ask_text="$(msg "interaction.epel.install")" fi if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then echo '' interactive_select_boolean "${BOLD}${ask_text}?${PLAIN}" if [[ "${_SELECT_RESULT}" == "true" ]]; then INSTALL_EPEL="true" else INSTALL_EPEL="false" fi else local CHOICE="$(echo -e "\n${BOLD}└─ ${ask_text}? [Y/n] ${PLAIN}")" read -rp "${CHOICE}" INPUT [[ -z "${INPUT}" ]] && INPUT=Y case "${INPUT}" in [Yy] | [Yy][Ee][Ss]) INSTALL_EPEL="true" ;; [Nn] | [Nn][Oo]) INSTALL_EPEL="false" ;; *) input_error "$(msg "error.defaultBehavior.noReplace")" INSTALL_EPEL="false" ;; esac fi fi } ## 备份原有软件源(文件/目录) function backup_original_mirrors() { function backup_file() { local target_file=$1 local backup_file=$2 local type="$3" ## 判断是否存在源文件 [ -f "${target_file}" ] || touch "${target_file}" if [ ! -s "${target_file}" ]; then return fi ## 判断是否存在已备份的源文件 if [ -s "${backup_file}" ]; then if [[ "${IGNORE_BACKUP_TIPS}" != "false" ]]; then return fi local ask_text="$(msg "interaction.backup.skipOverwrite.sourceFile" "${type}")?" if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then echo '' interactive_select_boolean "${BOLD}${ask_text}${PLAIN}" if [[ "${_SELECT_RESULT}" == "false" ]]; then echo '' cp -rvf "${target_file}" "${backup_file}" 2>&1 BACKED_UP="true" fi else local CHOICE_BACKUP="$(echo -e "\n${BOLD}└─ ${ask_text} [Y/n] ${PLAIN}")" read -rp "${CHOICE_BACKUP}" INPUT [[ -z "${INPUT}" ]] && INPUT=Y case "${INPUT}" in [Yy] | [Yy][Ee][Ss]) ;; [Nn] | [Nn][Oo]) echo '' cp -rvf "${target_file}" "${backup_file}" 2>&1 BACKED_UP="true" ;; *) input_error "$(msg "error.defaultBehavior.noOverwrite")" ;; esac fi else echo '' cp -rvf "${target_file}" "${backup_file}" 2>&1 BACKED_UP="true" echo -e "\n$COMPLETE $(msg "info.backuped.sourceFile" "${type}")" sleep 1s fi } function backup_dir() { local target_dir=$1 local backup_dir=$2 [ -d "${target_dir}" ] || mkdir -p "${target_dir}" [ -d "${backup_dir}" ] || mkdir -p "${backup_dir}" ## 判断是否存在 repo 源文件 ls "${target_dir}" | grep '\.repo$' -q if [ $? -ne 0 ]; then return fi ## 判断是否存在已备份的 repo 源文件 ls "${backup_dir}" | grep '\.repo$' -q if [ $? -eq 0 ]; then if [[ "${IGNORE_BACKUP_TIPS}" != "false" ]]; then return fi local ask_text="$(msg "interaction.backup.skipOverwrite.sourceFile" "repo")?" if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then echo '' interactive_select_boolean "${BOLD}${ask_text}${PLAIN}" if [[ "${_SELECT_RESULT}" == "false" ]]; then echo '' cp -rvf $target_dir/* "${backup_dir}" 2>&1 BACKED_UP="true" fi else local CHOICE_BACKUP="$(echo -e "\n${BOLD}└─ ${ask_text} [Y/n] ${PLAIN}")" read -rp "${CHOICE_BACKUP}" INPUT [[ -z "${INPUT}" ]] && INPUT=Y case "${INPUT}" in [Yy] | [Yy][Ee][Ss]) ;; [Nn] | [Nn][Oo]) echo '' cp -rvf $target_dir/* "${backup_dir}" 2>&1 BACKED_UP="true" ;; *) input_error "$(msg "error.defaultBehavior.noOverwrite")" ;; esac fi else echo '' cp -rvf $target_dir/* "${backup_dir}" 2>&1 BACKED_UP="true" echo -e "\n$COMPLETE $(msg "info.backuped.sourceFile" "repo")" sleep 1s fi } BACKED_UP="false" # 是否已备份 if [[ "${BACKUP}" == "true" ]]; then case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") # Debian DEB822 格式源文件 if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_DEBIAN}" ]] && [ -f "${File_DebianSources}" ]; then backup_file $File_DebianSources $File_DebianSourcesBackup "debian.sources" USE_DEB822_FORMAT="true" fi # Ubuntu DEB822 格式源文件 if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_UBUNTU}" ]] && [ -f "${File_UbuntuSources}" ]; then 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" fi # Proxmox VE if [ -f "${File_ProxmoxVersion}" ]; then if [[ "${USE_DEB822_FORMAT}" == "true" ]]; then backup_file $File_ProxmoxSources $File_ProxmoxSourcesBackup "pve-no-subscription.sources" [ -f "${File_ProxmoxCephSources}" ] && backup_file $File_ProxmoxCephSources $File_ProxmoxCephSourcesBackup "ceph.sources" else backup_file $File_ProxmoxSourceList $File_ProxmoxSourceListBackup "pve-no-subscription.list" [ -f "${File_ProxmoxCephSourceList}" ] && backup_file $File_ProxmoxCephSourceList $File_ProxmoxCephSourceListBackup "ceph.list" fi fi # Linux Mint if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_LINUX_MINT}" ]]; then backup_file $File_LinuxMintSourceList $File_LinuxMintSourceListBackup "official-package-repositories.list" fi # Raspberry Pi OS if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_RASPBERRY_PI_OS}" ]]; then backup_file $File_RaspberryPiSourceList $File_RaspberryPiSourceListBackup "raspi.list" fi ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}") # /etc/yum.repos.d backup_dir $Dir_YumRepos $Dir_YumReposBackup ;; "${SYSTEM_OPENSUSE}") # /etc/zypp/repos.d backup_dir $Dir_ZYppRepos $Dir_ZYppReposBackup ;; "${SYSTEM_ARCH}") # /etc/pacman.d/mirrorlist backup_file $File_PacmanMirrorList $File_PacmanMirrorListBackup "mirrorlist" # EndeavourOS if [[ "${SYSTEM_NAME}" == *"EndeavourOS"* ]] && [[ -f "${File_PacmanEndeavourOSMirrorList}" ]]; then # /etc/pacman.d/endeavouros-mirrorlist backup_file $File_PacmanEndeavourOSMirrorList $File_PacmanEndeavourOSMirrorListBackup "endeavouros-mirrorlist" fi ;; "${SYSTEM_ALPINE}") # /etc/apk/repositories backup_file $File_AlpineRepositories $File_AlpineRepositoriesBackup "repositories" ;; "${SYSTEM_GENTOO}") # /etc/portage/make.conf backup_file $File_GentooMakeConf $File_GentooMakeConfBackup "make.conf" # /etc/portage/repos.conf/gentoo.conf [ -d "${Dir_GentooReposConf}" ] || mkdir -p "${Dir_GentooReposConf}" backup_file $File_GentooReposConf $File_GentooReposConfBackup "gentoo.conf" ;; "${SYSTEM_NIXOS}") [ ! -d "${Dir_NixConfig}" ] && mkdir -p "${Dir_NixConfig}" # /etc/nix/nix.conf backup_file $File_NixConf $File_NixConfBackup "nix.conf" ;; esac fi } ## 移除原有软件源 function remove_original_mirrors() { function clear_file() { [ -f "$1" ] && sed -i '1,$d' "$1" } case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") # /etc/apt/sources.list.d [ -d "${Dir_AptAdditionalSources}" ] || mkdir -p $Dir_AptAdditionalSources # Debian DEB822 格式源文件 if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_DEBIAN}" ]] && [ -f "${File_DebianSources}" ]; then clear_file $File_DebianSources USE_DEB822_FORMAT="true" fi # Ubuntu DEB822 格式源文件 if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_UBUNTU}" ]] && [ -f "${File_UbuntuSources}" ]; then clear_file $File_UbuntuSources USE_DEB822_FORMAT="true" fi # /etc/apt/sources.list if [[ "${USE_DEB822_FORMAT}" != "true" ]] && [[ "${SYSTEM_JUDGMENT}" != "${SYSTEM_LINUX_MINT}" ]]; then [ -s "${File_AptSourceList}" ] && clear_file $File_AptSourceList fi ## 解决软件源冲突 if [[ "${USE_DEB822_FORMAT}" == "true" ]] && [ -s "${File_AptSourceList}" ]; then if [[ "${SOURCE_BRANCH}" ]]; then sed -e "/^deb\(-src\)\? http.*\/${SOURCE_BRANCH}/d" \ -e "/^#[[:space:]]*deb\(-src\)\? http.*\/${SOURCE_BRANCH}/d" \ -e "/^#.*\(默认禁用源码镜像以提高更新速度\|安全更新软件源\|预发布软件源\).*/d" \ -i \ $File_AptSourceList fi fi # Armbian [ -f "${File_ArmbianRelease}" ] && clear_file $File_ArmbianSourceList # Proxmox VE if [ -f "${File_ProxmoxVersion}" ]; then if [[ "${USE_DEB822_FORMAT}" == "true" ]]; then clear_file $File_ProxmoxSources [ -f "${File_ProxmoxCephSources}" ] && clear_file $File_ProxmoxCephSources else clear_file $File_ProxmoxSourceList [ -f "${File_ProxmoxCephSourceList}" ] && clear_file $File_ProxmoxCephSourceList fi fi # Linux Mint [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_LINUX_MINT}" ]] && clear_file $File_LinuxMintSourceList # Raspberry Pi OS [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_RASPBERRY_PI_OS}" ]] && clear_file $File_RaspberryPiSourceList ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}") if [ ! -d "${Dir_YumRepos}" ]; then mkdir -p "${Dir_YumRepos}" return fi local -a repo_patterns=() if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_FEDORA}" ]]; then repo_patterns=( "fedora.repo" "fedora-updates.repo" "fedora-updates-testing.repo" "fedora-modular.repo" "fedora-updates-modular.repo" "fedora-updates-testing-modular.repo" ) else if [[ "${ONLY_EPEL}" != "false" ]]; then return fi case "${SYSTEM_JUDGMENT}" in "${SYSTEM_RHEL}") case "${SYSTEM_VERSION_ID_MAJOR}" in 7 | 8) repo_patterns=("CentOS-*") ;; *) repo_patterns=( "centos-stream.repo" "centos-stream-addons.repo" ) ;; esac ;; "${SYSTEM_CENTOS}") repo_patterns=("CentOS-*") ;; "${SYSTEM_CENTOS_STREAM}") case "${SYSTEM_VERSION_ID_MAJOR}" in 9 | 10) repo_patterns=( "centos-stream.repo" "centos-stream-addons.repo" ) ;; 8) repo_patterns=("CentOS-Stream-*") ;; esac ;; "${SYSTEM_ROCKY}") case "${SYSTEM_VERSION_ID_MAJOR}" in 9) repo_patterns=( "rocky.repo" "rocky-addons.repo" "rocky-devel.repo" "rocky-extras.repo" ) ;; 8) repo_patterns=("Rocky-*") ;; esac ;; "${SYSTEM_ALMALINUX}") repo_patterns=("almalinux*") ;; "${SYSTEM_ORACLE}") case "${SYSTEM_VERSION_ID_MAJOR}" in 9 | 10) repo_patterns=( "*ol${SYSTEM_VERSION_ID_MAJOR}.repo" "centos-stream.repo" "centos-stream-addons.repo" ) ;; 8) repo_patterns=( "*ol${SYSTEM_VERSION_ID_MAJOR}.repo" "CentOS-Stream-*" ) ;; esac ;; "${SYSTEM_OPENCLOUDOS}") repo_patterns=("OpenCloudOS*") ;; "${SYSTEM_ANOLISOS}") repo_patterns=("AnolisOS*") ;; "${SYSTEM_OPENEULER}") repo_patterns=("openEuler.repo") ;; esac fi for pattern in "${repo_patterns[@]}"; do if [[ -n "$pattern" ]]; then eval "rm -rf $Dir_YumRepos/$pattern" fi done ;; "${SYSTEM_OPENSUSE}") if [ ! -d "${Dir_ZYppRepos}" ]; then mkdir -p "${Dir_ZYppRepos}" return fi rm -rf $Dir_ZYppRepos/repo-* rm -rf $Dir_ZYppRepos/openSUSE:repo-* rm -rf $Dir_ZYppRepos/download.opensuse.org-* ;; "${SYSTEM_ARCH}") clear_file $File_PacmanMirrorList # EndeavourOS if [[ "${SYSTEM_NAME}" == *"EndeavourOS"* ]] && [[ -f "${File_PacmanEndeavourOSMirrorList}" ]]; then clear_file $File_PacmanEndeavourOSMirrorList fi ;; "${SYSTEM_ALPINE}") clear_file $File_AlpineRepositories ;; "${SYSTEM_GENTOO}") clear_file $File_GentooReposConf ;; esac } ## 换源 function change_mirrors_main() { ## 打印软件源内容修改前后差异 function print_diff() { ## 单一文件 function diff_file() { local diff_file=$1 local origin_file=$2 if [ -s "${diff_file}" ] && [ -s "${origin_file}" ]; then if [[ "$(cat "${diff_file}")" != "$(cat "${origin_file}")" ]]; then echo -e "\n${BLUE}${diff_file}${PLAIN} -> ${BLUE}${origin_file}${PLAIN}" diff "${diff_file}" "${origin_file}" -d --color=always -I -B -E fi fi } ## 目录文件 function diff_dir() { local diff_dir=$1 local origin_dir=$2 for item in $(ls $diff_dir | xargs); do diff_file "${diff_dir}/${item}" "${origin_dir}/${item}" done } if command_exists diff && [[ "${BACKED_UP}" == "true" ]]; then case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") if [[ "${USE_DEB822_FORMAT}" == "true" ]]; then # DEB822 格式源文件 if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_DEBIAN}" ]]; then diff_file $File_DebianSourcesBackup $File_DebianSources fi if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_UBUNTU}" ]]; then diff_file $File_UbuntuSourcesBackup $File_UbuntuSources fi else if [[ "${SYSTEM_JUDGMENT}" != "${SYSTEM_LINUX_MINT}" ]]; then diff_file $File_AptSourceListBackup $File_AptSourceList fi fi # Armbian if [ -f "${File_ArmbianRelease}" ]; then diff_file $File_ArmbianSourceListBackup $File_ArmbianSourceList fi # Proxmox VE if [ -f "${File_ProxmoxVersion}" ]; then if [[ "${USE_DEB822_FORMAT}" == "true" ]]; then diff_file $File_ProxmoxSourcesBackup $File_ProxmoxSources [ -f "${File_ProxmoxCephSources}" ] && diff_file $File_ProxmoxCephSourcesBackup $File_ProxmoxCephSources else diff_file $File_ProxmoxSourceListBackup $File_ProxmoxSourceList [ -f "${File_ProxmoxCephSourceList}" ] && diff_file $File_ProxmoxCephSourceListBackup $File_ProxmoxCephSourceList fi fi # Linux Mint if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_LINUX_MINT}" ]]; then diff_file $File_LinuxMintSourceListBackup $File_LinuxMintSourceList fi # Raspberry Pi OS if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_RASPBERRY_PI_OS}" ]]; then diff_file $File_RaspberryPiSourceListBackup $File_RaspberryPiSourceList fi ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}") diff_dir $Dir_YumReposBackup $Dir_YumRepos ;; "${SYSTEM_OPENSUSE}") diff_dir $Dir_ZYppReposBackup $Dir_ZYppRepos ;; "${SYSTEM_ARCH}") diff_file $File_PacmanMirrorListBackup $File_PacmanMirrorList # EndeavourOS if [[ "${SYSTEM_NAME}" == *"EndeavourOS"* ]] && [[ -f "${File_PacmanEndeavourOSMirrorList}" ]]; then diff_file $File_PacmanEndeavourOSMirrorListBackup $File_PacmanEndeavourOSMirrorList fi ;; "${SYSTEM_ALPINE}") diff_file $File_AlpineRepositoriesBackup $File_AlpineRepositories ;; "${SYSTEM_GENTOO}") diff_file $File_GentooMakeConfBackup $File_GentooMakeConf diff_file $File_GentooReposConfBackup $File_GentooReposConf ;; "${SYSTEM_NIXOS}") diff_file $File_NixConfBackup $File_NixConf ;; esac fi } if [[ -z "${SOURCE}" ]]; then USE_OFFICIAL_SOURCE="true" fi ## 调用换源函数 case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}") change_mirrors_Debian ;; "${SYSTEM_REDHAT}") change_mirrors_RedHat ;; "${SYSTEM_OPENEULER}") change_mirrors_openEuler ;; "${SYSTEM_OPENCLOUDOS}") change_mirrors_OpenCloudOS ;; "${SYSTEM_OPENKYLIN}") change_mirrors_openKylin ;; "${SYSTEM_ANOLISOS}") change_mirrors_AnolisOS ;; "${SYSTEM_OPENSUSE}") change_mirrors_openSUSE ;; "${SYSTEM_ARCH}") change_mirrors_ArchLinux ;; "${SYSTEM_ALPINE}") change_mirrors_Alpine ;; "${SYSTEM_GENTOO}") change_mirrors_Gentoo ;; "${SYSTEM_NIXOS}") change_mirrors_NixOS ;; esac ## 比较差异 if [[ "${PRINT_DIFF}" == "true" ]]; then print_diff fi ## 更新软件源 local -a commands=() case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") commands+=("apt-get update") ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}") local package_manager="$(get_package_manager)" commands+=("${package_manager} makecache") ;; "${SYSTEM_OPENSUSE}") commands+=("zypper ref") ;; "${SYSTEM_ARCH}") commands+=("pacman -Sy") ;; "${SYSTEM_ALPINE}") commands+=("apk update -f") ;; "${SYSTEM_GENTOO}") commands+=("emerge --sync --quiet") ;; "${SYSTEM_NIXOS}") commands+=("nix-store --verify") commands+=("nix-channel --update") ;; esac if [[ "${PURE_MODE}" == "true" ]]; then local exec_cmd="" for cmd in "${commands[@]}"; do if [[ -z "${exec_cmd}" ]]; then exec_cmd="${cmd}" else exec_cmd="${exec_cmd} ; ${cmd}" fi done echo '' animate_exec "${exec_cmd}" "${SYNC_MIRROR_TEXT}" if [ $? -ne 0 ]; then echo '' exit 1 fi else echo -e "\n$WORKING ${SYNC_MIRROR_TEXT}...\n" for cmd in "${commands[@]}"; do eval "${cmd}" done if [ $? -eq 0 ]; then echo -e "\n$SUCCESS $(msg "source.changeResult.success")" else echo -e "\n$FAIL $(msg "source.changeResult.fail" "${SYNC_MIRROR_TEXT}")" echo -e "\n$TIP $(msg "source.changeResult.tipTitle" "${SYNC_MIRROR_TEXT}")" echo -e "\n1. $(msg "source.changeResult.tip1")" echo -e "2. $(msg "source.changeResult.tip2" "${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}")" echo -e " $(msg "source.changeResult.tip2.1")" echo -e " $(msg "source.changeResult.tip2.2")" echo -e " $(msg "source.changeResult.tip2.3")" echo -e "3. $(msg "source.changeResult.tip3")\n" exit 1 fi fi } ## 升级软件包 function upgrade_software() { ## 跳过特殊的系统 case "${SYSTEM_JUDGMENT}" in "${SYSTEM_RHEL}" | "${SYSTEM_ORACLE}") return ;; esac local ask_text="" ## 交互确认 if [[ -z "${UPGRADE_SOFTWARE}" ]]; then UPGRADE_SOFTWARE="false" ask_text="$(msg "interaction.upgrade.skip")?" if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then echo '' interactive_select_boolean "${BOLD}${ask_text}${PLAIN}" if [[ "${_SELECT_RESULT}" == "false" ]]; then UPGRADE_SOFTWARE="true" fi else local CHOICE="$(echo -e "\n${BOLD}└─ ${ask_text} [Y/n] ${PLAIN}")" read -rp "${CHOICE}" INPUT [[ -z "${INPUT}" ]] && INPUT=Y case "${INPUT}" in [Yy] | [Yy][Ee][Ss]) ;; [Nn] | [Nn][Oo]) UPGRADE_SOFTWARE="true" ;; *) input_error "$(msg "error.defaultBehavior.noUpdate")" ;; esac fi fi if [[ "${UPGRADE_SOFTWARE}" == "false" ]]; then return fi if [[ -z "${CLEAN_CACHE}" ]]; then CLEAN_CACHE="false" ask_text="$(msg "interaction.cache.autoClean")?" if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then echo '' interactive_select_boolean "${BOLD}${ask_text}${PLAIN}" if [[ "${_SELECT_RESULT}" == "true" ]]; then CLEAN_CACHE="true" fi else local CHOICE="$(echo -e "\n${BOLD}└─ ${ask_text} [Y/n] ${PLAIN}")" read -rp "${CHOICE}" INPUT [[ -z "${INPUT}" ]] && INPUT=Y case "${INPUT}" in [Yy] | [Yy][Ee][Ss]) CLEAN_CACHE="true" ;; [Nn] | [Nn][Oo]) ;; *) input_error "$(msg "error.defaultBehavior.noClean")" ;; esac fi fi local -a commands=() case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") commands+=("apt-get upgrade -y") ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}") local package_manager="$(get_package_manager)" commands+=("${package_manager} upgrade -y") ;; "${SYSTEM_OPENSUSE}") commands+=("zypper update -y") ;; "${SYSTEM_ARCH}") commands+=("pacman -Syu --noconfirm") ;; "${SYSTEM_ALPINE}") commands+=("apk upgrade --no-cache") ;; "${SYSTEM_GENTOO}") commands+=("emerge --update --deep --with-bdeps=y --ask=n @world") ;; "${SYSTEM_NIXOS}") commands+=("nixos-rebuild switch") ;; esac if [[ "${PURE_MODE}" == "true" ]]; then local exec_cmd="" for cmd in "${commands[@]}"; do if [[ -z "${exec_cmd}" ]]; then exec_cmd="${cmd}" else exec_cmd="${exec_cmd} ; ${cmd}" fi done echo '' animate_exec "${exec_cmd}" "$(msg "work.upgradeSoftware")" else echo '' for cmd in "${commands[@]}"; do eval "${cmd}" done fi if [[ "${CLEAN_CACHE}" == "false" ]]; then return fi case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") apt-get autoremove -y >/dev/null 2>&1 apt-get clean >/dev/null 2>&1 ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}") local package_manager="$(get_package_manager)" $package_manager autoremove -y >/dev/null 2>&1 $package_manager clean packages -y >/dev/null 2>&1 ;; "${SYSTEM_OPENSUSE}") rm -rf /var/cache/zypp/* >/dev/null 2>&1 ;; "${SYSTEM_ARCH}") pacman -Scc --noconfirm >/dev/null 2>&1 ;; "${SYSTEM_ALPINE}") rm -rf /var/cache/apk/* >/dev/null 2>&1 ;; "${SYSTEM_GENTOO}") eclean-dist --deep >/dev/null 2>&1 eclean-packages --deep >/dev/null 2>&1 ;; "${SYSTEM_NIXOS}") nix-collect-garbage -d >/dev/null 2>&1 ;; esac } ############################################################################## ## 更换基于 Debian 系 Linux 发行版的软件源 function change_mirrors_Debian() { local apt_source_file=$File_AptSourceList local apt_source_content="" function write_apt_source() { if [[ -n "${apt_source_content}" ]]; then echo "${apt_source_content}" >>$apt_source_file fi apt_source_content="" # 重置内容 } ## 注释的提示语句 local deb_src_disabled_tips="## $(msg "source.comment.disabledSourceCode")" local security_source_tips="## $(msg "source.comment.securitySource")" local proposed_source_tips="## $(msg "source.comment.proposedSource")" ## one-line 格式模板 function _template_deb() { echo "${1} ${WEB_PROTOCOL}://${2}/ ${3} ${4}" } function gen_deb() { echo "$(_template_deb "deb" "${1}" "${2}" "${3}") $(_template_deb "deb-src" "${1}" "${2}" "${3}" | sed -e "s|^|# |g")" } function gen_deb_unsrc() { echo "$(_template_deb "deb" "${1}" "${2}" "${3}")" } function gen_deb_disabled() { echo "$(gen_deb "${1}" "${2}" "${3}" | sed -e "s|^|# |g")" } function gen_deb_unsrc_disabled() { echo "$(gen_deb_unsrc "${1}" "${2}" "${3}" | sed -e "s|^|# |g")" } function gen_deb_security() { echo "${security_source_tips} $(gen_deb "${1}" "${2}-security" "${3}")" } ## DEB822 格式模板 function _template_deb822() { echo "Types: ${1} URIs: ${WEB_PROTOCOL}://${2}/ Suites: ${3} Components: ${4} Signed-By: /usr/share/keyrings/${_DEB22_ARCHIVE_KEYRING:-"${SYSTEM_JUDGMENT,,}-archive-keyring.gpg"}" } function gen_deb822() { echo "$(_template_deb822 "deb" "${1}" "${2}" "${3}") $(_template_deb822 "deb-src" "${1}" "${2}" "${3}" | sed -e "s|^|# |g")" } function gen_deb822_unsrc() { echo "$(_template_deb822 "deb" "${1}" "${2}" "${3}")" } function gen_deb822_disabled() { echo "$(_template_deb822 "deb" "${1}" "${2}" "${3}" | sed -e "s|^|# |g") $(_template_deb822 "deb-src" "${1}" "${2}" "${3}" | sed -e "s|^|# |g")" } function gen_deb822_security() { echo "${security_source_tips} $(gen_deb822 "${1}" "${2}-security" "${3}")" } ## 获取 Debian 软件源相关信息 function _template_get_debian_info() { local data1="${1}" local data2="${2}" local mode="${3:-main}" local codename="${4}" local result="${data2}" case "${mode}" in "security") local -a majors=(8 9 10) local -a codenames=("jessie" "stretch" "buster") ;; *) local -a majors=(8 9 10 11) local -a codenames=("jessie" "stretch" "buster" "bullseye") ;; esac if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_DEBIAN}" ]]; then for version in "${majors[@]}"; do if [[ "${SYSTEM_VERSION_ID_MAJOR}" == "${version}" ]]; then result="${data1}" break fi done else for name in "${codenames[@]}"; do if [[ "${codename}" == "${name}" ]]; then result="${data1}" break fi done fi echo "${result}" } function get_debian_official_source() { # 注:使用官方源时仓库分支固定为 debian,应同此方法一起使用 _template_get_debian_info "archive.debian.org" "deb.debian.org" "main" "${1}" } function get_debian_source_branch() { _template_get_debian_info "debian-archive/debian" "debian" "main" "${1}" } function get_debian_repo_components() { _template_get_debian_info "main contrib non-free" "main contrib non-free non-free-firmware" "main" "${1}" } function get_debian_official_source_security_host() { # 注:使用官方源时仓库分支固定为 debian-security,应同此方法一起使用 _template_get_debian_info "archive.debian.org" "security.debian.org" "security" "${1}" } function get_debian_source_security_branch() { _template_get_debian_info "debian-archive/debian-security" "debian-security" "security" "${1}" } ## Debian 软件源模板 # debian-backports: https://ftp.debian.org/debian/dists # debian-security: https://security.debian.org/debian-security/dists function _template_gen_debian_source() { local mode="${4:-main}" local type="${5:-deb}" local result="" case "${mode}" in "security") case "${2}" in "forky" | "trixie" | "bookworm" | "bullseye" | "oldoldstable" | "oldstable" | "stable" | "testing") if [[ "${type}" == "deb822" ]]; then result="$(gen_deb822_security "${1}" "${2}" "${3}")" else result="$(gen_deb_security "${1}" "${2}" "${3}")" fi ;; "jessie" | "stretch" | "buster") if [[ "${type}" == "deb822" ]]; then result="${security_source_tips} $(gen_deb822 "${1}" "${2}" "${3}")" else result="${security_source_tips} $(gen_deb "${1}" "${2}" "${3}")" fi ;; *) result="" ;; esac ;; *) case "${2}" in "forky" | "trixie" | "bookworm" | "stable" | "oldstable" | "testing") if [[ "${type}" == "deb822" ]]; then result="${deb_src_disabled_tips} $(gen_deb822 "${1}" "${2} ${2}-updates ${2}-backports" "${3}")" else result="$(gen_deb "${1}" "${2}" "${3}") $(gen_deb "${1}" "${2}-updates" "${3}") $(gen_deb "${1}" "${2}-backports" "${3}")" fi ;; *) if [[ "${type}" == "deb822" ]]; then result="${deb_src_disabled_tips} $(gen_deb822 "${1}" "${2} ${2}-updates" "${3}")" else result="$(gen_deb "${1}" "${2}" "${3}") $(gen_deb "${1}" "${2}-updates" "${3}")" fi ;; esac ;; esac echo "${result}" } function gen_debian_deb() { _template_gen_debian_source "${1}" "${2}" "${3}" "main" "deb" } function gen_debian_deb_security() { _template_gen_debian_source "${1}" "${2}" "${3}" "security" "deb" } function gen_debian_deb822() { _template_gen_debian_source "${1}" "${2}" "${3}" "main" "deb822" } function gen_debian_deb822_security() { _template_gen_debian_source "${1}" "${2}" "${3}" "security" "deb822" } ## Ubuntu 软件源模板 function gen_ubuntu_deb() { echo "$(gen_deb "${1}" "${2}" "${3}") $(gen_deb "${1}" "${2}-updates" "${3}") $(gen_deb "${1}" "${2}-backports" "${3}") ${proposed_source_tips} $(gen_deb_disabled "${1}" "${2}-proposed" "${3}")" } function gen_ubuntu_deb822() { echo "${deb_src_disabled_tips} $(gen_deb822 "${1}" "${2} ${2}-updates ${2}-backports" "${3}") ${proposed_source_tips} $(gen_deb822_disabled "${1}" "${2}-proposed" "${3}")" } ## 使用官方源 if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then case "${SYSTEM_JUDGMENT}" in "${SYSTEM_UBUNTU}" | "${SYSTEM_ZORIN}") if [[ "${DEVICE_ARCH_RAW}" == "x86_64" || "${DEVICE_ARCH_RAW}" == *i?86* ]]; then SOURCE="archive.ubuntu.com" else SOURCE="ports.ubuntu.com" fi ;; "${SYSTEM_KALI}") SOURCE="http.kali.org" ;; "${SYSTEM_DEEPIN}") SOURCE="community-packages.deepin.com" ;; esac fi # 注:SOURCE_ SOURCE__BRANCH 系列变量默认为空值,仅在自定义(使用相关命令选项)时提供,需注意逻辑顺序 local repo_components="" # 软件源仓库区域 local source_address="${SOURCE}/${SOURCE_BRANCH}" # 软件源地址 local source_security_host="${SOURCE}" local source_security_branch="${SOURCE_BRANCH}" local source_security_address="" case "${SYSTEM_JUDGMENT}" in "${SYSTEM_DEBIAN}") repo_components="$(get_debian_repo_components "${SYSTEM_VERSION_CODENAME}")" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="$(get_debian_official_source "${SYSTEM_VERSION_CODENAME}")" SOURCE_BRANCH="debian" source_address="${SOURCE}/${SOURCE_BRANCH}" fi # 安全更新源 source_security_branch="$(get_debian_source_security_branch "${SYSTEM_VERSION_CODENAME}")" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then source_security_host="$(get_debian_official_source_security_host "${SYSTEM_VERSION_CODENAME}")" source_security_branch="debian-security" fi source_security_address="${SOURCE_SECURITY:-${source_security_host}}/${SOURCE_SECURITY_BRANCH:-${source_security_branch}}" ## DEB822 / one-line if [[ "${USE_DEB822_FORMAT}" == "true" ]]; then apt_source_file="${File_DebianSources}" if [[ "${SYSTEM_VERSION_CODENAME}" != "sid" ]]; then apt_source_content="$(gen_debian_deb822 "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}") $(gen_debian_deb822_security "${source_security_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}")" else apt_source_content="$(gen_debian_deb822 "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}")" fi else apt_source_file="${File_AptSourceList}" if [[ "${SYSTEM_VERSION_CODENAME}" != "sid" ]]; then apt_source_content="${deb_src_disabled_tips} $(gen_debian_deb "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}") $(gen_debian_deb_security "${source_security_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}")" else apt_source_content="${deb_src_disabled_tips} $(gen_deb "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}")" fi fi write_apt_source ;; "${SYSTEM_UBUNTU}" | "${SYSTEM_ZORIN}") repo_components="main restricted universe multiverse" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then if [[ "${DEVICE_ARCH_RAW}" == "x86_64" || "${DEVICE_ARCH_RAW}" == *i?86* ]]; then SOURCE="archive.ubuntu.com" SOURCE_BRANCH="ubuntu" source_address="${SOURCE}/${SOURCE_BRANCH}" else SOURCE="ports.ubuntu.com" SOURCE_BRANCH="" # 官方源默认无分支(注:有 ubuntu-ports 重定向) source_address="${SOURCE}" fi fi # 安全更新源 source_security_address="${SOURCE_SECURITY:-${source_security_host}}/${SOURCE_SECURITY_BRANCH:-${source_security_branch}}" ## DEB822 / one-line if [[ "${USE_DEB822_FORMAT}" == "true" ]]; then apt_source_file="${File_UbuntuSources}" apt_source_content="$(gen_ubuntu_deb822 "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}") $(gen_deb822_security "${source_security_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}")" else apt_source_file="${File_AptSourceList}" apt_source_content="${deb_src_disabled_tips} $(gen_ubuntu_deb "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}") $(gen_deb_security "${source_security_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}")" fi write_apt_source ;; "${SYSTEM_KALI}") repo_components="main contrib non-free non-free-firmware" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="http.kali.org" SOURCE_BRANCH="" # 官方源无分支 source_address="${SOURCE}" fi apt_source_content="${deb_src_disabled_tips} $(gen_deb "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}")" write_apt_source ;; "${SYSTEM_DEEPIN}") if [[ "${SYSTEM_VERSION_ID_MAJOR}" == "25" ]]; then repo_components="main commercial community" else repo_components="main contrib non-free" fi if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="community-packages.deepin.com" SOURCE_BRANCH="deepin" source_address="${SOURCE}/${SOURCE_BRANCH}" fi apt_source_content="${deb_src_disabled_tips} $(gen_deb "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}")" write_apt_source ;; "${SYSTEM_LINUX_MINT}") # 专用源 repo_components="main upstream import backport" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="packages.linuxmint.com" SOURCE_BRANCH="" # 官方源无分支 source_address="${SOURCE}" fi apt_source_file="${File_LinuxMintSourceList}" apt_source_content="${deb_src_disabled_tips} $(gen_deb_unsrc "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}") " # 注:此处空行用于隔开两种软件源内容 write_apt_source # 底层系统软件源 local base_system_branch base_system_codename if [[ "${SYSTEM_NAME}" == *"LMDE"* ]]; then ## Debian 版(LMDE) base_system_codename="$(get_os_release_value DEBIAN_CODENAME)" [[ -z "${base_system_codename}" ]] && base_system_codename="bookworm" base_system_branch="$(get_debian_source_branch "${base_system_codename}")" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="$(get_debian_official_source "${base_system_codename}")" base_system_branch="debian" fi repo_components="$(get_debian_repo_components "${base_system_codename}")" source_address="${SOURCE_BASE_SYSTEM:-${SOURCE}}/${SOURCE_BASE_SYSTEM_BRANCH:-${base_system_branch}}" # 安全更新源 source_security_branch="$(get_debian_source_security_branch "${base_system_codename}")" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then source_security_host="$(get_debian_official_source_security_host "${base_system_codename}")" source_security_branch="debian-security" fi source_security_address="${SOURCE_SECURITY:-${SOURCE_BASE_SYSTEM:-${source_security_host}}}/${SOURCE_SECURITY_BRANCH:-${source_security_branch}}" # 写入源文件 apt_source_file="${File_LinuxMintSourceList}" apt_source_content="$(gen_debian_deb "${source_address}" "${base_system_codename}" "${repo_components}") $(gen_debian_deb_security "${source_security_address}" "${base_system_codename}" "${repo_components}")" write_apt_source else ## Ubuntu 版 base_system_codename="$(get_os_release_value UBUNTU_CODENAME)" [[ -z "${base_system_codename}" ]] && base_system_codename="noble" if [[ "${DEVICE_ARCH_RAW}" == "x86_64" || "${DEVICE_ARCH_RAW}" == *i?86* ]]; then base_system_branch="ubuntu" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="archive.ubuntu.com" fi else base_system_branch="ubuntu-ports" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="ports.ubuntu.com" fi fi repo_components="main restricted universe multiverse" source_address="${SOURCE_BASE_SYSTEM:-${SOURCE}}/${SOURCE_BASE_SYSTEM_BRANCH:-${base_system_branch}}" # 安全更新源 source_security_address="${SOURCE_SECURITY:-${SOURCE_BASE_SYSTEM:-${source_security_host}}}/${SOURCE_BASE_SYSTEM_BRANCH:-${base_system_branch}}" # 写入源文件 apt_source_file="${File_LinuxMintSourceList}" apt_source_content="$(gen_ubuntu_deb "${source_address}" "${base_system_codename}" "${repo_components}") $(gen_deb_security "${source_security_address}" "${base_system_codename}" "${repo_components}")" write_apt_source fi ;; "${SYSTEM_RASPBERRY_PI_OS}") # 专用源 repo_components="main" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="archive.raspberrypi.org" SOURCE_BRANCH="debian" source_address="${SOURCE}/${SOURCE_BRANCH}" fi apt_source_file="${File_RaspberryPiSourceList}" apt_source_content="${deb_src_disabled_tips} $(gen_deb "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}")" write_apt_source # 底层系统软件源(注:64位系统为 Debian 官方仓库,32位为 Raspbian 仓库) local base_system_branch base_system_codename case "${DEVICE_ARCH_RAW}" in x86_64 | aarch64) ## Debian 版 base_system_codename="${SYSTEM_VERSION_CODENAME}" base_system_branch="$(get_debian_source_branch "${base_system_codename}")" repo_components="$(get_debian_repo_components "${base_system_codename}")" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="$(get_debian_official_source "${base_system_codename}")" base_system_branch="debian" fi source_address="${SOURCE_BASE_SYSTEM:-${SOURCE}}/${SOURCE_BASE_SYSTEM_BRANCH:-${base_system_branch}}" # 安全更新源 source_security_branch="$(get_debian_source_security_branch "${base_system_codename}")" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then source_security_host="$(get_debian_official_source_security_host "${base_system_codename}")" source_security_branch="debian-security" fi source_security_address="${SOURCE_SECURITY:-${SOURCE_BASE_SYSTEM:-${source_security_host}}}/${SOURCE_SECURITY_BRANCH:-${source_security_branch}}" # 写入源文件 apt_source_file="${File_AptSourceList}" apt_source_content="${deb_src_disabled_tips} $(gen_debian_deb "${source_address}" "${base_system_codename}" "${repo_components}") $(gen_debian_deb_security "${source_security_address}" "${base_system_codename}" "${repo_components}")" write_apt_source ;; *) ## Raspbian 版 base_system_branch="raspbian" base_system_codename="${SYSTEM_VERSION_CODENAME}" repo_components="main contrib non-free rpi" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="raspbian.raspberrypi.org" source_address="${SOURCE_BASE_SYSTEM:-${SOURCE}}/${SOURCE_BASE_SYSTEM_BRANCH:-${base_system_branch}}" else source_address="${SOURCE_BASE_SYSTEM:-${SOURCE}}/${SOURCE_BASE_SYSTEM_BRANCH:-${base_system_branch}}/raspbian" fi # 写入源文件 apt_source_file="${File_AptSourceList}" apt_source_content="${deb_src_disabled_tips} $(gen_deb "${source_address}" "${base_system_codename}" "${repo_components}")" # multiarch 源 if [[ "${DEVICE_ARCH_RAW}" == "armv7l" && "${USE_OFFICIAL_SOURCE}" != "true" ]]; then source_address="${SOURCE_BASE_SYSTEM:-${SOURCE}}/${SOURCE_BASE_SYSTEM_BRANCH:-${base_system_branch}}" apt_source_content="${apt_source_content} ## multiarch # deb [arch=arm64] ${WEB_PROTOCOL}://${source_address}/multiarch/ ${base_system_codename} ${repo_components}" fi write_apt_source ;; esac ;; esac ## 处理其它衍生操作系统的专用源 # Armbian if [ -f "${File_ArmbianRelease}" ]; then apt_source_file="${File_ArmbianSourceList}" apt_source_content="deb [signed-by=/usr/share/keyrings/armbian.gpg] ${WEB_PROTOCOL}://${SOURCE}/armbian ${SYSTEM_VERSION_CODENAME} main ${SYSTEM_VERSION_CODENAME}-utils ${SYSTEM_VERSION_CODENAME}-desktop" write_apt_source fi # Proxmox VE if [ -f "${File_ProxmoxVersion}" ]; then if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then source_address="download.proxmox.com" else source_address="${SOURCE}/proxmox" fi if [[ "${USE_DEB822_FORMAT}" == "true" ]]; then _DEB22_ARCHIVE_KEYRING="proxmox-archive-keyring.gpg" apt_source_file="${File_ProxmoxSources}" apt_source_content="$(gen_deb822_unsrc "${source_address}/debian/pve" "${SYSTEM_VERSION_CODENAME}" "pve-no-subscription")" write_apt_source _DEB22_ARCHIVE_KEYRING="" # Ceph 仓库 if [ -f "${File_ProxmoxCephSources}" ]; then local ceph_codename="$(ceph -v | grep ceph | awk '{print $(NF-1)}')" apt_source_file="${File_ProxmoxCephSources}" apt_source_content="$(gen_deb822_unsrc "${source_address}/debian/ceph-${ceph_codename}" "${SYSTEM_VERSION_CODENAME}" "no-subscription")" write_apt_source fi else apt_source_file="${File_ProxmoxSourceList}" apt_source_content="$(gen_deb_unsrc "${source_address}/debian/pve" "${SYSTEM_VERSION_CODENAME}" "pve-no-subscription")" write_apt_source # Ceph 仓库 if [ -f "${File_ProxmoxCephSourceList}" ]; then local ceph_codename="$(ceph -v | grep ceph | awk '{print $(NF-1)}')" apt_source_file="${File_ProxmoxCephSourceList}" apt_source_content="$(gen_deb_unsrc "${source_address}/debian/ceph-${ceph_codename}" "${SYSTEM_VERSION_CODENAME}" "no-subscription")" write_apt_source fi fi # CT Templates if [ -s /usr/share/perl5/PVE/APLInfo.pm ]; then sed -e "s|url => [\"']https\?://[^/]*/images[\"']|url => \"${WEB_PROTOCOL}://${source_address}/images\"|g" \ -i \ /usr/share/perl5/PVE/APLInfo.pm fi fi } ## 更换基于 RedHat 系 Linux 发行版的软件源 function change_mirrors_RedHat() { ## 仅 EPEL 模式 if [[ "${ONLY_EPEL}" == "true" ]]; then change_mirrors_or_install_EPEL # EPEL 附加软件包 return fi ## 生成 repo 源文件 case "${SYSTEM_JUDGMENT}" in "${SYSTEM_RHEL}") case "${SYSTEM_VERSION_ID_MAJOR}" in 7 | 8) gen_repo_files_CentOS "${SYSTEM_VERSION_ID_MAJOR}" ;; *) gen_repo_files_CentOSStream "${SYSTEM_VERSION_ID_MAJOR}" ;; esac ;; "${SYSTEM_CENTOS}") gen_repo_files_CentOS "${SYSTEM_VERSION_ID_MAJOR}" ;; "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ORACLE}") gen_repo_files_CentOSStream "${SYSTEM_VERSION_ID_MAJOR}" ;; "${SYSTEM_ROCKY}") gen_repo_files_RockyLinux "${SYSTEM_VERSION_ID_MAJOR}" ;; "${SYSTEM_ALMALINUX}") gen_repo_files_AlmaLinux "${SYSTEM_VERSION_ID_MAJOR}" ;; "${SYSTEM_FEDORA}") gen_repo_files_Fedora "${SYSTEM_VERSION_ID}" ;; "${SYSTEM_OPENCLOUDOS}") gen_repo_files_OpenCloudOS "${SYSTEM_VERSION_ID}" ;; "${SYSTEM_ANOLISOS}") gen_repo_files_AnolisOS "${SYSTEM_VERSION_ID}" ;; esac ## 使用官方源 if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_CENTOS}" ]]; then SOURCE="vault.centos.org" SOURCE_BRANCH="centos" else case "${SYSTEM_JUDGMENT}" in "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ORACLE}") if [[ "${SYSTEM_VERSION_ID_MAJOR}" == 8 ]]; then SOURCE="vault.centos.org" SOURCE_BRANCH="centos" else change_mirrors_or_install_EPEL # EPEL 附加软件包 return fi ;; *) change_mirrors_or_install_EPEL # EPEL 附加软件包 return ;; esac fi fi ## 修改源 cd $Dir_YumRepos case "${SYSTEM_JUDGMENT}" in "${SYSTEM_RHEL}") case "${SYSTEM_VERSION_ID_MAJOR}" in 7 | 8) sed -e "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" \ -e "s|^mirrorlist=|#mirrorlist=|g" \ -i \ CentOS-* case "${SYSTEM_VERSION_ID_MAJOR}" in 8) sed -e "s|mirror.centos.org/\$contentdir|mirror.centos.org/${SOURCE_BRANCH}|g" \ -e "s|\$releasever|8.5.2111|g" \ -i \ CentOS-* sed -e "s|vault.centos.org/\$contentdir|vault.centos.org/${SOURCE_VAULT_BRANCH:-"centos-vault"}|g" \ -i \ CentOS-Linux-Sources.repo ;; 7) sed -e "s|mirror.centos.org/centos|mirror.centos.org/${SOURCE_BRANCH}|g" \ -e "s|\$releasever|7.9.2009|g" \ -i \ CentOS-* sed -e "s|vault.centos.org/centos|vault.centos.org/${SOURCE_VAULT_BRANCH:-"centos-vault"}|g" \ -i \ CentOS-Sources.repo ;; esac sed -e "s|mirror.centos.org|${SOURCE}|g" \ -e "s|vault.centos.org|${SOURCE_VAULT:-${SOURCE}}|g" \ -i \ CentOS-* ;; *) sed -e "s|^#baseurl=https|baseurl=${WEB_PROTOCOL}|g" \ -e "s|^metalink=|#metalink=|g" \ -e "s|mirror.stream.centos.org|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ centos.repo \ centos-addons.repo # 禁用 GPG 签名检查 sed -e "s|gpgcheck=1|gpgcheck=0|g" \ -i \ centos.repo \ centos-addons.repo ;; esac ;; "${SYSTEM_CENTOS}") sed -e "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" \ -e "s|^mirrorlist=|#mirrorlist=|g" \ -i \ CentOS-* if [[ "${DEVICE_ARCH_RAW}" == "x86_64" ]]; then SOURCE_BRANCH="centos-vault" else SOURCE_BRANCH="centos-altarch" fi case "${SYSTEM_VERSION_ID_MAJOR}" in 8) # 最终版本为 8.5.2011(2022-02) sed -e "s|mirror.centos.org/\$contentdir|mirror.centos.org/${SOURCE_BRANCH}|g" \ -e "s|\$releasever|8.5.2111|g" \ -i \ CentOS-* sed -e "s|vault.centos.org/\$contentdir|vault.centos.org/${SOURCE_VAULT_BRANCH:-"centos-vault"}|g" \ -i \ CentOS-Linux-Sources.repo ;; 7) # 最终版本为 7.9.2009(2024-07) sed -e "s|mirror.centos.org/centos|mirror.centos.org/${SOURCE_BRANCH}|g" \ -e "s|\$releasever|7.9.2009|g" \ -i \ CentOS-* sed -e "s|vault.centos.org/centos|vault.centos.org/${SOURCE_VAULT_BRANCH:-"centos-vault"}|g" \ -i \ CentOS-Sources.repo ;; esac sed -e "s|mirror.centos.org|${SOURCE}|g" \ -e "s|vault.centos.org|${SOURCE_VAULT:-${SOURCE}}|g" \ -i \ CentOS-* ;; "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ORACLE}") case "${SYSTEM_VERSION_ID_MAJOR}" in 9 | 10) sed -e "s|^#baseurl=https|baseurl=${WEB_PROTOCOL}|g" \ -e "s|^metalink=|#metalink=|g" \ -e "s|mirror.stream.centos.org|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ centos.repo \ centos-addons.repo if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_ORACLE}" ]]; then # 禁用 GPG 签名检查 sed -e "s|gpgcheck=1|gpgcheck=0|g" \ -i \ centos.repo \ centos-addons.repo fi ;; 8) sed -e "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" \ -e "s|^mirrorlist=|#mirrorlist=|g" \ -e "s|mirror.centos.org/\$contentdir|${SOURCE}/${SOURCE_BRANCH}|g" \ -e "s|vault.centos.org/\$contentdir|${SOURCE_VAULT:-${SOURCE}}/${SOURCE_VAULT_BRANCH:-"centos-vault"}|g" \ -i \ CentOS-Stream-* if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_ORACLE}" ]]; then # 禁用 GPG 签名检查 sed -e "s|gpgcheck=1|gpgcheck=0|g" \ -i \ CentOS-Stream-* fi ;; esac ;; "${SYSTEM_ROCKY}") case "${SYSTEM_VERSION_ID_MAJOR}" in 9 | 10) sed -e "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" \ -e "s|^mirrorlist=|#mirrorlist=|g" \ -e "s|dl.rockylinux.org/\$contentdir|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ rocky.repo \ rocky-addons.repo \ rocky-devel.repo \ rocky-extras.repo ;; 8) sed -e "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" \ -e "s|^mirrorlist=|#mirrorlist=|g" \ -e "s|dl.rockylinux.org/\$contentdir|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ Rocky-* ;; esac ;; "${SYSTEM_ALMALINUX}") case "${SYSTEM_VERSION_ID_MAJOR}" in 10) sed -e "s|^# baseurl=https|baseurl=${WEB_PROTOCOL}|g" \ -e "s|^mirrorlist=|#mirrorlist=|g" \ -e "s|vault.almalinux.org|${SOURCE_VAULT:-${SOURCE}}/${SOURCE_VAULT_BRANCH:-"almalinux-vault"}|g" \ -e "s|repo.almalinux.org/almalinux|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ almalinux-appstream.repo \ almalinux-baseos.repo \ almalinux-crb.repo \ almalinux-extras.repo \ almalinux-highavailability.repo \ almalinux-nfv.repo \ almalinux-rt.repo \ almalinux-saphana.repo \ almalinux-sap.repo ;; 9) sed -e "s|^# baseurl=https|baseurl=${WEB_PROTOCOL}|g" \ -e "s|^mirrorlist=|#mirrorlist=|g" \ -e "s|repo.almalinux.org/vault|${SOURCE_VAULT:-${SOURCE}}/${SOURCE_VAULT_BRANCH:-"almalinux-vault"}|g" \ -e "s|repo.almalinux.org/almalinux|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ almalinux-appstream.repo \ almalinux-baseos.repo \ almalinux-crb.repo \ almalinux-extras.repo \ almalinux-highavailability.repo \ almalinux-nfv.repo \ almalinux-plus.repo \ almalinux-resilientstorage.repo \ almalinux-rt.repo \ almalinux-sap.repo \ almalinux-saphana.repo ;; 8) sed -e "s|^mirrorlist=|#mirrorlist=|g" \ -e "s|^# baseurl=https|baseurl=${WEB_PROTOCOL}|g" \ -e "s|repo.almalinux.org/vault|${SOURCE_VAULT:-${SOURCE}}/${SOURCE_VAULT_BRANCH:-"almalinux-vault"}|g" \ -e "s|repo.almalinux.org/almalinux|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ almalinux-ha.repo \ almalinux-nfv.repo \ almalinux-plus.repo \ almalinux-powertools.repo \ almalinux-resilientstorage.repo \ almalinux-rt.repo \ almalinux-sap.repo \ almalinux-saphana.repo \ almalinux.repo ;; esac ;; "${SYSTEM_FEDORA}") # 自 Fedora 39 起不再使用 modular 仓库 local fedora_repo_files="fedora.repo fedora-updates.repo fedora-updates-testing.repo" if [[ "${SYSTEM_VERSION_ID}" -lt 39 ]]; then fedora_repo_files="${fedora_repo_files} fedora-modular.repo fedora-updates-modular.repo fedora-updates-testing-modular.repo" fi sed -e "s|^metalink=|#metalink=|g" \ -e "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" \ -e "s|download.example/pub/fedora/linux|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ $fedora_repo_files ;; "${SYSTEM_OPENCLOUDOS}") case "${SYSTEM_VERSION_ID_MAJOR}" in 8) sed -e "s|^baseurl=https|baseurl=${WEB_PROTOCOL}|g" \ -e "s|mirrors.opencloudos.tech/opencloudos|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ OpenCloudOS-Debuginfo.repo \ OpenCloudOS.repo \ OpenCloudOS-Sources.repo ;; esac ;; "${SYSTEM_ANOLISOS}") # Anolis OS 仓库配置特殊,baseurl 同时使用 http 和 https 协议,gpgkey 同时使用软件源仓库远程路径和本地路径 case "${SYSTEM_VERSION_ID_MAJOR}" in 8) sed -e "s|http\(s\)\?://mirrors.openanolis.cn/anolis|${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ AnolisOS-* ;; esac ;; esac ## 重置使用官方源时定义的变量 if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_CENTOS}" ]]; then SOURCE="" SOURCE_BRANCH="" else case "${SYSTEM_JUDGMENT}" in "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ORACLE}") if [[ "${SYSTEM_VERSION_ID_MAJOR}" == 8 ]]; then SOURCE="" SOURCE_BRANCH="" fi ;; esac fi fi change_mirrors_or_install_EPEL # EPEL 附加软件包 } ## 更换 openEuler 软件源 function change_mirrors_openEuler() { ## 生成 repo 源文件 gen_repo_files_openEuler ## 使用官方源 [[ "${USE_OFFICIAL_SOURCE}" == "true" ]] && return ## 修改源 cd $Dir_YumRepos sed -e "s|^baseurl=http|baseurl=${WEB_PROTOCOL}|g" \ -e "s|repo.openeuler.org|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ openEuler.repo } ## 更换 OpenCloudOS 软件源 function change_mirrors_OpenCloudOS() { ## 生成 repo 源文件 gen_repo_files_OpenCloudOS "${SYSTEM_VERSION_ID}" ## 使用官方源 [[ "${USE_OFFICIAL_SOURCE}" == "true" ]] && return ## 修改源 cd $Dir_YumRepos if [[ "${SYSTEM_VERSION_ID}" == 23 ]]; then sed -e "s|^baseurl=https|baseurl=${WEB_PROTOCOL}|g" \ -e "s|mirrors.opencloudos.tech/opencloudos-stream|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ OpenCloudOS-Stream.repo else sed -e "s|^baseurl=https|baseurl=${WEB_PROTOCOL}|g" \ -e "s|mirrors.opencloudos.tech/opencloudos|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ OpenCloudOS.repo fi } ## 更换 openKylin 软件源 function change_mirrors_openKylin() { local deb_src_disabled_tips="## $(msg "source.comment.disabledSourceCode")" function gen_deb() { echo "deb ${WEB_PROTOCOL}://${1}/ ${2} ${3} # deb-src ${WEB_PROTOCOL}://${1}/ ${2} ${3} deb ${WEB_PROTOCOL}://${1}/ ${2}-security ${3} # deb-src ${WEB_PROTOCOL}://${1}/ ${2}-security ${3} deb ${WEB_PROTOCOL}://${1}/ ${2}-updates ${3} # deb-src ${WEB_PROTOCOL}://${1}/ ${2}-updates ${3}" } ## 使用官方源 if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="archive.build.openkylin.top" fi local repo_components="main cross pty" # 仓库区域 local source_address="${SOURCE}/${SOURCE_BRANCH}" echo "${deb_src_disabled_tips} $(gen_deb "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}")" >>$File_AptSourceList } ## 更换 Anolis OS 软件源 function change_mirrors_AnolisOS() { ## 生成 repo 源文件 gen_repo_files_AnolisOS "${SYSTEM_VERSION_ID}" ## 使用官方源 [[ "${USE_OFFICIAL_SOURCE}" == "true" ]] && return ## 修改源 cd $Dir_YumRepos # Anolis OS 仓库配置特殊,baseurl 同时使用 http 和 https 协议,gpgkey 同时使用软件源仓库远程路径和本地路径 case "${SYSTEM_VERSION_ID_MAJOR}" in 23) sed -e "s|http\(s\)\?://mirrors.openanolis.cn/anolis|${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ AnolisOS-Debuginfo.repo \ AnolisOS.repo \ AnolisOS-Source.repo ;; 8) sed -e "s|http\(s\)\?://mirrors.openanolis.cn/anolis|${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ AnolisOS-* ;; esac } ## 更换 openSUSE 软件源 function change_mirrors_openSUSE() { ## 禁用 RIS zypper remove -y openSUSE-repos-* >/dev/null 2>&1 ## 生成 repo 源文件 case "${SYSTEM_ID}" in "opensuse-leap") gen_repo_files_openSUSE "leap" "${SYSTEM_VERSION_ID}" ;; "opensuse-tumbleweed") gen_repo_files_openSUSE "tumbleweed" ;; esac ## 使用官方源 [[ "${USE_OFFICIAL_SOURCE}" == "true" ]] && return ## 修改源 cd $Dir_ZYppRepos local -a opensuse_repo_files=() case "${SYSTEM_ID}" in opensuse-leap) case "${SYSTEM_VERSION_ID_MAJOR}" in 16) opensuse_repo_files=( "openSUSE:repo-non-oss-debug.repo" "openSUSE:repo-non-oss.repo" "openSUSE:repo-oss-debug.repo" "openSUSE:repo-oss.repo" "openSUSE:repo-oss-source.repo" ) ;; 15) case "${SYSTEM_VERSION_ID_MINOR}" in [0-2]) opensuse_repo_files=( "repo-debug-non-oss.repo" "repo-debug.repo" "repo-debug-update-non-oss.repo" "repo-debug-update.repo" "repo-non-oss.repo" "repo-oss.repo" "repo-source-non-oss.repo" "repo-source.repo" "repo-update-non-oss.repo" "repo-update.repo" ) ;; *) opensuse_repo_files=( "repo-backports-debug-update.repo" "repo-backports-update.repo" "repo-debug-non-oss.repo" "repo-debug.repo" "repo-debug-update-non-oss.repo" "repo-debug-update.repo" "repo-non-oss.repo" "repo-openh264.repo" "repo-oss.repo" "repo-sle-debug-update.repo" "repo-sle-update.repo" "repo-source.repo" "repo-update-non-oss.repo" "repo-update.repo" ) ;; esac ;; esac ;; opensuse-tumbleweed) opensuse_repo_files=( "repo-debug.repo" "repo-non-oss.repo" "repo-openh264.repo" "repo-oss.repo" "repo-source.repo" "repo-update.repo" ) ;; esac sed -e "s#\(baseurl\|gpgkey\)=http://\(cdn\|download\)\.opensuse\.org/\(distribution\|update\|tumbleweed\|factory\|slowroll\|history\)/#\1=${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}/\3/#g" \ -i \ "${opensuse_repo_files[@]}" } ## 更换 Arch Linux 系 Linux 发行版的软件源 function change_mirrors_ArchLinux() { case "${SYSTEM_JUDGMENT}" in "${SYSTEM_ARCH}") ## 修改源 case "${SOURCE_BRANCH}" in "archlinuxarm") [[ "${USE_OFFICIAL_SOURCE}" == "true" ]] && SOURCE="mirror.archlinuxarm.org" ## 使用官方源 echo "Server = ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}/\$arch/\$repo" >>$File_PacmanMirrorList ;; *) [[ "${USE_OFFICIAL_SOURCE}" == "true" ]] && SOURCE="mirror.pkgbuild.com" ## 使用官方源 echo "Server = ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}/\$repo/os/\$arch" >>$File_PacmanMirrorList ;; esac # EndeavourOS if [[ "${SYSTEM_NAME}" == *"EndeavourOS"* ]] && [[ -f "${File_PacmanEndeavourOSMirrorList}" ]]; then [[ "${USE_OFFICIAL_SOURCE}" == "true" ]] && SOURCE="mirror.alpix.eu" ## 使用官方源 echo "Server = ${WEB_PROTOCOL}://${SOURCE}/endeavouros/repo/\$repo/\$arch" >>$File_PacmanEndeavourOSMirrorList fi ;; "${SYSTEM_MANJARO}") ## 使用官方源 [[ "${USE_OFFICIAL_SOURCE}" == "true" ]] && SOURCE="mirrors2.manjaro.org" ## 修改源 echo "Server = ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}/stable/\$repo/\$arch" >>$File_PacmanMirrorList ;; esac # if [[ "${USE_ARCHLINUXCN_SOURCE}" == "true" ]]; then # # /etc/pacman.conf # [[ "${USE_OFFICIAL_SOURCE}" == "true" ]] && SOURCE="repo.archlinuxcn.org" ## 使用官方源 # echo -e "[archlinuxcn]\nServer = ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}/\$arch" >>/etc/pacman.conf # fi } ## 更换 Alpine Linux 软件源 function change_mirrors_Alpine() { ## 使用官方源 if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="dl-cdn.alpinelinux.org" fi local version_name echo "${SYSTEM_PRETTY_NAME}" | grep " edge" -q if [ $? -eq 0 ]; then version_name="edge" else version_name="v${SYSTEM_VERSION_ID%.*}" fi ## 修改源 echo "${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}/${version_name}/main ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}/${version_name}/community" >>$File_AlpineRepositories } ## 更换 Gentoo 软件源 function change_mirrors_Gentoo() { ## 使用官方源 if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then grep -Eq "^GENTOO_MIRRORS=" $File_GentooMakeConf if [ $? -eq 0 ]; then sed -e "/^GENTOO_MIRRORS=/d" \ -i \ $File_GentooMakeConf fi [ -f "${File_GentooReposConf}" ] && rm -rf $File_GentooReposConf return fi ## 修改源 grep -Eq "^GENTOO_MIRRORS=" $File_GentooMakeConf if [ $? -eq 0 ]; then sed -e "s|^GENTOO_MIRRORS=.*|GENTOO_MIRRORS=\"${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}\"|g" \ -i \ $File_GentooMakeConf else echo -e "\nGENTOO_MIRRORS=\"${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}\"" >>$File_GentooMakeConf fi echo "[DEFAULT] main-repo = gentoo [gentoo] location = /usr/portage sync-type = rsync sync-uri = rsync://${SOURCE_PORTAGE:-${SOURCE}}/${SOURCE_PORTAGE_BRANCH:-"gentoo-portage"} auto-sync = yes" >$File_GentooReposConf } ## 更换 NixOS 软件源 function change_mirrors_NixOS() { local binary_cache_source channel_source if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then binary_cache_source="https://cache.nixos.org/" channel_source="https://nixos.org/channels" else binary_cache_source="${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}/store https://cache.nixos.org/" channel_source="${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}" fi # binary cache sed -e "s|^substituters.*|substituters = ${binary_cache_source}|g" \ -i \ $File_NixConf # channel nix-channel --add "${channel_source}/nixos-${SYSTEM_VERSION_ID}" nixos nix-channel --update >/dev/null 2>&1 } ## EPEL (Extra Packages for Enterprise Linux) 附加软件包 - 安装或更换软件源 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 "${SYSTEM_REDHAT}") if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_FEDORA}" ]]; then return else epel_version="${SYSTEM_VERSION_ID_MAJOR}" fi ;; *) return ;; esac ## EPEL 7 if [[ "${epel_version}" == "7" ]]; then [ -z "${SOURCE_EPEL_BRANCH}" ] && SOURCE_EPEL_BRANCH="epel-archive" [[ "${PURE_MODE}" != "true" ]] && echo -e "\n$WARN $(msg "warn.EPEL7")" [[ "${PURE_MODE}" != "true" ]] && echo -e "\n$TIP $(msg "tip.EPEL7")\n\n${GREEN}➜${PLAIN} ${WEB_PROTOCOL}://${SOURCE_EPEL:-${SOURCE}}/${SOURCE_EPEL_BRANCH:-"epel"}" fi ## 安装 EPEL 软件包 if [ $VERIFICATION_EPEL -ne 0 ]; then echo -e "\n${WORKING} $(msg "work.installEPELPackage")\n" local package_manager="$(get_package_manager)" local package_path="epel/epel-release-latest-${epel_version}" case "${epel_version}" in 7) package_path="epel-archive/7/${DEVICE_ARCH_RAW}/Packages/e/epel-release-7-14" ;; 9) ## CentOS Stream 9 特殊,有两个不同的发行包 epel-release epel-next-release case "${SYSTEM_JUDGMENT}" in "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ORACLE}" | "${SYSTEM_RHEL}") package_path="epel/epel{,-next}-release-latest-9" ;; esac ;; esac eval $package_manager install -y https://mirrors.cloud.tencent.com/${package_path}.noarch.rpm rm -rf $Dir_YumRepos/epel* fi ## 删除原有 repo 源文件 if [ -d "${Dir_YumRepos}" ]; then ls $Dir_YumRepos | grep epel -q [ $? -eq 0 ] && rm -rf $Dir_YumRepos/epel* fi if [ -d "${Dir_YumReposBackup}" ]; then ls $Dir_YumReposBackup | grep epel -q [ $? -eq 0 ] && rm -rf $Dir_YumReposBackup/epel* fi ## 生成 repo 源文件 gen_repo_files_EPEL "${SYSTEM_VERSION_ID_MAJOR}" if [[ "${epel_version}" == 9 ]]; then case "${SYSTEM_JUDGMENT}" in "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ORACLE}" | "${SYSTEM_RHEL}") gen_repo_files_EPEL_NEXT "${SYSTEM_VERSION_ID_MAJOR}" ;; esac fi ## 使用官方源 if [[ "${USE_OFFICIAL_SOURCE}" == "true" || "${USE_OFFICIAL_SOURCE_EPEL}" == "true" ]]; then case "${epel_version}" in 7) SOURCE_EPEL="dl.fedoraproject.org/pub/archive" ;; *) SOURCE_EPEL="dl.fedoraproject.org/pub" ;; esac fi ## 修改源 sed -e "s|^#baseurl=http\(s\)\?|baseurl=${WEB_PROTOCOL}|g" \ -e "s|^metalink=|#metalink=|g" \ -e "s|download.example/pub/epel|${SOURCE_EPEL:-${SOURCE}}/${SOURCE_EPEL_BRANCH:-"epel"}|g" \ -i \ $Dir_YumRepos/epel* ## 启用所需的仓库(EPEL 需要结合 PowerTools / CRB 使用) case "${epel_version}" in 9 | 10) dnf config-manager --set-enabled crb >/dev/null 2>&1 ;; 8) dnf config-manager --set-enabled powertools >/dev/null 2>&1 ;; esac } ## 选择系统包管理器 function get_package_manager() { local command="yum" case "${SYSTEM_JUDGMENT}" in "${SYSTEM_RHEL}" | "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ROCKY}" | "${SYSTEM_ALMALINUX}" | "${SYSTEM_ORACLE}") case "${SYSTEM_VERSION_ID_MAJOR}" in 9 | 10) command="dnf" ;; esac ;; "${SYSTEM_FEDORA}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}") command="dnf" ;; esac echo "${command}" } function interactive_select_list() { _SELECT_RESULT="" eval "local -a __values=(\"\${${1}[@]}\")" local -a __labels=() local message="${2}" local selected=0 local start=0 local page_size=$(($(tput lines 2>/dev/null) - 3)) if [[ "${3}" ]]; then eval "__labels=(\"\${${3}[@]}\")" fi function clear_menu() { tput rc 2>/dev/null for ((i = 0; i < ${#__values[@]} + 1; i++)); do echo -e "\r\033[K" done tput rc 2>/dev/null } function cleanup() { clear_menu tput rc 2>/dev/null tput cnorm 2>/dev/null tput rmcup 2>/dev/null echo -e "\n\033[1;44m $(msg "interaction.common.tip") \033[0m \033[31m$(msg "interaction.common.operationCanceled")\033[0m\n" exit 130 } function draw_menu() { tput clear 2>/dev/null tput cup 0 0 2>/dev/null echo -e "${message}" local end=$((start + page_size - 1)) local label if [ $end -ge ${#__values[@]} ]; then end=${#__values[@]}-1 fi for ((i = start; i <= end; i++)); do if [[ "${__labels[$i]}" ]]; then label="${__labels[$i]}" else label="${__values[$i]}" fi if [ "$i" -eq "${selected}" ]; then echo -e "\e[34;4m➤ ${label}\e[0m" else echo -e " ${label}" fi done } function read_key() { IFS= read -rsn1 key if [[ $key == $'\x1b' ]]; then IFS= read -rsn2 key key="$key" fi echo "$key" } tput smcup 2>/dev/null tput sc 2>/dev/null tput civis 2>/dev/null trap "cleanup" INT TERM draw_menu while true; do key=$(read_key) case "$key" in "[A" | "w" | "W") if [ "${selected}" -gt 0 ]; then selected=$((selected - 1)) if [ "${selected}" -lt "$start" ]; then start=$((start - 1)) fi fi ;; "[B" | "s" | "S") if [ "${selected}" -lt $((${#__values[@]} - 1)) ]; then selected=$((selected + 1)) if [ "${selected}" -ge $((start + page_size)) ]; then start=$((start + 1)) fi fi ;; "") tput rmcup break ;; *) ;; esac draw_menu done tput cnorm 2>/dev/null tput rmcup 2>/dev/null _SELECT_RESULT="${__values[${selected}]}" if [ "${__labels[${selected}]}" ]; then _SELECT_RESULT="${_SELECT_RESULT}@@${__labels[${selected}]}" fi } function interactive_select_boolean() { _SELECT_RESULT="" local selected=0 local message="$1" local positive_title="${2:-"$(msg "interaction.common.yes")"}" local negative_title="${3:-"$(msg "interaction.common.no")"}" local menu_height=3 local original_line function store_position() { original_line=$(tput lines 2>/dev/null) } function clear_menu() { for ((i = 0; i < $menu_height; i++)); do tput cuu1 2>/dev/null tput el 2>/dev/null done } function cleanup() { clear_menu tput cnorm 2>/dev/null echo -e "\n\033[1;44m $(msg "interaction.common.tip") \033[0m \033[31m$(msg "interaction.common.operationCanceled")\033[0m\n" exit 130 } function draw_menu() { echo -e "╭─ ${message}" echo -e "│" if [ "${selected}" -eq 0 ]; then echo -e "╰─ \033[34m●\033[0m ${positive_title}\033[2m / ○ ${negative_title}\033[0m" else echo -e "╰─ \033[2m○ ${positive_title} / \033[0m\033[34m●\033[0m ${negative_title}" fi } function read_key() { IFS= read -rsn1 key if [[ $key == $'\x1b' ]]; then IFS= read -rsn2 key key="$key" fi echo "$key" } tput civis 2>/dev/null store_position trap "cleanup" INT TERM draw_menu while true; do key=$(read_key) case "$key" in "[D" | "a" | "A") if [ "${selected}" -gt 0 ]; then selected=$((selected - 1)) clear_menu draw_menu fi ;; "[C" | "d" | "D") if [ "${selected}" -lt 1 ]; then selected=$((selected + 1)) clear_menu draw_menu fi ;; "") clear_menu break ;; *) ;; esac done echo -e "╭─ ${message}" echo -e "│" if [ "${selected}" -eq 0 ]; then echo -e "╰─ \033[32m●\033[0m \033[1m${positive_title}\033[0m\033[2m / ○ ${negative_title}\033[0m" _SELECT_RESULT="true" else echo -e "╰─ \033[2m○ ${positive_title} / \033[0m\033[32m●\033[0m \033[1m${negative_title}\033[0m" _SELECT_RESULT="false" fi tput cnorm 2>/dev/null } function animate_exec() { local cmd="$1" local title="$2" local max_lines=${3:-5} local spinner_style="${4:-dots}" local refresh_rate="${5:-0.1}" local scroll_mode="${6:-1}" if [[ "${scroll_mode}" == "0" ]]; then echo -e "◉ ${title} \n" eval "${cmd}" return $? fi local -A spinners=([dots]="⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏" [circle]="◐ ◓ ◑ ◒" [classic]="-\\ |/") local -A recommended_rates=([dots]="0.08" [circle]="0.12" [classic]="0.12") [[ -z "${spinners[$spinner_style]}" ]] && spinner_style="dots" [[ "${refresh_rate}" == "0.1" ]] && refresh_rate="${recommended_rates[$spinner_style]}" local term_width=$(tput cols 2>/dev/null || echo 80) local display_width=$((term_width - 2)) function simple_truncate() { local line="$1" local truncate_marker="..." local max_length=$((display_width - 3)) if [[ "${line}" =~ ^[[:ascii:]]*$ && ${#line} -le $display_width ]]; then echo "${line}" return fi local non_ascii_count=$(echo "${line}" | sed "s|[0-9a-zA-Z -~]||g; s| ||g" | wc -m) local total_length=${#line} local display_length=$((total_length + non_ascii_count)) local quote_count=0 [[ $(echo "${line}" | grep -c "“") -gt 0 ]] && ((quote_count += "$(echo "${line}" | grep -c "“")")) [[ $(echo "${line}" | grep -c "”") -gt 0 ]] && ((quote_count += "$(echo "${line}" | grep -c "”")")) [[ $(echo "${line}" | grep -c "‘") -gt 0 ]] && ((quote_count += "$(echo "${line}" | grep -c "‘")")) [[ $(echo "${line}" | grep -c "’") -gt 0 ]] && ((quote_count += "$(echo "${line}" | grep -c "’")")) display_length=$((display_length - quote_count)) if [[ $display_length -le $display_width ]]; then echo "$line" return fi local result="" local current_width=0 local i=0 while [ $i -lt ${#line} ]; do local char="${line:$i:1}" local char_width=1 if ! [[ "$char" =~ [0-9a-zA-Z\.\=\:\_\(\)\'\"\-\/\!\·] ]]; then if [[ "$char" != "“" && "$char" != "”" && "$char" != "‘" && "$char" != "’" ]]; then char_width=2 fi fi if [[ $((current_width + char_width)) -gt $max_length ]]; then echo "${result}${truncate_marker}" return fi result+="${char}" current_width=$((current_width + char_width)) ((i++)) done echo "${line}" } function cleanup() { [ -f "${temp_file}" ] && rm -f "${temp_file}" tput cnorm 2>/dev/null echo -e "\n\033[1;44m $(msg "interaction.common.tip") \033[0m \033[31m$(msg "interaction.common.operationCanceled")\033[0m\n" exit 130 } function make_temp_file() { local -a temp_dirs=("." "/tmp") local tmp_file="" for dir in "${temp_dirs[@]}"; do [[ ! -d "${dir}" || ! -w "${dir}" ]] && continue tmp_file="${dir}/animate_exec_$$_$(date +%s)" touch "${tmp_file}" 2>/dev/null || continue if [[ -f "${tmp_file}" && -w "${tmp_file}" ]]; then echo "${tmp_file}" return fi done echo "${tmp_file}" } function update_display() { local current_size=$(wc -c <"${temp_file}" 2>/dev/null || echo 0) if [[ $current_size -le $last_size ]]; then return 1 fi local -a lines=() mapfile -t -n "${max_lines}" lines < <(tail -n "$max_lines" "${temp_file}") local -a processed_lines=() for ((i = 0; i < ${#lines[@]}; i++)); do processed_lines[i]=$(simple_truncate "${lines[i]}") done tput cud1 2>/dev/null echo -ne "\r\033[K" tput cud1 2>/dev/null for ((i = 0; i < $max_lines; i++)); do echo -ne "\r\033[K" [[ $i -lt ${#processed_lines[@]} ]] && echo -ne "\033[2m${processed_lines[$i]}\033[0m" [[ $i -lt $((max_lines - 1)) ]] && tput cud1 2>/dev/null done for ((i = 0; i < $max_lines + 1; i++)); do tput cuu1 2>/dev/null done last_size=$current_size return 0 } local spinner_frames=(${spinners[$spinner_style]}) local temp_file="$(make_temp_file)" trap "cleanup" INT TERM tput civis 2>/dev/null echo '' echo '' for ((i = 0; i < $max_lines; i++)); do echo '' done eval "${cmd}" >"${temp_file}" 2>&1 & local cmd_pid=$! local last_size=0 local spin_idx=0 tput cuu $((max_lines + 2)) 2>/dev/null sleep 0.05 echo -ne "\r\033[K◉ ${title} [\033[1m\033[34m${spinner_frames[$spin_idx]}\033[0m]" spin_idx=$(((spin_idx + 1) % ${#spinner_frames[@]})) update_display local update_count=0 local adaptive_rate=$refresh_rate while kill -0 $cmd_pid 2>/dev/null; do echo -ne "\r\033[K◉ ${title} [\033[1m\033[34m${spinner_frames[$spin_idx]}\033[0m]" spin_idx=$(((spin_idx + 1) % ${#spinner_frames[@]})) if update_display; then update_count=$((update_count + 1)) if [[ $update_count -gt 5 ]]; then adaptive_rate=$(awk "BEGIN {print $adaptive_rate * 1.5; exit}") [[ $(awk "BEGIN {print ($adaptive_rate > 0.5); exit}") -eq 1 ]] && adaptive_rate=0.5 update_count=0 fi else update_count=0 adaptive_rate=$refresh_rate fi sleep $adaptive_rate done wait $cmd_pid local exit_status=$? update_display if [ $exit_status -eq 0 ]; then echo -ne "\r\033[K◉ ${title} [\033[1m\033[32m✓\033[0m]\n" else echo -ne "\r\033[K◉ ${title} [\033[1m\033[31m✗\033[0m]\n" fi echo -ne "\r\033[K\n" local actual_lines=$(wc -l <"${temp_file}" 2>/dev/null || echo 0) [[ $actual_lines -gt $max_lines ]] && actual_lines=$max_lines if [[ $actual_lines -gt 0 ]]; then local -a final_lines=() mapfile -t -n "$actual_lines" final_lines < <(tail -n "$actual_lines" "${temp_file}") for ((i = 0; i < actual_lines; i++)); do local line=$(simple_truncate "${final_lines[$i]}") echo -ne "\r\033[K\033[2m${line}\033[0m\n" done fi tput cnorm 2>/dev/null rm -f "${temp_file}" return $exit_status } ############################################################################## ## 生成 CentOS repo 源文件 function gen_repo_files_CentOS() { case "$1" in 8) cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-AppStream.repo [appstream] name=CentOS Linux $releasever - AppStream mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-BaseOS.repo [baseos] name=CentOS Linux $releasever - BaseOS mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-ContinuousRelease.repo [cr] name=CentOS Linux $releasever - ContinuousRelease mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=cr&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/cr/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-Debuginfo.repo [debuginfo] name=CentOS Linux $releasever - Debuginfo baseurl=http://debuginfo.centos.org/$releasever/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-Devel.repo [devel] name=CentOS Linux $releasever - Devel WARNING! FOR BUILDROOT USE ONLY! mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=Devel&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/Devel/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-Extras.repo [extras] name=CentOS Linux $releasever - Extras mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/extras/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-FastTrack.repo [fasttrack] name=CentOS Linux $releasever - FastTrack mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=fasttrack&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/fasttrack/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-HighAvailability.repo [ha] name=CentOS Linux $releasever - HighAvailability mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=HighAvailability&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/HighAvailability/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-Media.repo [media-baseos] name=CentOS Linux $releasever - Media - BaseOS baseurl=file:///media/CentOS/BaseOS file:///media/cdrom/BaseOS file:///media/cdrecorder/BaseOS gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [media-appstream] name=CentOS Linux $releasever - Media - AppStream baseurl=file:///media/CentOS/AppStream file:///media/cdrom/AppStream file:///media/cdrecorder/AppStream gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-Plus.repo [plus] name=CentOS Linux $releasever - Plus mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/centosplus/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-PowerTools.repo [powertools] name=CentOS Linux $releasever - PowerTools mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=PowerTools&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/PowerTools/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-Sources.repo [baseos-source] name=CentOS Linux $releasever - BaseOS - Source baseurl=http://vault.centos.org/$contentdir/$releasever/BaseOS/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [appstream-source] name=CentOS Linux $releasever - AppStream - Source baseurl=http://vault.centos.org/$contentdir/$releasever/AppStream/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [extras-source] name=CentOS Linux $releasever - Extras - Source baseurl=http://vault.centos.org/$contentdir/$releasever/extras/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [plus-source] name=CentOS Linux $releasever - Plus - Source baseurl=http://vault.centos.org/$contentdir/$releasever/centosplus/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF ;; 7) cat <<'EOF' >$Dir_YumRepos/CentOS-Base.repo [base] name=CentOS-$releasever - Base mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 [updates] name=CentOS-$releasever - Updates mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 [extras] name=CentOS-$releasever - Extras mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 [centosplus] name=CentOS-$releasever - Plus mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 EOF cat <<'EOF' >$Dir_YumRepos/CentOS-CR.repo [cr] name=CentOS-$releasever - cr baseurl=http://mirror.centos.org/centos/$releasever/cr/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 enabled=0 EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Debuginfo.repo [base-debuginfo] name=CentOS-7 - Debuginfo baseurl=http://debuginfo.centos.org/7/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-7 enabled=0 EOF cat <<'EOF' >$Dir_YumRepos/CentOS-fasttrack.repo [fasttrack] name=CentOS-7 - fasttrack mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=fasttrack&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/fasttrack/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Media.repo [c7-media] name=CentOS-$releasever - Media baseurl=file:///media/CentOS/ file:///media/cdrom/ file:///media/cdrecorder/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Sources.repo [base-source] name=CentOS-$releasever - Base Sources baseurl=http://vault.centos.org/centos/$releasever/os/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 [updates-source] name=CentOS-$releasever - Updates Sources baseurl=http://vault.centos.org/centos/$releasever/updates/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 [extras-source] name=CentOS-$releasever - Extras Sources baseurl=http://vault.centos.org/centos/$releasever/extras/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 [centosplus-source] name=CentOS-$releasever - Plus Sources baseurl=http://vault.centos.org/centos/$releasever/centosplus/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 EOF ;; esac } ## 生成 CentOS Stream repo 源文件 function gen_repo_files_CentOSStream() { case "$1" in 10) cat <<'EOF' >$Dir_YumRepos/centos.repo [baseos] name=CentOS Stream $releasever - BaseOS #baseurl=https://mirror.stream.centos.org/$releasever-stream/BaseOS/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=1 [baseos-debuginfo] name=CentOS Stream $releasever - BaseOS - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [baseos-source] name=CentOS Stream $releasever - BaseOS - Source metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [appstream] name=CentOS Stream $releasever - AppStream #baseurl=https://mirror.stream.centos.org/$releasever-stream/AppStream/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=1 [appstream-debuginfo] name=CentOS Stream $releasever - AppStream - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [appstream-source] name=CentOS Stream $releasever - AppStream - Source metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [crb] name=CentOS Stream $releasever - CRB #baseurl=https://mirror.stream.centos.org/$releasever-stream/CRB/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-crb-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=0 [crb-debuginfo] name=CentOS Stream $releasever - CRB - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-crb-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [crb-source] name=CentOS Stream $releasever - CRB - Source metalink=https://mirrors.centos.org/metalink?repo=centos-crb-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 EOF cat <<'EOF' >$Dir_YumRepos/centos-addons.repo [highavailability] name=CentOS Stream $releasever - HighAvailability #baseurl=https://mirror.stream.centos.org/$releasever-stream/HighAvailability/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=0 [highavailability-debuginfo] name=CentOS Stream $releasever - HighAvailability - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [highavailability-source] name=CentOS Stream $releasever - HighAvailability - Source metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [nfv] name=CentOS Stream $releasever - NFV #baseurl=https://mirror.stream.centos.org/$releasever-stream/NFV/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=0 [nfv-debuginfo] name=CentOS Stream $releasever - NFV - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [nfv-source] name=CentOS Stream $releasever - NFV - Source metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [rt] name=CentOS Stream $releasever - RT #baseurl=https://mirror.stream.centos.org/$releasever-stream/RT/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-rt-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=0 [rt-debuginfo] name=CentOS Stream $releasever - RT - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-rt-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [rt-source] name=CentOS Stream $releasever - RT - Source metalink=https://mirrors.centos.org/metalink?repo=centos-rt-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [resilientstorage] name=CentOS Stream $releasever - ResilientStorage #baseurl=https://mirror.stream.centos.org/$releasever-stream/ResilientStorage/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=0 [resilientstorage-debuginfo] name=CentOS Stream $releasever - ResilientStorage - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [resilientstorage-source] name=CentOS Stream $releasever - ResilientStorage - Source metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [extras-common] name=CentOS Stream $releasever - Extras packages #baseurl=https://mirror.stream.centos.org/SIGs/$releasever-stream/extras/$basearch/extras-common/ metalink=https://mirrors.centos.org/metalink?repo=centos-extras-sig-extras-common-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=1 [extras-common-source] name=CentOS Stream $releasever - Extras packages - Source metalink=https://mirrors.centos.org/metalink?repo=centos-extras-sig-extras-common-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 EOF ;; 9) cat <<'EOF' >$Dir_YumRepos/centos.repo [baseos] name=CentOS Stream $releasever - BaseOS #baseurl=https://mirror.stream.centos.org/$releasever-stream/BaseOS/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=1 [baseos-debug] name=CentOS Stream $releasever - BaseOS - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [baseos-source] name=CentOS Stream $releasever - BaseOS - Source metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [appstream] name=CentOS Stream $releasever - AppStream #baseurl=https://mirror.stream.centos.org/$releasever-stream/AppStream/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=1 [appstream-debug] name=CentOS Stream $releasever - AppStream - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [appstream-source] name=CentOS Stream $releasever - AppStream - Source metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [crb] name=CentOS Stream $releasever - CRB #baseurl=https://mirror.stream.centos.org/$releasever-stream/CRB/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-crb-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=0 [crb-debug] name=CentOS Stream $releasever - CRB - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-crb-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [crb-source] name=CentOS Stream $releasever - CRB - Source metalink=https://mirrors.centos.org/metalink?repo=centos-crb-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 EOF cat <<'EOF' >$Dir_YumRepos/centos-addons.repo [highavailability] name=CentOS Stream $releasever - HighAvailability #baseurl=https://mirror.stream.centos.org/$releasever-stream/HighAvailability/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=0 [highavailability-debug] name=CentOS Stream $releasever - HighAvailability - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [highavailability-source] name=CentOS Stream $releasever - HighAvailability - Source metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [nfv] name=CentOS Stream $releasever - NFV #baseurl=https://mirror.stream.centos.org/$releasever-stream/NFV/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=0 [nfv-debug] name=CentOS Stream $releasever - NFV - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [nfv-source] name=CentOS Stream $releasever - NFV - Source metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [rt] name=CentOS Stream $releasever - RT #baseurl=https://mirror.stream.centos.org/$releasever-stream/RT/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-rt-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=0 [rt-debug] name=CentOS Stream $releasever - RT - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-rt-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [rt-source] name=CentOS Stream $releasever - RT - Source metalink=https://mirrors.centos.org/metalink?repo=centos-rt-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [resilientstorage] name=CentOS Stream $releasever - ResilientStorage #baseurl=https://mirror.stream.centos.org/$releasever-stream/ResilientStorage/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=0 [resilientstorage-debug] name=CentOS Stream $releasever - ResilientStorage - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [resilientstorage-source] name=CentOS Stream $releasever - ResilientStorage - Source metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [extras-common] name=CentOS Stream $releasever - Extras packages #baseurl=https://mirror.stream.centos.org/SIGs/$releasever-stream/extras/$basearch/extras-common/ metalink=https://mirrors.centos.org/metalink?repo=centos-extras-sig-extras-common-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=1 [extras-common-source] name=CentOS Stream $releasever - Extras packages - Source metalink=https://mirrors.centos.org/metalink?repo=centos-extras-sig-extras-common-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 EOF ;; 8) cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-AppStream.repo [appstream] name=CentOS Stream $releasever - AppStream mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=AppStream&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$stream/AppStream/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-BaseOS.repo [baseos] name=CentOS Stream $releasever - BaseOS mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=BaseOS&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$stream/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-Debuginfo.repo [debuginfo] name=CentOS Stream $releasever - Debuginfo baseurl=http://debuginfo.centos.org/$stream/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-Extras-common.repo [extras-common] name=CentOS Stream $releasever - Extras common packages mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=extras-extras-common #baseurl=http://mirror.centos.org/$contentdir/$stream/extras/$basearch/extras-common/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-Extras.repo [extras] name=CentOS Stream $releasever - Extras mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=extras&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$stream/extras/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-HighAvailability.repo [ha] name=CentOS Stream $releasever - HighAvailability mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=HighAvailability&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$stream/HighAvailability/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-Media.repo [media-baseos] name=CentOS Stream $releasever - Media - BaseOS baseurl=file:///media/CentOS/BaseOS file:///media/cdrom/BaseOS file:///media/cdrecorder/BaseOS gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [media-appstream] name=CentOS Stream $releasever - Media - AppStream baseurl=file:///media/CentOS/AppStream file:///media/cdrom/AppStream file:///media/cdrecorder/AppStream gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-NFV.repo [nfv] name=CentOS Stream $releasever - NFV mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=NFV&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$stream/NFV/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-PowerTools.repo [powertools] name=CentOS Stream $releasever - PowerTools mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=PowerTools&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$stream/PowerTools/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-RealTime.repo [rt] name=CentOS Stream $releasever - RealTime mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=RT&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$stream/RT/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-ResilientStorage.repo [resilientstorage] name=CentOS Stream $releasever - ResilientStorage mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=ResilientStorage&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$stream/ResilientStorage/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-Sources.repo [baseos-source] name=CentOS Stream $releasever - BaseOS - Source baseurl=http://vault.centos.org/$contentdir/$stream/BaseOS/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [appstream-source] name=CentOS Stream $releasever - AppStream - Source baseurl=http://vault.centos.org/$contentdir/$stream/AppStream/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [powertools-source] name=CentOS Stream $releasever - PowerTools - Source baseurl=http://vault.centos.org/$contentdir/$stream/PowerTools/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [extras-source] name=CentOS Stream $releasever - Extras - Source baseurl=http://vault.centos.org/$contentdir/$stream/extras/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [ha-source] name=CentOS Stream $releasever - HighAvailability - Source baseurl=http://vault.centos.org/$contentdir/$stream/HighAvailability/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [rt-source] name=CentOS Stream $releasever - RT - Source baseurl=http://vault.centos.org/$contentdir/$stream/RT/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [resilientstorage-source] name=CentOS Stream $releasever - ResilientStorage - Source baseurl=http://vault.centos.org/$contentdir/$stream/ResilientStorage/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [nfv-source] name=CentOS Stream $releasever - NFV - Source baseurl=http://vault.centos.org/$contentdir/$stream/NFV/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF ;; esac } ## 生成 Rocky Linux repo 源文件 function gen_repo_files_RockyLinux() { case "$1" in 10) cat <<'EOF' >$Dir_YumRepos/rocky.repo [baseos] name=Rocky Linux $releasever - BaseOS mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=BaseOS-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [baseos-debuginfo] name=Rocky Linux $releasever - BaseOS - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=BaseOS-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [baseos-source] name=Rocky Linux $releasever - BaseOS - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=BaseOS-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [appstream] name=Rocky Linux $releasever - AppStream mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=AppStream-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [appstream-debuginfo] name=Rocky Linux $releasever - AppStream - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=AppStream-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [appstream-source] name=Rocky Linux $releasever - AppStream - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=AppStream-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [crb] name=Rocky Linux $releasever - CRB mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=CRB-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/CRB/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [crb-debuginfo] name=Rocky Linux $releasever - CRB - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=CRB-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/CRB/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [crb-source] name=Rocky Linux $releasever - CRB - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=CRB-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/CRB/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 EOF cat <<'EOF' >$Dir_YumRepos/rocky-addons.repo [highavailability] name=Rocky Linux $releasever - High Availability mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=HighAvailability-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [highavailability-debuginfo] name=Rocky Linux $releasever - High Availability - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=HighAvailability-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [highavailability-source] name=Rocky Linux $releasever - High Availability - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=HighAvailability-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [nfv] name=Rocky Linux $releasever - NFV mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=NFV-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/NFV/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [nfv-debuginfo] name=Rocky Linux $releasever - NFV Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/NFV/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [nfv-source] name=Rocky Linux $releasever - NFV Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/NFV/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [rt] name=Rocky Linux $releasever - Realtime mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/RT/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [rt-debuginfo] name=Rocky Linux $releasever - Realtime Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/RT/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [rt-source] name=Rocky Linux $releasever - Realtime Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/RT/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [sap] name=Rocky Linux $releasever - SAP mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAP-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAP/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [sap-debuginfo] name=Rocky Linux $releasever - SAP Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAP-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAP/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [sap-source] name=Rocky Linux $releasever - SAP Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAP-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAP/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [saphana] name=Rocky Linux $releasever - SAPHANA mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAPHANA-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAPHANA/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [saphana-debuginfo] name=Rocky Linux $releasever - SAPHANA Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAPHANA-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAPHANA/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [saphana-source] name=Rocky Linux $releasever - SAPHANA Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAPHANA-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAPHANA/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 EOF cat <<'EOF' >$Dir_YumRepos/rocky-devel.repo [devel] name=Rocky Linux $releasever - Devel WARNING! FOR BUILDROOT ONLY DO NOT LEAVE ENABLED mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=devel-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/devel/$basearch/os/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [devel-debuginfo] name=Rocky Linux $releasever - Devel Debug WARNING! FOR BUILDROOT ONLY DO NOT LEAVE ENABLED mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=devel-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/devel/$basearch/debug/tree/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [devel-source] name=Rocky Linux $releasever - Devel Source WARNING! FOR BUILDROOT ONLY DO NOT LEAVE ENABLED mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=devel-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/devel/source/tree/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 EOF cat <<'EOF' >$Dir_YumRepos/rocky-extras.repo [extras] name=Rocky Linux $releasever - Extras mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=extras-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/$basearch/os/ gpgcheck=1 enabled=1 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [extras-debuginfo] name=Rocky Linux $releasever - Extras Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=extras-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [extras-source] name=Rocky Linux $releasever - Extras Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=extras-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [plus] name=Rocky Linux $releasever - Plus mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=plus-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/plus/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [plus-debuginfo] name=Rocky Linux $releasever - Plus - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=plus-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/plus/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [plus-source] name=Rocky Linux $releasever - Plus - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=plus-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/plus/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 EOF ;; 9) cat <<'EOF' >$Dir_YumRepos/rocky.repo [baseos] name=Rocky Linux $releasever - BaseOS mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=BaseOS-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [baseos-debug] name=Rocky Linux $releasever - BaseOS - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=BaseOS-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [baseos-source] name=Rocky Linux $releasever - BaseOS - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=BaseOS-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [appstream] name=Rocky Linux $releasever - AppStream mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=AppStream-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [appstream-debug] name=Rocky Linux $releasever - AppStream - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=AppStream-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [appstream-source] name=Rocky Linux $releasever - AppStream - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=AppStream-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [crb] name=Rocky Linux $releasever - CRB mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=CRB-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/CRB/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [crb-debug] name=Rocky Linux $releasever - CRB - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=CRB-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/CRB/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [crb-source] name=Rocky Linux $releasever - CRB - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=CRB-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/CRB/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 EOF cat <<'EOF' >$Dir_YumRepos/rocky-addons.repo [highavailability] name=Rocky Linux $releasever - High Availability mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=HighAvailability-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [highavailability-debug] name=Rocky Linux $releasever - High Availability - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=HighAvailability-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [highavailability-source] name=Rocky Linux $releasever - High Availability - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=HighAvailability-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [resilientstorage] name=Rocky Linux $releasever - Resilient Storage mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=ResilientStorage-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/ResilientStorage/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [resilientstorage-debug] name=Rocky Linux $releasever - Resilient Storage - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=ResilientStorage-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/ResilientStorage/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [resilientstorage-source] name=Rocky Linux $releasever - Resilient Storage - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=ResilientStorage-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/ResilientStorage/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [nfv] name=Rocky Linux $releasever - NFV mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=NFV-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/NFV/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [nfv-debug] name=Rocky Linux $releasever - NFV Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/NFV/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [nfv-source] name=Rocky Linux $releasever - NFV Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/NFV/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [rt] name=Rocky Linux $releasever - Realtime mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/RT/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [rt-debug] name=Rocky Linux $releasever - Realtime Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/RT/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [rt-source] name=Rocky Linux $releasever - Realtime Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/RT/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [sap] name=Rocky Linux $releasever - SAP mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAP-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAP/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [sap-debug] name=Rocky Linux $releasever - SAP Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAP-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAP/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [sap-source] name=Rocky Linux $releasever - SAP Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAP-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAP/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [saphana] name=Rocky Linux $releasever - SAPHANA mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAPHANA-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAPHANA/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [saphana-debug] name=Rocky Linux $releasever - SAPHANA Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAPHANA-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAPHANA/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [saphana-source] name=Rocky Linux $releasever - SAPHANA Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAPHANA-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAPHANA/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 EOF cat <<'EOF' >$Dir_YumRepos/rocky-devel.repo [devel] name=Rocky Linux $releasever - Devel WARNING! FOR BUILDROOT ONLY DO NOT LEAVE ENABLED mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=devel-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/devel/$basearch/os/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 EOF cat <<'EOF' >$Dir_YumRepos/rocky-extras.repo [extras] name=Rocky Linux $releasever - Extras mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=extras-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/$basearch/os/ gpgcheck=1 enabled=1 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [extras-debug] name=Rocky Linux $releasever - Extras Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=extras-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [extras-source] name=Rocky Linux $releasever - Extras Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=extras-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [plus] name=Rocky Linux $releasever - Plus mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=plus-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/plus/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [plus-debug] name=Rocky Linux $releasever - Plus - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=plus-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/plus/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [plus-source] name=Rocky Linux $releasever - Plus - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=plus-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/plus/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 EOF ;; 8) cat <<'EOF' >$Dir_YumRepos/Rocky-AppStream.repo [appstream] name=Rocky Linux $releasever - AppStream mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=AppStream-$releasever #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-BaseOS.repo [baseos] name=Rocky Linux $releasever - BaseOS mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=BaseOS-$releasever #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-Debuginfo.repo [baseos-debug] name=Rocky Linux $releasever - BaseOS - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=BaseOS-$releasever-debug #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial [appstream-debug] name=Rocky Linux $releasever - AppStream - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=AppStream-$releasever-debug #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial [ha-debug] name=Rocky Linux $releasever - High Availability - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=HighAvailability-$releasever-debug #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial [powertools-debug] name=Rocky Linux $releasever - PowerTools - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=PowerTools-$releasever-debug #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/PowerTools/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial [resilient-storage-debug] name=Rocky Linux $releasever - Resilient Storage - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=ResilientStorage-$releasever-debug #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/ResilientStorage/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-Devel.repo [devel] name=Rocky Linux $releasever - Devel WARNING! FOR BUILDROOT AND KOJI USE mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=Devel-$releasever #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/Devel/$basearch/os/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-Extras.repo [extras] name=Rocky Linux $releasever - Extras mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=extras-$releasever #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/$basearch/os/ gpgcheck=1 enabled=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-HighAvailability.repo [ha] name=Rocky Linux $releasever - HighAvailability mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=HighAvailability-$releasever #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/$basearch/os/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-Media.repo [media-baseos] name=Rocky Linux $releasever - Media - BaseOS baseurl=file:///media/Rocky/BaseOS file:///media/cdrom/BaseOS file:///media/cdrecorder/BaseOS gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial [media-appstream] name=Rocky Linux $releasever - Media - AppStream baseurl=file:///media/Rocky/AppStream file:///media/cdrom/AppStream file:///media/cdrecorder/AppStream gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-NFV.repo [nfv] name=Rocky Linux $releasever - NFV mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=NFV-$releasever #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/nfv/$basearch/os/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-Plus.repo [plus] name=Rocky Linux $releasever - Plus mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=rockyplus-$releasever #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/plus/$basearch/os/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-PowerTools.repo [powertools] name=Rocky Linux $releasever - PowerTools mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=PowerTools-$releasever #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/PowerTools/$basearch/os/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-ResilientStorage.repo [resilient-storage] name=Rocky Linux $releasever - ResilientStorage mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=ResilientStorage-$releasever #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/ResilientStorage/$basearch/os/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-RT.repo [rt] name=Rocky Linux $releasever - Realtime mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/RT/$basearch/os/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-Sources.repo [baseos-source] name=Rocky Linux $releasever - BaseOS - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=BaseOS-$releasever-source #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial [appstream-source] name=Rocky Linux $releasever - AppStream - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=AppStream-$releasever-source #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial #[extras-source] #name=Rocky Linux $releasever - Extras - Source #mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=extras-$releasever-source #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/source/tree/ #gpgcheck=1 #enabled=0 #gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial #[plus-source] #name=Rocky Linux $releasever - Plus - Source #mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=plus-$releasever-source #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/Plus/source/tree/ #gpgcheck=1 #enabled=0 #gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial [ha-source] name=Rocky Linux $releasever - High Availability - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=HighAvailability-$releasever-source #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial [powertools-source] name=Rocky Linux $releasever - PowerTools - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=PowerTools-$releasever-source #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/PowerTools/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial [resilient-storage-source] name=Rocky Linux $releasever - Resilient Storage - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=ResilientStorage-$releasever-source #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/ResilientStorage/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF ;; esac } ## 生成 AlmaLinux repo 源文件 function gen_repo_files_AlmaLinux() { case "$1" in 10) cat <<'EOF' >$Dir_YumRepos/almalinux-appstream.repo [appstream] name=AlmaLinux $releasever - AppStream mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream # baseurl=https://repo.almalinux.org/almalinux/$releasever/AppStream/$basearch/os/ enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=1 [appstream-debuginfo] name=AlmaLinux $releasever - AppStream - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream-debug # baseurl=https://vault.almalinux.org/$releasever/AppStream/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [appstream-source] name=AlmaLinux $releasever - AppStream - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream-source # baseurl=https://vault.almalinux.org/$releasever/AppStream/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-baseos.repo [baseos] name=AlmaLinux $releasever - BaseOS mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos # baseurl=https://repo.almalinux.org/almalinux/$releasever/BaseOS/$basearch/os/ enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=1 [baseos-debuginfo] name=AlmaLinux $releasever - BaseOS - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos-debug # baseurl=https://vault.almalinux.org/$releasever/BaseOS/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [baseos-source] name=AlmaLinux $releasever - BaseOS - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos-source # baseurl=https://vault.almalinux.org/$releasever/BaseOS/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-crb.repo [crb] name=AlmaLinux $releasever - CRB mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/crb # baseurl=https://repo.almalinux.org/almalinux/$releasever/CRB/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [crb-debuginfo] name=AlmaLinux $releasever - CRB - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/crb-debug # baseurl=https://vault.almalinux.org/$releasever/CRB/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [crb-source] name=AlmaLinux $releasever - CRB - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/crb-source # baseurl=https://vault.almalinux.org/$releasever/CRB/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-extras.repo [extras] name=AlmaLinux $releasever - Extras mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/extras # baseurl=https://repo.almalinux.org/almalinux/$releasever/extras/$basearch/os/ enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [extras-debuginfo] name=AlmaLinux $releasever - Extras - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/extras-debug # baseurl=https://vault.almalinux.org/$releasever/extras/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [extras-source] name=AlmaLinux $releasever - Extras - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/extras-source # baseurl=https://vault.almalinux.org/$releasever/extras/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-highavailability.repo [highavailability] name=AlmaLinux $releasever - HighAvailability mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/highavailability # baseurl=https://repo.almalinux.org/almalinux/$releasever/HighAvailability/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [highavailability-debuginfo] name=AlmaLinux $releasever - HighAvailability - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/highavailability-debug # baseurl=https://vault.almalinux.org/$releasever/HighAvailability/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [highavailability-source] name=AlmaLinux $releasever - HighAvailability - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/highavailability-source # baseurl=https://vault.almalinux.org/$releasever/HighAvailability/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-nfv.repo [nfv] name=AlmaLinux $releasever - NFV mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/nfv # baseurl=https://repo.almalinux.org/almalinux/$releasever/NFV/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [nfv-debuginfo] name=AlmaLinux $releasever - NFV - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/nfv-debug # baseurl=https://vault.almalinux.org/$releasever/NFV/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [nfv-source] name=AlmaLinux $releasever - NFV - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/nfv-source # baseurl=https://vault.almalinux.org/$releasever/NFV/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-rt.repo [rt] name=AlmaLinux $releasever - RT mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/rt # baseurl=https://repo.almalinux.org/almalinux/$releasever/RT/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [rt-debuginfo] name=AlmaLinux $releasever - RT - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/rt-debug # baseurl=https://vault.almalinux.org/$releasever/RT/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [rt-source] name=AlmaLinux $releasever - RT - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/rt-source # baseurl=https://vault.almalinux.org/$releasever/RT/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-saphana.repo [saphana] name=AlmaLinux $releasever - SAPHANA mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/saphana # baseurl=https://repo.almalinux.org/almalinux/$releasever/SAPHANA/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [saphana-debuginfo] name=AlmaLinux $releasever - SAPHANA - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/saphana-debug # baseurl=https://vault.almalinux.org/$releasever/SAPHANA/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [saphana-source] name=AlmaLinux $releasever - SAPHANA - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/saphana-source # baseurl=https://vault.almalinux.org/$releasever/SAPHANA/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-sap.repo [sap] name=AlmaLinux $releasever - SAP mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/sap # baseurl=https://repo.almalinux.org/almalinux/$releasever/SAP/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [sap-debuginfo] name=AlmaLinux $releasever - SAP - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/sap-debug # baseurl=https://vault.almalinux.org/$releasever/SAP/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [sap-source] name=AlmaLinux $releasever - SAP - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/sap-source # baseurl=https://vault.almalinux.org/$releasever/SAP/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 EOF ;; 9) cat <<'EOF' >$Dir_YumRepos/almalinux-appstream.repo [appstream] name=AlmaLinux $releasever - AppStream mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream # baseurl=https://repo.almalinux.org/almalinux/$releasever/AppStream/$basearch/os/ enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=1 [appstream-debug] name=AlmaLinux $releasever - AppStream - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream-debug # baseurl=https://repo.almalinux.org/vault/$releasever/AppStream/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [appstream-source] name=AlmaLinux $releasever - AppStream - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream-source # baseurl=https://repo.almalinux.org/vault/$releasever/AppStream/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-baseos.repo [baseos] name=AlmaLinux $releasever - BaseOS mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos # baseurl=https://repo.almalinux.org/almalinux/$releasever/BaseOS/$basearch/os/ enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=1 [baseos-debug] name=AlmaLinux $releasever - BaseOS - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos-debug # baseurl=https://repo.almalinux.org/vault/$releasever/BaseOS/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [baseos-source] name=AlmaLinux $releasever - BaseOS - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos-source # baseurl=https://repo.almalinux.org/vault/$releasever/BaseOS/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-crb.repo [crb] name=AlmaLinux $releasever - CRB mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/crb # baseurl=https://repo.almalinux.org/almalinux/$releasever/CRB/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [crb-debug] name=AlmaLinux $releasever - CRB - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/crb-debug # baseurl=https://repo.almalinux.org/vault/$releasever/CRB/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [crb-source] name=AlmaLinux $releasever - CRB - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/crb-source # baseurl=https://repo.almalinux.org/vault/$releasever/CRB/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-extras.repo [extras] name=AlmaLinux $releasever - Extras mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/extras # baseurl=https://repo.almalinux.org/almalinux/$releasever/extras/$basearch/os/ enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [extras-debug] name=AlmaLinux $releasever - Extras - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/extras-debug # baseurl=https://repo.almalinux.org/vault/$releasever/extras/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [extras-source] name=AlmaLinux $releasever - Extras - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/extras-source # baseurl=https://repo.almalinux.org/vault/$releasever/extras/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-highavailability.repo [highavailability] name=AlmaLinux $releasever - HighAvailability mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/highavailability # baseurl=https://repo.almalinux.org/almalinux/$releasever/HighAvailability/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [highavailability-debug] name=AlmaLinux $releasever - HighAvailability - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/highavailability-debug # baseurl=https://repo.almalinux.org/vault/$releasever/HighAvailability/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [highavailability-source] name=AlmaLinux $releasever - HighAvailability - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/highavailability-source # baseurl=https://repo.almalinux.org/vault/$releasever/HighAvailability/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-nfv.repo [nfv] name=AlmaLinux $releasever - NFV mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/nfv # baseurl=https://repo.almalinux.org/almalinux/$releasever/NFV/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [nfv-debug] name=AlmaLinux $releasever - NFV - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/nfv-debug # baseurl=https://repo.almalinux.org/vault/$releasever/NFV/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [nfv-source] name=AlmaLinux $releasever - NFV - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/nfv-source # baseurl=https://repo.almalinux.org/vault/$releasever/NFV/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-plus.repo [plus] name=AlmaLinux $releasever - Plus mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/plus # baseurl=https://repo.almalinux.org/almalinux/$releasever/plus/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [plus-debug] name=AlmaLinux $releasever - Plus - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/plus-debug # baseurl=https://repo.almalinux.org/vault/$releasever/plus/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [plus-source] name=AlmaLinux $releasever - Plus - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/plus-source # baseurl=https://repo.almalinux.org/vault/$releasever/plus/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-resilientstorage.repo [resilientstorage] name=AlmaLinux $releasever - ResilientStorage mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/resilientstorage # baseurl=https://repo.almalinux.org/almalinux/$releasever/ResilientStorage/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [resilientstorage-debug] name=AlmaLinux $releasever - ResilientStorage - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/resilientstorage-debug # baseurl=https://repo.almalinux.org/vault/$releasever/ResilientStorage/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [resilientstorage-source] name=AlmaLinux $releasever - ResilientStorage - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/resilientstorage-source # baseurl=https://repo.almalinux.org/vault/$releasever/ResilientStorage/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-rt.repo [rt] name=AlmaLinux $releasever - RT mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/rt # baseurl=https://repo.almalinux.org/almalinux/$releasever/RT/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [rt-debug] name=AlmaLinux $releasever - RT - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/rt-debug # baseurl=https://repo.almalinux.org/vault/$releasever/RT/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [rt-source] name=AlmaLinux $releasever - RT - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/rt-source # baseurl=https://repo.almalinux.org/vault/$releasever/RT/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-sap.repo [sap] name=AlmaLinux $releasever - SAP mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/sap # baseurl=https://repo.almalinux.org/almalinux/$releasever/SAP/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [sap-debug] name=AlmaLinux $releasever - SAP - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/sap-debug # baseurl=https://repo.almalinux.org/vault/$releasever/SAP/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [sap-source] name=AlmaLinux $releasever - SAP - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/sap-source # baseurl=https://repo.almalinux.org/vault/$releasever/SAP/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-saphana.repo [saphana] name=AlmaLinux $releasever - SAPHANA mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/saphana # baseurl=https://repo.almalinux.org/almalinux/$releasever/SAPHANA/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [saphana-debug] name=AlmaLinux $releasever - SAPHANA - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/saphana-debug # baseurl=https://repo.almalinux.org/vault/$releasever/SAPHANA/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [saphana-source] name=AlmaLinux $releasever - SAPHANA - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/saphana-source # baseurl=https://repo.almalinux.org/vault/$releasever/SAPHANA/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF ;; 8) cat <<'EOF' >$Dir_YumRepos/almalinux-ha.repo [ha] name=AlmaLinux $releasever - HighAvailability mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/ha # baseurl=https://repo.almalinux.org/almalinux/$releasever/HighAvailability/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [ha-source] name=AlmaLinux $releasever - HighAvailability Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/ha-source # baseurl=https://repo.almalinux.org/vault/$releasever/HighAvailability/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [ha-debuginfo] name=AlmaLinux $releasever - HighAvailability debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/ha-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/HighAvailability/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux EOF cat <<'EOF' >$Dir_YumRepos/almalinux-nfv.repo [nfv] name=AlmaLinux $releasever - Real Time for NFV mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/nfv # baseurl=https://repo.almalinux.org/almalinux/$releasever/NFV/$basearch/os/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [nfv-source] name=AlmaLinux $releasever - Real Time for NFV Sources mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/nfv-source # baseurl=https://repo.almalinux.org/vault/$releasever/NFV/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [nfv-debuginfo] name=AlmaLinux $releasever - Real Time for NFV Debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/nfv-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/NFV/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux EOF cat <<'EOF' >$Dir_YumRepos/almalinux-plus.repo [plus] name=AlmaLinux $releasever - Plus mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/plus # baseurl=https://repo.almalinux.org/almalinux/$releasever/plus/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [plus-source] name=AlmaLinux $releasever - Plus Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/plus-source # baseurl=https://repo.almalinux.org/vault/$releasever/plus/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [plus-debuginfo] name=AlmaLinux $releasever - Plus debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/plus-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/plus/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux EOF cat <<'EOF' >$Dir_YumRepos/almalinux-powertools.repo [powertools] name=AlmaLinux $releasever - PowerTools mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/powertools # baseurl=https://repo.almalinux.org/almalinux/$releasever/PowerTools/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [powertools-source] name=AlmaLinux $releasever - PowerTools Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/powertools-source # baseurl=https://repo.almalinux.org/vault/$releasever/PowerTools/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [powertools-debuginfo] name=AlmaLinux $releasever - PowerTools debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/powertools-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/PowerTools/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux EOF cat <<'EOF' >$Dir_YumRepos/almalinux-resilientstorage.repo [resilientstorage] name=AlmaLinux $releasever - ResilientStorage mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/resilientstorage # baseurl=https://repo.almalinux.org/almalinux/$releasever/ResilientStorage/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [resilientstorage-source] name=AlmaLinux $releasever - ResilientStorage Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/resilientstorage-source # baseurl=https://repo.almalinux.org/vault/$releasever/ResilientStorage/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [resilientstorage-debuginfo] name=AlmaLinux $releasever - ResilientStorage debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/resilientstorage-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/ResilientStorage/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux EOF cat <<'EOF' >$Dir_YumRepos/almalinux-rt.repo [rt] name=AlmaLinux $releasever - Real Time mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/rt # baseurl=https://repo.almalinux.org/almalinux/$releasever/RT/$basearch/os/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [rt-source] name=AlmaLinux $releasever - Real Time Sources mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/rt-source # baseurl=https://repo.almalinux.org/vault/$releasever/RT/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [rt-debuginfo] name=AlmaLinux $releasever - Real Time Debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/rt-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/RT/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux EOF cat <<'EOF' >$Dir_YumRepos/almalinux-sap.repo [sap] name=AlmaLinux $releasever - SAP mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/sap # baseurl=https://repo.almalinux.org/almalinux/$releasever/SAP/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [sap-source] name=AlmaLinux $releasever - SAP Sources mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/sap-source # baseurl=https://repo.almalinux.org/vault/$releasever/SAP/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [sap-debuginfo] name=AlmaLinux $releasever - SAP Debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/sap-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/SAP/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux EOF cat <<'EOF' >$Dir_YumRepos/almalinux-saphana.repo [saphana] name=AlmaLinux $releasever - SAP HANA mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/saphana # baseurl=https://repo.almalinux.org/almalinux/$releasever/SAPHANA/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [saphana-source] name=AlmaLinux $releasever - SAP HANA Sources mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/saphana-source # baseurl=https://repo.almalinux.org/vault/$releasever/SAPHANA/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [saphana-debuginfo] name=AlmaLinux $releasever - SAP HANA Debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/saphana-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/SAPHANA/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux EOF cat <<'EOF' >$Dir_YumRepos/almalinux.repo [baseos] name=AlmaLinux $releasever - BaseOS mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos # baseurl=https://repo.almalinux.org/almalinux/$releasever/BaseOS/$basearch/os/ enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [appstream] name=AlmaLinux $releasever - AppStream mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream # baseurl=https://repo.almalinux.org/almalinux/$releasever/AppStream/$basearch/os/ enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [extras] name=AlmaLinux $releasever - Extras mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/extras # baseurl=https://repo.almalinux.org/almalinux/$releasever/extras/$basearch/os/ enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [baseos-source] name=AlmaLinux $releasever - BaseOS Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos-source # baseurl=https://repo.almalinux.org/vault/$releasever/BaseOS/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [appstream-source] name=AlmaLinux $releasever - AppStream Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream-source # baseurl=https://repo.almalinux.org/vault/$releasever/AppStream/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [extras-source] name=AlmaLinux $releasever - Extras Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/extras-source # baseurl=https://repo.almalinux.org/vault/$releasever/extras/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [baseos-debuginfo] name=AlmaLinux $releasever - BaseOS debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/BaseOS/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [appstream-debuginfo] name=AlmaLinux $releasever - AppStream debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/AppStream/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [extras-debuginfo] name=AlmaLinux $releasever - Extras debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/extras-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/extras/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux EOF ;; esac } ## 生成 Fedora repo 源文件 function gen_repo_files_Fedora() { cat <<'EOF' >$Dir_YumRepos/fedora.repo [fedora] name=Fedora $releasever - $basearch #baseurl=http://download.example/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/ metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch enabled=1 countme=1 metadata_expire=7d repo_gpgcheck=0 type=rpm gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [fedora-debuginfo] name=Fedora $releasever - $basearch - Debug #baseurl=http://download.example/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-$releasever&arch=$basearch enabled=0 metadata_expire=7d repo_gpgcheck=0 type=rpm gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [fedora-source] name=Fedora $releasever - Source #baseurl=http://download.example/pub/fedora/linux/releases/$releasever/Everything/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-source-$releasever&arch=$basearch enabled=0 metadata_expire=7d repo_gpgcheck=0 type=rpm gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False EOF cat <<'EOF' >$Dir_YumRepos/fedora-updates.repo [updates] name=Fedora $releasever - $basearch - Updates #baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Everything/$basearch/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch enabled=1 countme=1 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [updates-debuginfo] name=Fedora $releasever - $basearch - Updates - Debug #baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Everything/$basearch/debug/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-debug-f$releasever&arch=$basearch enabled=0 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [updates-source] name=Fedora $releasever - Updates Source #baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Everything/SRPMS/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-source-f$releasever&arch=$basearch enabled=0 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False EOF cat <<'EOF' >$Dir_YumRepos/fedora-updates-testing.repo [updates-testing] name=Fedora $releasever - $basearch - Test Updates #baseurl=http://download.example/pub/fedora/linux/updates/testing/$releasever/Everything/$basearch/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-f$releasever&arch=$basearch enabled=0 countme=1 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [updates-testing-debuginfo] name=Fedora $releasever - $basearch - Test Updates Debug #baseurl=http://download.example/pub/fedora/linux/updates/testing/$releasever/Everything/$basearch/debug/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-debug-f$releasever&arch=$basearch enabled=0 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [updates-testing-source] name=Fedora $releasever - Test Updates Source #baseurl=http://download.example/pub/fedora/linux/updates/testing/$releasever/Everything/SRPMS/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-source-f$releasever&arch=$basearch enabled=0 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False EOF ## 自 Fedora 39 起不再使用 modular 仓库 if [[ $1 -lt 39 ]]; then cat <<'EOF' >$Dir_YumRepos/fedora-modular.repo [fedora-modular] name=Fedora Modular $releasever - $basearch #baseurl=http://download.example/pub/fedora/linux/releases/$releasever/Modular/$basearch/os/ metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-modular-$releasever&arch=$basearch enabled=1 countme=1 #metadata_expire=7d repo_gpgcheck=0 type=rpm gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [fedora-modular-debuginfo] name=Fedora Modular $releasever - $basearch - Debug #baseurl=http://download.example/pub/fedora/linux/releases/$releasever/Modular/$basearch/debug/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-modular-debug-$releasever&arch=$basearch enabled=0 metadata_expire=7d repo_gpgcheck=0 type=rpm gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [fedora-modular-source] name=Fedora Modular $releasever - Source #baseurl=http://download.example/pub/fedora/linux/releases/$releasever/Modular/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-modular-source-$releasever&arch=$basearch enabled=0 metadata_expire=7d repo_gpgcheck=0 type=rpm gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False EOF cat <<'EOF' >$Dir_YumRepos/fedora-updates-modular.repo [updates-modular] name=Fedora Modular $releasever - $basearch - Updates #baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Modular/$basearch/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-modular-f$releasever&arch=$basearch enabled=1 countme=1 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [updates-modular-debuginfo] name=Fedora Modular $releasever - $basearch - Updates - Debug #baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Modular/$basearch/debug/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-modular-debug-f$releasever&arch=$basearch enabled=0 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [updates-modular-source] name=Fedora Modular $releasever - Updates Source #baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Modular/SRPMS/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-modular-source-f$releasever&arch=$basearch enabled=0 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False EOF cat <<'EOF' >$Dir_YumRepos/fedora-updates-testing-modular.repo [updates-testing-modular] name=Fedora Modular $releasever - $basearch - Test Updates #baseurl=http://download.example/pub/fedora/linux/updates/testing/$releasever/Modular/$basearch/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-modular-f$releasever&arch=$basearch enabled=0 countme=1 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [updates-testing-modular-debuginfo] name=Fedora Modular $releasever - $basearch - Test Updates Debug #baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Modular/$basearch/debug/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-modular-debug-f$releasever&arch=$basearch enabled=0 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [updates-testing-modular-source] name=Fedora Modular $releasever - Test Updates Source #baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Modular/SRPMS/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-modular-source-f$releasever&arch=$basearch enabled=0 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False EOF fi } ## 生成 openEuler repo 源文件 function gen_repo_files_openEuler() { cat <<'EOF' >$Dir_YumRepos/openEuler.repo [OS] name=OS baseurl=http://repo.openeuler.org/openEuler-version/OS/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-version/OS/$basearch/RPM-GPG-KEY-openEuler [everything] name=everything baseurl=http://repo.openeuler.org/openEuler-version/everything/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-version/everything/$basearch/RPM-GPG-KEY-openEuler [EPOL] name=EPOL baseurl=http://repo.openeuler.org/openEuler-version/EPOL/main/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-version/OS/$basearch/RPM-GPG-KEY-openEuler [debuginfo] name=debuginfo baseurl=http://repo.openeuler.org/openEuler-version/debuginfo/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-version/debuginfo/$basearch/RPM-GPG-KEY-openEuler [source] name=source baseurl=http://repo.openeuler.org/openEuler-version/source/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-version/source/RPM-GPG-KEY-openEuler [update] name=update baseurl=http://repo.openeuler.org/openEuler-version/update/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-version/OS/$basearch/RPM-GPG-KEY-openEuler [update-source] name=update-source baseurl=http://repo.openeuler.org/openEuler-version/update/source/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-version/source/RPM-GPG-KEY-openEuler EOF ## 替换版本号 local version_name="$(get_os_release_value VERSION | sed 's/["()]//g; s/[_ ]\+/-/g; s/^-\+\|-\+$//g')" sed -e "s|openEuler-version|openEuler-${version_name}|g" \ -i \ $Dir_YumRepos/openEuler.repo } ## 生成 OpenCloudOS repo 源文件 function gen_repo_files_OpenCloudOS() { case "${1%%.*}" in 23) cat <<'EOF' >$Dir_YumRepos/OpenCloudOS-Stream.repo [BaseOS] name=BaseOS $releasever - $basearch baseurl=https://mirrors.opencloudos.tech/opencloudos-stream/releases/$releasever/BaseOS/$basearch/Packages/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-Stream [AppStream] name=AppStream $releasever - $basearch baseurl=https://mirrors.opencloudos.tech/opencloudos-stream/releases/$releasever/AppStream/$basearch/Packages/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-Stream [BaseOS-debug] name=BaseOS-debug $releasever - $basearch baseurl=https://mirrors.opencloudos.tech/opencloudos-stream/releases/$releasever/BaseOS/$basearch/debug/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-Stream [AppStream-debug] name=AppStream-debug $releasever - $basearch baseurl=https://mirrors.opencloudos.tech/opencloudos-stream/releases/$releasever/AppStream/$basearch/debug/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-Stream [BaseOS-source] name=BaseOS-source $releasever baseurl=https://mirrors.opencloudos.tech/opencloudos-stream/releases/$releasever/BaseOS/source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-Stream [AppStream-source] name=AppStream-source $releasever baseurl=https://mirrors.opencloudos.tech/opencloudos-stream/releases/$releasever/AppStream/source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-Stream EOF ;; 9) cat <<'EOF' >$Dir_YumRepos/OpenCloudOS.repo [BaseOS] name=BaseOS $releasever - $basearch baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-9 [AppStream] name=AppStream $releasever - $basearch baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-9 [extras] name=extras $releasever - $basearch baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/extras/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-9 [BaseOS-debuginfo] name=BaseOS-debuginfo $releasever - $basearch baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/BaseOS/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-9 [AppStream-debuginfo] name=AppStream-debuginfo $releasever - $basearch baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/AppStream/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-9 [extras-debuginfo] name=extras-debuginfo $releasever - $basearch baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/extras/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-9 [BaseOS-source] name=BaseOS-source $releasever baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/BaseOS/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-9 [AppStream-source] name=AppStream-source $releasever baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/AppStream/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-9 [extras-source] name=extras-source $releasever baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/extras/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-9 EOF ;; 8) cat <<'EOF' >$Dir_YumRepos/OpenCloudOS-Debuginfo.repo [BaseOS-debuginfo] name=OpenCloudOS $releasever - BaseOS-debuginfo baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/BaseOS/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [AppStream-debuginfo] name=OpenCloudOS $releasever - AppStream-debuginfo baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/AppStream/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [Extras-debuginfo] name=OpenCloudOS $releasever - Extras-debuginfo baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/Extras/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [HighAvailability-debuginfo] name=OpenCloudOS $releasever - HighAvailability-debuginfo baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/HighAvailability/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [PowerTools-debuginfo] name=OpenCloudOS $releasever - PowerTools-debuginfo baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/PowerTools/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [ResilientStorage-debuginfo] name=OpenCloudOS $releasever - ResilientStorage-debuginfo baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/ResilientStorage/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [Plus-debuginfo] name=OpenCloudOS $releasever - Plus-debuginfo baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/Plus/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS EOF if [[ "${1}" == "8.6" ]]; then cat <<'EOF' >$Dir_YumRepos/OpenCloudOS.repo [BaseOS] name=OpenCloudOS $releasever - BaseOS baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [AppStream] name=OpenCloudOS $releasever - AppStream baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [Extras] name=OpenCloudOS $releasever - Extras baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/Extras/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [HighAvailability] name=OpenCloudOS $releasever - HighAvailability baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/HighAvailability/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [PowerTools] name=OpenCloudOS $releasever - PowerTools baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/PowerTools/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [ResilientStorage] name=OpenCloudOS $releasever - ResilientStorage baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/ResilientStorage/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [Plus] name=OpenCloudOS $releasever - Plus baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/Plus/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS EOF else cat <<'EOF' >$Dir_YumRepos/OpenCloudOS.repo [BaseOS] name=OpenCloudOS $releasever - BaseOS baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [AppStream] name=OpenCloudOS $releasever - AppStream baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [Extras] name=OpenCloudOS $releasever - Extras baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/Extras/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [HighAvailability] name=OpenCloudOS $releasever - HighAvailability baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/HighAvailability/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [NFV] name=OpenCloudOS $releasever - NFV baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/NFV/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [PowerTools] name=OpenCloudOS $releasever - PowerTools baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/PowerTools/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [ResilientStorage] name=OpenCloudOS $releasever - ResilientStorage baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/ResilientStorage/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [Plus] name=OpenCloudOS $releasever - Plus baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/Plus/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS EOF fi cat <<'EOF' >$Dir_YumRepos/OpenCloudOS-Sources.repo [BaseOS-source] name=OpenCloudOS $releasever - Base-source baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/BaseOS/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [AppStream-source] name=OpenCloudOS $releasever - AppStream-source baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/AppStream/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [Extras-source] name=OpenCloudOS $releasever - Extras-source baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/Extras/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [HighAvailability-source] name=OpenCloudOS $releasever - HighAvailability-source baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/HighAvailability/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [PowerTools-source] name=OpenCloudOS $releasever - PowerTools-source baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/PowerTools/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [ResilientStorage-source] name=OpenCloudOS $releasever - ResilientStorage-source baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/ResilientStorage/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [Plus-source] name=OpenCloudOS $releasever - Plus-source baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/Plus/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS EOF ;; esac } ## 生成 Anolis OS repo 源文件 function gen_repo_files_AnolisOS() { case "${1%%.*}" in 23) cat <<'EOF' >$Dir_YumRepos/AnolisOS.repo [os] name=AnolisOS-$releasever - os baseurl=http://mirrors.openanolis.cn/anolis/$releasever/os/$basearch/os enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 [updates] name=AnolisOS-$releasever - updates baseurl=http://mirrors.openanolis.cn/anolis/$releasever/updates/$basearch/os enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 [kernel-6] name=AnolisOS-$releasever - kernel-6 baseurl=http://mirrors.openanolis.cn/anolis/$releasever/kernel-6/$basearch/os enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-Source.repo [os-source] name=AnolisOS-$releasever - os Source baseurl=https://mirrors.openanolis.cn/anolis/$releasever/os/source/ enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [updates-source] name=AnolisOS-$releasever - updates Source baseurl=https://mirrors.openanolis.cn/anolis/$releasever/updates/source/ enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [kernel-source] name=AnolisOS-$releasever - kernel-6 Source baseurl=https://mirrors.openanolis.cn/anolis/$releasever/kernel-6/source/ enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-Debuginfo.repo [os-debuginfo] name=AnolisOS-$releasever - os Debuginfo baseurl=https://mirrors.openanolis.cn/anolis/$releasever/os/$basearch/debug enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [updates-debuginfo] name=AnolisOS-$releasever - updates Debuginfo baseurl=https://mirrors.openanolis.cn/anolis/$releasever/updates/$basearch/debug enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [kernel-6-debuginfo] name=AnolisOS-$releasever - kernel-6 Debuginfo baseurl=https://mirrors.openanolis.cn/anolis/$releasever/kernel-6/$basearch/debug enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF ;; 8) cat <<'EOF' >$Dir_YumRepos/AnolisOS-AppStream.repo [AppStream] name=AnolisOS-$releasever - AppStream baseurl=http://mirrors.openanolis.cn/anolis/$releasever/AppStream/$basearch/os enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-BaseOS.repo [BaseOS] name=AnolisOS-$releasever - BaseOS baseurl=http://mirrors.openanolis.cn/anolis/$releasever/BaseOS/$basearch/os enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-DDE.repo [DDE] name=AnolisOS-$releasever - DDE baseurl=http://mirrors.openanolis.cn/anolis/$releasever/DDE/$basearch/os enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-Debuginfo.repo [AppStream-debuginfo] name=AnolisOS-$releasever - AppStream Debuginfo baseurl=https://mirrors.openanolis.cn/anolis/$releasever/AppStream/$basearch/debug enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [BaseOS-debuginfo] name=AnolisOS-$releasever - BaseOS Debuginfo baseurl=https://mirrors.openanolis.cn/anolis/$releasever/BaseOS/$basearch/debug enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [Plus-debuginfo] name=AnolisOS-$releasever - Plus Debuginfo baseurl=https://mirrors.openanolis.cn/anolis/$releasever/Plus/$basearch/debug enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [PowerTools-debuginfo] name=AnolisOS-$releasever - PowerTools Debuginfo baseurl=https://mirrors.openanolis.cn/anolis/$releasever/PowerTools/$basearch/debug enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [DDE-debuginfo] name=AnolisOS-$releasever - DDE Debuginfo baseurl=https://mirrors.openanolis.cn/anolis/$releasever/DDE/$basearch/debug enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-Extras.repo [Extras] name=AnolisOS-$releasever - Extras baseurl=http://mirrors.openanolis.cn/anolis/$releasever/Extras/$basearch/os enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-HighAvailability.repo [HighAvailability] name=AnolisOS-$releasever - HighAvailability baseurl=http://mirrors.openanolis.cn/anolis/$releasever/HighAvailability/$basearch/os enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-Plus.repo [Plus] name=AnolisOS-$releasever - Plus baseurl=http://mirrors.openanolis.cn/anolis/$releasever/Plus/$basearch/os enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-PowerTools.repo [PowerTools] name=AnolisOS-$releasever - PowerTools baseurl=http://mirrors.openanolis.cn/anolis/$releasever/PowerTools/$basearch/os enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-Source.repo [AppStream-source] name=AnolisOS-$releasever - AppStream Source baseurl=https://mirrors.openanolis.cn/anolis/$releasever/AppStream/source/ enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [BaseOS-source] name=AnolisOS-$releasever - BaseOS Source baseurl=https://mirrors.openanolis.cn/anolis/$releasever/BaseOS/source/ enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [Plus-source] name=AnolisOS-$releasever - Plus Source baseurl=https://mirrors.openanolis.cn/anolis/$releasever/Plus/source/ enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [PowerTools-source] name=AnolisOS-$releasever - PowerTools Source baseurl=https://mirrors.openanolis.cn/anolis/$releasever/PowerTools/source/ enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [DDE-source] name=AnolisOS-$releasever - DDE Source baseurl=https://mirrors.openanolis.cn/anolis/$releasever/DDE/source/ enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF ## 8.8 新增 if [[ "${1#*.}" -ge 8 ]]; then cat <<'EOF' >$Dir_YumRepos/AnolisOS-kernel-5.10.repo [kernel-5.10] name=AnolisOS-$releasever - Kernel 5.10 baseurl=http://mirrors.openanolis.cn/anolis/$releasever/kernel-5.10/$basearch/os enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 [kernel-5.10-source] name=AnolisOS-$releasever - Kernel 5.10 source baseurl=http://mirrors.openanolis.cn/anolis/$releasever/kernel-5.10/source enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 [kernel-5.10-debug] name=AnolisOS-$releasever - Kernel 5.10 debug baseurl=http://mirrors.openanolis.cn/anolis/$releasever/kernel-5.10/$basearch/debug enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF fi ## 8.10 新增 if [[ "${1#*.}" -eq 10 ]]; then cat <<'EOF' >$Dir_YumRepos/AnolisOS-Devel.repo [Devel] name=AnolisOS-$releasever - Devel baseurl=http://mirrors.openanolis.cn/anolis/$releasever/Devel/$basearch/os enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-NDE.repo [NDE] name=AnolisOS-$releasever - NDE baseurl=http://mirrors.openanolis.cn/anolis/$releasever/NDE/$basearch/os enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 [NDE-debuginfo] name=AnolisOS-$releasever - NDE Debuginfo baseurl=https://mirrors.openanolis.cn/anolis/$releasever/NDE/$basearch/debug enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [NDE-source] name=AnolisOS-$releasever - NDE Source baseurl=https://mirrors.openanolis.cn/anolis/$releasever/NDE/source/ enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF fi ;; esac } ## 生成 openSUSE repo 源文件 function gen_repo_files_openSUSE() { case "$1" in "leap") case "${2%%.*}" in 16) cat <<'EOF' >$Dir_ZYppRepos/openSUSE:repo-non-oss-debug.repo [openSUSE:repo-non-oss-debug] name=repo-non-oss-debug (${releasever}) enabled=0 autorefresh=1 baseurl=http://cdn.opensuse.org/debug/distribution/leap/${releasever}/repo/non-oss/$basearch gpgkey=http://cdn.opensuse.org/debug/distribution/leap/${releasever}/repo/non-oss/$basearch/repodata/repomd.xml.key EOF cat <<'EOF' >$Dir_ZYppRepos/openSUSE:repo-non-oss.repo [openSUSE:repo-non-oss] name=repo-non-oss (${releasever}) enabled=0 autorefresh=1 baseurl=http://cdn.opensuse.org/distribution/leap/${releasever}/repo/non-oss/$basearch gpgkey=http://cdn.opensuse.org/distribution/leap/${releasever}/repo/non-oss/$basearch/repodata/repomd.xml.key EOF cat <<'EOF' >$Dir_ZYppRepos/openSUSE:repo-openh264.repo [openSUSE:repo-openh264] name=repo-openh264 (${releasever}) enabled=1 autorefresh=1 baseurl=http://codecs.opensuse.org/openh264/openSUSE_Leap_16 gpgkey=https://codecs.opensuse.org/openh264/openSUSE_Leap_16/repodata/repomd.xml.key EOF cat <<'EOF' >$Dir_ZYppRepos/openSUSE:repo-oss-debug.repo [openSUSE:repo-oss-debug] name=repo-oss-debug (${releasever}) enabled=0 autorefresh=1 baseurl=http://cdn.opensuse.org/debug/distribution/leap/${releasever}/repo/oss/$basearch gpgkey=http://cdn.opensuse.org/debug/distribution/leap/${releasever}/repo/oss/$basearch/repodata/repomd.xml.key EOF cat <<'EOF' >$Dir_ZYppRepos/openSUSE:repo-oss.repo [openSUSE:repo-oss] name=repo-oss (${releasever}) enabled=1 autorefresh=1 baseurl=http://cdn.opensuse.org/distribution/leap/${releasever}/repo/oss/$basearch gpgkey=http://cdn.opensuse.org/distribution/leap/${releasever}/repo/oss/$basearch/repodata/repomd.xml.key EOF cat <<'EOF' >$Dir_ZYppRepos/openSUSE:repo-oss-source.repo [openSUSE:repo-oss-source] name=repo-oss-source (${releasever}) enabled=0 autorefresh=1 baseurl=http://cdn.opensuse.org/source/distribution/leap/${releasever}/repo/oss gpgkey=http://cdn.opensuse.org/source/distribution/leap/${releasever}/repo/oss/repodata/repomd.xml.key EOF ;; 15) case "${2#*.}" in [0-2]) cat <<'EOF' >$Dir_ZYppRepos/repo-debug-non-oss.repo [repo-debug-non-oss] name=Debug Repository (Non-OSS) enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/debug/distribution/leap/$releasever/repo/non-oss/ type=NONE keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-debug.repo [repo-debug] name=Debug Repository enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/debug/distribution/leap/$releasever/repo/oss/ type=NONE keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-debug-update-non-oss.repo [repo-debug-update-non-oss] name=Update Repository (Debug, Non-OSS) enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/debug/update/leap/$releasever/non-oss/ type=NONE keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-debug-update.repo [repo-debug-update] name=Update Repository (Debug) enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/debug/update/leap/$releasever/oss/ type=NONE keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-non-oss.repo [repo-non-oss] name=Non-OSS Repository enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/distribution/leap/$releasever/repo/non-oss/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-oss.repo [repo-oss] name=Main Repository enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/distribution/leap/$releasever/repo/oss/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-source-non-oss.repo [repo-source-non-oss] name=Source Repository (Non-OSS) enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/source/distribution/leap/$releasever/repo/non-oss/ type=NONE keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-source.repo [repo-source] name=Source Repository enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/source/distribution/leap/$releasever/repo/oss/ type=NONE keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-update-non-oss.repo [repo-update-non-oss] name=Update Repository (Non-Oss) enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/update/leap/$releasever/non-oss/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-update.repo [repo-update] name=Main Update Repository enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/update/leap/$releasever/oss/ type=rpm-md keeppackages=0 EOF ;; *) cat <<'EOF' >$Dir_ZYppRepos/repo-backports-debug-update.repo [repo-backports-debug-update] name=Update repository with updates for openSUSE Leap debuginfo packages from openSUSE Backports enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/update/leap/$releasever/backports_debug/ type=NONE keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-backports-update.repo [repo-backports-update] name=Update repository of openSUSE Backports enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/update/leap/$releasever/backports/ path=/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-debug-non-oss.repo [repo-debug-non-oss] name=Debug Repository (Non-OSS) enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/debug/distribution/leap/$releasever/repo/non-oss/ keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-debug.repo [repo-debug] name=Debug Repository enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/debug/distribution/leap/$releasever/repo/oss/ keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-debug-update-non-oss.repo [repo-debug-update-non-oss] name=Update Repository (Debug, Non-OSS) enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/debug/update/leap/$releasever/non-oss/ keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-debug-update.repo [repo-debug-update] name=Update Repository (Debug) enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/debug/update/leap/$releasever/oss/ keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-non-oss.repo [repo-non-oss] name=Non-OSS Repository enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/distribution/leap/$releasever/repo/non-oss/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-openh264.repo [repo-openh264] name=Open H.264 Codec (openSUSE Leap) enabled=1 autorefresh=1 baseurl=http://codecs.opensuse.org/openh264/openSUSE_Leap/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-oss.repo [repo-oss] name=Main Repository enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/distribution/leap/$releasever/repo/oss/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-sle-debug-update.repo [repo-sle-debug-update] name=Update repository with debuginfo for updates from SUSE Linux Enterprise 15 enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/debug/update/leap/$releasever/sle/ path=/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-sle-update.repo [repo-sle-update] name=Update repository with updates from SUSE Linux Enterprise 15 enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/update/leap/$releasever/sle/ path=/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-source.repo [repo-source] name=Source Repository enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/source/distribution/leap/$releasever/repo/oss/ keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-update-non-oss.repo [repo-update-non-oss] name=Update Repository (Non-Oss) enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/update/leap/$releasever/non-oss/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-update.repo [repo-update] name=Main Update Repository enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/update/leap/$releasever/oss/ type=rpm-md keeppackages=0 EOF ;; esac ;; esac ;; "tumbleweed") cat <<'EOF' >$Dir_ZYppRepos/repo-debug.repo [repo-debug] name=openSUSE-Tumbleweed-Debug enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/debug/tumbleweed/repo/oss/ path=/ keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-non-oss.repo [repo-non-oss] name=openSUSE-Tumbleweed-Non-Oss enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/tumbleweed/repo/non-oss/ path=/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-openh264.repo [repo-openh264] name=Open H.264 Codec (openSUSE Tumbleweed) enabled=1 autorefresh=1 baseurl=http://codecs.opensuse.org/openh264/openSUSE_Tumbleweed path=/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-oss.repo [repo-oss] name=openSUSE-Tumbleweed-Oss enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/tumbleweed/repo/oss/ path=/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-source.repo [repo-source] name=openSUSE-Tumbleweed-Source enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/source/tumbleweed/repo/oss/ path=/ keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-update.repo [repo-update] name=openSUSE-Tumbleweed-Update enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/update/tumbleweed/ path=/ type=rpm-md keeppackages=0 EOF ;; esac } ## 生成 EPEL 附加软件包 repo 源文件 function gen_repo_files_EPEL() { case "${1}" in 10) cat <<'EOF' >$Dir_YumRepos/epel.repo [epel] name=Extra Packages for Enterprise Linux $releasever - $basearch #baseurl=https://download.example/pub/epel/$releasever_major${releasever_minor:+.$releasever_minor}/Everything/$basearch/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-$releasever_major${releasever_minor:+.$releasever_minor}&arch=$basearch gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever_major gpgcheck=1 repo_gpgcheck=0 metadata_expire=24h countme=1 enabled=1 [epel-debuginfo] name=Extra Packages for Enterprise Linux $releasever - $basearch - Debug #baseurl=https://download.example/pub/epel/$releasever_major${releasever_minor:+.$releasever_minor}/Everything/$basearch/debug/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-$releasever_major${releasever_minor:+.$releasever_minor}&arch=$basearch gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever_major gpgcheck=1 repo_gpgcheck=0 metadata_expire=24h enabled=0 [epel-source] name=Extra Packages for Enterprise Linux $releasever - $basearch - Source #baseurl=https://download.example/pub/epel/$releasever_major${releasever_minor:+.$releasever_minor}/Everything/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-$releasever_major${releasever_minor:+.$releasever_minor}&arch=$basearch gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever_major gpgcheck=1 repo_gpgcheck=0 metadata_expire=24h enabled=0 EOF cat <<'EOF' >$Dir_YumRepos/epel-testing.repo [epel-testing] name=Extra Packages for Enterprise Linux $releasever - Testing - $basearch #baseurl=https://download.example/pub/epel/testing/$releasever_major${releasever_minor:+.$releasever_minor}/Everything/$basearch/ metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-epel$releasever_major${releasever_minor:+.$releasever_minor}&arch=$basearch gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever_major gpgcheck=1 repo_gpgcheck=0 metadata_expire=24h countme=1 enabled=0 [epel-testing-debuginfo] name=Extra Packages for Enterprise Linux $releasever - Testing - $basearch - Debug #baseurl=https://download.example/pub/epel/testing/$releasever_major${releasever_minor:+.$releasever_minor}/Everything/$basearch/debug/ metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel$releasever_major${releasever_minor:+.$releasever_minor}&arch=$basearch gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever_major gpgcheck=1 repo_gpgcheck=0 metadata_expire=24h enabled=0 [epel-testing-source] name=Extra Packages for Enterprise Linux $releasever - Testing - $basearch - Source #baseurl=https://download.example/pub/epel/testing/$releasever_major${releasever_minor:+.$releasever_minor}/Everything/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel$releasever_major${releasever_minor:+.$releasever_minor}&arch=$basearch gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever_major gpgcheck=1 repo_gpgcheck=0 metadata_expire=24h enabled=0 EOF ;; 9) cat <<'EOF' >$Dir_YumRepos/epel.repo [epel] name=Extra Packages for Enterprise Linux $releasever - $basearch #baseurl=https://download.example/pub/epel/$releasever/Everything/$basearch/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-$releasever&arch=$basearch&infra=$infra&content=$contentdir enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever [epel-debuginfo] name=Extra Packages for Enterprise Linux $releasever - $basearch - Debug #baseurl=https://download.example/pub/epel/$releasever/Everything/$basearch/debug/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-$releasever&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever gpgcheck=1 [epel-source] name=Extra Packages for Enterprise Linux $releasever - $basearch - Source #baseurl=https://download.example/pub/epel/$releasever/Everything/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-$releasever&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/epel-testing.repo [epel-testing] name=Extra Packages for Enterprise Linux $releasever - Testing - $basearch #baseurl=https://download.example/pub/epel/testing/$releasever/Everything/$basearch/ metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever [epel-testing-debuginfo] name=Extra Packages for Enterprise Linux $releasever - Testing - $basearch - Debug #baseurl=https://download.example/pub/epel/testing/$releasever/Everything/$basearch/debug/ metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever gpgcheck=1 [epel-testing-source] name=Extra Packages for Enterprise Linux $releasever - Testing - $basearch - Source #baseurl=https://download.example/pub/epel/testing/$releasever/Everything/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever gpgcheck=1 EOF ## 此仓库特殊,默认不启用 cat <<'EOF' >$Dir_YumRepos/epel-cisco-openh264.repo [epel-cisco-openh264] name=Extra Packages for Enterprise Linux $releasever openh264 (From Cisco) - $basearch metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-cisco-openh264-$releasever&arch=$basearch type=rpm enabled=0 metadata_expire=14d repo_gpgcheck=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever skip_if_unavailable=True [epel-cisco-openh264-debuginfo] name=Extra Packages for Enterprise Linux $releasever openh264 (From Cisco) - $basearch - Debug metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-cisco-openh264-debug-$releasever&arch=$basearch type=rpm enabled=0 metadata_expire=14d repo_gpgcheck=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever skip_if_unavailable=True [epel-cisco-openh264-source] name=Extra Packages for Enterprise Linux $releasever openh264 (From Cisco) - $basearch - Source metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-cisco-openh264-source-$releasever&arch=$basearch type=rpm enabled=0 metadata_expire=14d repo_gpgcheck=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever skip_if_unavailable=True EOF ;; 8) cat <<'EOF' >$Dir_YumRepos/epel.repo [epel] name=Extra Packages for Enterprise Linux 8 - $basearch #baseurl=https://download.example/pub/epel/8/Everything/$basearch metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=$basearch&infra=$infra&content=$contentdir enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 [epel-debuginfo] name=Extra Packages for Enterprise Linux 8 - $basearch - Debug #baseurl=https://download.example/pub/epel/8/Everything/$basearch/debug metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 gpgcheck=1 [epel-source] name=Extra Packages for Enterprise Linux 8 - $basearch - Source #baseurl=https://download.example/pub/epel/8/Everything/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/epel-testing.repo [epel-testing] name=Extra Packages for Enterprise Linux 8 - Testing - $basearch #baseurl=https://download.example/pub/epel/testing/8/Everything/$basearch metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-epel8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 [epel-testing-debuginfo] name=Extra Packages for Enterprise Linux 8 - Testing - $basearch - Debug #baseurl=https://download.example/pub/epel/testing/8/Everything/$basearch/debug metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 gpgcheck=1 [epel-testing-source] name=Extra Packages for Enterprise Linux 8 - Testing - $basearch - Source #baseurl=https://download.example/pub/epel/testing/8/Everything/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/epel-modular.repo [epel-modular] name=Extra Packages for Enterprise Linux Modular 8 - $basearch - RETIRED #baseurl=https://download.example/pub/epel/8/Modular/$basearch metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-modular-8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 [epel-modular-debuginfo] name=Extra Packages for Enterprise Linux Modular 8 - $basearch - Debug - RETIRED #baseurl=https://download.example/pub/epel/8/Modular/$basearch/debug metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-modular-debug-8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 gpgcheck=1 [epel-modular-source] name=Extra Packages for Enterprise Linux Modular 8 - $basearch - Source - RETIRED #baseurl=https://download.example/pub/epel/8/Modular/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-modular-source-8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/epel-testing-modular.repo [epel-testing-modular] name=Extra Packages for Enterprise Linux Modular 8 - Testing - $basearch - RETIRED #baseurl=https://download.example/pub/epel/testing/8/Modular/$basearch metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-modular-epel8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 [epel-testing-modular-debuginfo] name=Extra Packages for Enterprise Linux Modular 8 - Testing - $basearch - Debug - RETIRED #baseurl=https://download.example/pub/epel/testing/8/Modular/$basearch/debug metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-modular-debug-epel8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 gpgcheck=1 [epel-testing-modular-source] name=Extra Packages for Enterprise Linux Modular 8 - Testing - $basearch - Source - RETIRED #baseurl=https://download.example/pub/epel/testing/8/Modular/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-modular-source-epel8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 gpgcheck=1 EOF ;; 7) cat <<'EOF' >$Dir_YumRepos/epel.repo [epel] name=Extra Packages for Enterprise Linux 7 - $basearch #baseurl=http://download.example/pub/epel/7/$basearch metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch&infra=$infra&content=$contentdir failovermethod=priority enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 [epel-debuginfo] name=Extra Packages for Enterprise Linux 7 - $basearch - Debug #baseurl=http://download.example/pub/epel/7/$basearch/debug metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch&infra=$infra&content=$contentdir failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 gpgcheck=1 [epel-source] name=Extra Packages for Enterprise Linux 7 - $basearch - Source #baseurl=http://download.example/pub/epel/7/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch&infra=$infra&content=$contentdir failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/epel-testing.repo [epel-testing] name=Extra Packages for Enterprise Linux 7 - Testing - $basearch #baseurl=http://download.example/pub/epel/testing/7/$basearch metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-epel7&arch=$basearch&infra=$infra&content=$contentdir failovermethod=priority enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 [epel-testing-debuginfo] name=Extra Packages for Enterprise Linux 7 - Testing - $basearch - Debug #baseurl=http://download.example/pub/epel/testing/7/$basearch/debug metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel7&arch=$basearch&infra=$infra&content=$contentdir failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 gpgcheck=1 [epel-testing-source] name=Extra Packages for Enterprise Linux 7 - Testing - $basearch - Source #baseurl=http://download.example/pub/epel/testing/7/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel7&arch=$basearch&infra=$infra&content=$contentdir failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 gpgcheck=1 EOF ;; esac } ## 生成 EPEL 附加软件包 NEXT repo 源文件 function gen_repo_files_EPEL_NEXT() { case "${1}" in 9) cat <<'EOF' >$Dir_YumRepos/epel-next.repo [epel-next] name=Extra Packages for Enterprise Linux 9 - Next - $basearch #baseurl=https://download.example/pub/epel/next/9/Everything/$basearch/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-next-9&arch=$basearch&infra=$infra&content=$contentdir enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9 [epel-next-debuginfo] name=Extra Packages for Enterprise Linux 9 - Next - $basearch - Debug #baseurl=https://download.example/pub/epel/next/9/Everything/$basearch/debug/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-next-debug-9&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9 gpgcheck=1 [epel-next-source] name=Extra Packages for Enterprise Linux 9 - Next - $basearch - Source #baseurl=https://download.example/pub/epel/next/9/Everything/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-next-source-9&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9 gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/epel-next-testing.repo [epel-next-testing] name=Extra Packages for Enterprise Linux 9 - Next - Testing - $basearch #baseurl=https://download.example/pub/epel/testing/next/9/Everything/$basearch/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-testing-next-9&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9 [epel-next-testing-debuginfo] name=Extra Packages for Enterprise Linux 9 - Next - Testing - $basearch - Debug #baseurl=https://download.example/pub/epel/testing/next/9/Everything/$basearch/debug/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-testing-next-debug-9&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9 gpgcheck=1 [epel-next-testing-source] name=Extra Packages for Enterprise Linux 9 - Next - Testing - $basearch - Source #baseurl=https://download.example/pub/epel/testing/next/9/Everything/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-testing-next-source-9&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9 gpgcheck=1 EOF ;; esac } ############################################################################## MESSAGE_LANG_DEFAULT='zh-hans' MESSAGE_LANG_KEYS=( "zh-hans" "zh-hant" "en" ) declare -A MESSAGE_LANG_DISPLAY=( ['zh-hans']='简体中文' ['zh-hant']='繁體中文' ['en']='English' ) declare -A MESSAGE_CONTENTS function msg() { local key="$1" shift local text="${MESSAGE_CONTENTS[${key}]}" if [[ -z "${text}" ]]; then echo "${key}" return fi while [[ $# -gt 0 ]]; do if [[ "${text}" == *"{}"* ]]; then text="${text/\{\}/$1}" else break fi shift done echo "${text}" } function init_msg_pack() { function load_pack() { local func_name="${1}" if declare -f "${func_name}" >/dev/null 2>&1; then eval "${func_name}" fi } local current_lang="${1:-${MESSAGE_LANG_DEFAULT}}" current_lang="$(echo "${current_lang}" | sed 's/^-*//')" current_lang="${current_lang,,}" if [[ "${MESSAGE_LANG_DISPLAY[${current_lang}]}" ]]; then current_lang="${current_lang//-/_}" load_pack "msg_pack_${current_lang}" fi } function msg_pack_zh_hans() { MESSAGE_CONTENTS=( ['start.welcome']='欢迎使用 GNU/Linux 更换系统软件源脚本' ['start.runtimeEnv']='运行环境' ['start.dateTime']='系统时间' ['end.moreInfo']='脚本运行完毕,更多使用教程详见官网' ['end.sponsorAds']='【赞助商广告】' ['error.cmd.options.needConfirm']='请确认后重新输入' ['error.cmd.options.needSpecify']='请在该选项后指定{}' ['error.cmd.options.invalid']='命令选项 {} 无效,{}!' ['error.cmd.options.validAddress']='有效的地址' ['error.cmd.options.sourceAddress']='软件源地址' ['error.cmd.options.sourceRepository']='软件源仓库' ['error.cmd.options.codename']='版本代号' ['error.cmd.options.boolean']=' true 或 false ' ['error.cmd.options.protocol']=' http 或 https ' ['error.cmd.options.needProtocol']=' Web 协议(http/https)' ['error.cmd.options.validLangKey']='有效的语言 ID ' ['error.cmd.options.langKey']='语言 ' ['error.cmd.options.unsupportTwoSourceMode']='不可同时使用两种软件源模式,请确认后重试!' ['error.cmd.options.unsupportCodename']='当前系统不支持使用指定版本代号命令选项,请确认后重试!' ['error.cmd.options.unsupportEPEL']='当前系统不支持安装 EPEL 附加软件包,请确认后重试!' ['error.unsupportSystem']='不支持当前操作系统({}),请前往官网查看支持列表!' ['error.unsupportVersion']='不支持当前系统版本' ['error.unknownSystem']='未知系统' ['error.unknownVersion']='系统版本未知' ['error.input']='输入错误,{}!' ['error.needRoot']='权限不足,请切换至 root 账户后运行本脚本,切换命令 {}' ['error.defaultBehavior.https']='默认使用 HTTPS 协议' ['error.defaultBehavior.noReplace']='默认不更换' ['error.defaultBehavior.noOverwrite']='默认不覆盖' ['error.defaultBehavior.noUpdate']='默认不更新' ['error.defaultBehavior.noClean']='默认不清理' ['error.defaultBehavior.noUseIntranetSource']='默认不使用内网地址' ['warn.usedIntranetSource']='已切换至内网专用地址,仅限在特定环境下使用!' ['warn.unstableDebian']='检测到当前系统为 {} 版本,可能会产生一些无法预料的问题。' ['warn.EPEL7']='Extra Packages for Enterprise Linux 7 已结束生命周期并被官方移至归档库!' ['warn.needValidNumberIndex']='请输入有效的数字序号!' ['warn.needInputNumberIndex']='请输入数字序号!' ['info.backuped.sourceFile']='已备份原有 {} 源文件' ['tip.EPEL7']='目前部分镜像站没有同步该归档仓库,若换源后出现错误那么请先检查目标镜像站是否支持该仓库。' ['interaction.source.type.public']='公网' ['interaction.source.type.intranet']='内网' ['interaction.source.type.select']='请选择软件源的网络地址(访问方式):' ['interaction.source.type.usePublicAddress']='默认使用软件源的公网地址,是否继续' ['interaction.source.select']='请选择你想使用的软件源:' ['interaction.source.selectAndInput']='请选择并输入你想使用的软件源' ['interaction.protocol.select']='请选择软件源网络协议:' ['interaction.protocol.useHttp']='软件源是否使用 HTTP 协议' ['interaction.epel.skipReplace']='检测到系统已安装 EPEL 附加软件包,是否替换/覆盖软件源' ['interaction.epel.install']='是否安装 EPEL 附加软件包' ['interaction.backup.skipOverwrite.sourceFile']='检测到系统存在已备份的 {} 源文件,是否跳过覆盖备份' ['interaction.upgrade.skip']='是否跳过更新软件包' ['interaction.cache.autoClean']='在更新软件包后,是否自动清理下载缓存' ['interaction.common.tip']='提示' ['interaction.common.operationCanceled']='操作已取消' ['interaction.common.yes']='是' ['interaction.common.no']='否' ['work.upgradeSoftware']='更新软件包' ['work.installEPELPackage']='安装 epel-release 软件包...' ['source.sync.text1']='更新软件源' ['source.sync.text2']='生成软件源缓存' ['source.sync.text3']='刷新软件源' ['source.sync.text4']='同步软件源' ['source.sync.text5']='更新二进制缓存与频道源' ['source.comment.disabledSourceCode']='默认禁用源码镜像以提高更新速度,如需启用请自行取消注释' ['source.comment.securitySource']='安全更新软件源' ['source.comment.proposedSource']='预发布软件源(不建议启用)' ['source.changeResult.success']='软件源更换完毕' ['source.changeResult.fail']='软件源更换完毕,但{}失败' ['source.changeResult.tipTitle']='请再次执行脚本并更换相同软件源后进行尝试,若仍然{}失败那么可能由以下原因导致:' ['source.changeResult.tip1']='网络连通性问题:例如连接异常、由地区影响的网络间歇式中断、禁止外部访问、软件源网站防火墙阻断等' ['source.changeResult.tip2']='目标软件源异常:请手动前往软件源(镜像站)地址进行验证:{}' ['source.changeResult.tip2.1']='若报错内容是提示某个文件不存在那么有可能是软件源的问题,多常见于正在同步中的软件源仓库' ['source.changeResult.tip2.2']='若报错内容是目录(path)不存在也有可能是目标软件源不存在当前系统镜像仓库,即不支持当前系统' ['source.changeResult.tip2.3']='建议更换其它镜像站进行尝试,少数情况下软件源若处于同步中状态则可能会出现文件同步错误问题' ['source.changeResult.tip3']='原有软件源报错:请先排除系统原有的其它软件源报错,因为脚本不会干预这些无关的软件源配置,解决后重新运行脚本即可' ['commands.help']='命令选项(名称/含义/值): --abroad 使用境外以及海外软件源 无 --edu 使用中国大陆教育网软件源 无 --source 指定软件源地址(域名或IP) 地址 --source-epel 指定 EPEL 附加软件包仓库的软件源地址(域名或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) 地址 --branch 指定软件源仓库(路径) 仓库名 --branch-epel 指定 EPEL 附加软件包仓库的软件源仓库(路径) 仓库名 --branch-security 指定 Debian 系统 security 仓库的软件源仓库(路径) 仓库名 --branch-vault 指定 CentOS / AlmaLinux 系统 vault 仓库的软件源仓库(路径) 仓库名 --branch-portage 指定 Gentoo 系统 portage 仓库的软件源仓库(路径) 仓库名 --branch-base-system 指定 Linux Mint / Raspberry Pi OS 底层系统的软件源仓库(路径) 仓库名 --codename 指定 Debian 系 / openKylin 操作系统的版本代号 代号名称 --protocol 指定 Web 协议 http 或 https --use-intranet-source 是否优先使用内网软件源地址 true 或 false --use-official-source 是否使用目标操作系统的官方软件源 true 或 false --use-official-source-epel 是否使用 EPEL 附加软件包的官方软件源 true 或 false --install-epel 是否安装 EPEL 附加软件包 true 或 false --backup 是否备份原有软件源 true 或 false --upgrade-software 是否更新软件包 true 或 false --clean-cache 是否在更新软件包后清理下载缓存 true 或 false --clean-screen 是否在运行前清除屏幕上的所有内容 true 或 false --lang 指定脚本输出的语言 语言 --only-epel 仅更换 EPEL 软件源模式 无 --ignore-backup-tips 忽略覆盖备份提示 无 --print-diff 打印源文件修改前后差异 无 --pure-mode 纯净模式,精简打印内容 无 --help 查看帮助菜单 无 问题报告 {}' ['mirrors.default.0']='阿里云' ['mirrors.default.1']='腾讯云' ['mirrors.default.2']='华为云' ['mirrors.default.3']='移动云' ['mirrors.default.4']='天翼云' ['mirrors.default.5']='网易' ['mirrors.default.6']='火山引擎' ['mirrors.default.7']='清华大学' ['mirrors.default.8']='北京大学' ['mirrors.default.9']='浙江大学' ['mirrors.default.10']='南京大学' ['mirrors.default.11']='兰州大学' ['mirrors.default.12']='上海交通大学' ['mirrors.default.13']='重庆邮电大学' ['mirrors.default.14']='中国科学技术大学' ['mirrors.default.15']='中国科学院软件研究所' ['mirrors.default.16']='官方源' ['mirrors.edu.0']='北京大学' ['mirrors.edu.1']='北京交通大学' ['mirrors.edu.2']='北京外国语大学' ['mirrors.edu.3']='北京邮电大学' ['mirrors.edu.4']='重庆大学' ['mirrors.edu.5']='重庆邮电大学' ['mirrors.edu.6']='大连东软信息学院' ['mirrors.edu.7']='电子科技大学' ['mirrors.edu.8']='华南农业大学' ['mirrors.edu.9']='华中科技大学' ['mirrors.edu.10']='吉林大学' ['mirrors.edu.11']='荆楚理工学院' ['mirrors.edu.12']='江西理工大学' ['mirrors.edu.13']='兰州大学' ['mirrors.edu.14']='南京大学' ['mirrors.edu.15']='南京工业大学' ['mirrors.edu.16']='南京邮电大学' ['mirrors.edu.17']='南方科技大学' ['mirrors.edu.18']='南阳理工学院' ['mirrors.edu.19']='齐鲁工业大学' ['mirrors.edu.20']='清华大学' ['mirrors.edu.21']='山东大学' ['mirrors.edu.22']='上海科技大学' ['mirrors.edu.23']='上海交通大学(思源)' ['mirrors.edu.24']='上海交通大学(致远)' ['mirrors.edu.25']='武昌首义学院' ['mirrors.edu.26']='西安交通大学' ['mirrors.edu.27']='西北农林科技大学' ['mirrors.edu.28']='浙江大学' ['mirrors.edu.29']='中国科学技术大学' ['mirrors.edu.30']='官方源' ['mirrors.abroad.0']='亚洲 · xTom · 香港' ['mirrors.abroad.1']='亚洲 · 01Link · 香港' ['mirrors.abroad.2']='亚洲 · 新加坡国立大学(NUS) · 新加坡' ['mirrors.abroad.3']='亚洲 · SG.GS · 新加坡' ['mirrors.abroad.4']='亚洲 · xTom · 新加坡' ['mirrors.abroad.5']='亚洲 · 自由软件实验室(NCHC) · 台湾' ['mirrors.abroad.6']='亚洲 · OSS Planet · 台湾' ['mirrors.abroad.7']='亚洲 · 国立阳明交通大学 · 台湾' ['mirrors.abroad.8']='亚洲 · 淡江大学 · 台湾' ['mirrors.abroad.9']='亚洲 · Taiwan Digital Streaming · 台湾' ['mirrors.abroad.10']='亚洲 · AniGil Linux Archive · 韩国' ['mirrors.abroad.11']='亚洲 · 工业网络安全中心(ICSCoE) · 日本' ['mirrors.abroad.12']='亚洲 · 北陆先端科学技术大学院大学(JAIST) · 日本' ['mirrors.abroad.13']='亚洲 · 山形大学 · 日本' ['mirrors.abroad.14']='亚洲 · xTom · 日本' ['mirrors.abroad.15']='亚洲 · GB Network Solutions · 马来西亚' ['mirrors.abroad.16']='亚洲 · 孔敬大学 · 泰国' ['mirrors.abroad.17']='欧洲 · Vorboss Ltd · 英国' ['mirrors.abroad.18']='欧洲 · QuickHost · 英国' ['mirrors.abroad.19']='欧洲 · dogado · 德国' ['mirrors.abroad.20']='欧洲 · xTom · 德国' ['mirrors.abroad.21']='欧洲 · 亚琛工业大学(RWTH Aachen) · 德国' ['mirrors.abroad.22']='欧洲 · 德累斯顿大学(AG DSN) · 德国' ['mirrors.abroad.23']='欧洲 · CCIN2P3 · 法国' ['mirrors.abroad.24']='欧洲 · Ircam · 法国' ['mirrors.abroad.25']='欧洲 · Crans · 法国' ['mirrors.abroad.26']='欧洲 · CRIHAN · 法国' ['mirrors.abroad.27']='欧洲 · xTom · 荷兰' ['mirrors.abroad.28']='欧洲 · DataPacket · 荷兰' ['mirrors.abroad.29']='欧洲 · Linux Kernel · 荷兰' ['mirrors.abroad.30']='欧洲 · xTom · 爱沙尼亚' ['mirrors.abroad.31']='欧洲 · netsite · 丹麦' ['mirrors.abroad.32']='欧洲 · Dotsrc · 丹麦' ['mirrors.abroad.33']='欧洲 · Academic Computer Club · 瑞典' ['mirrors.abroad.34']='欧洲 · Lysator · 瑞典' ['mirrors.abroad.35']='欧洲 · Yandex · 俄罗斯' ['mirrors.abroad.36']='欧洲 · ia64 · 俄罗斯' ['mirrors.abroad.37']='欧洲 · Truenetwork · 俄罗斯' ['mirrors.abroad.38']='欧洲 · Belgian Research Network · 比利时' ['mirrors.abroad.39']='欧洲 · 克里特大学计算机中心 · 希腊' ['mirrors.abroad.40']='欧洲 · 马萨里克大学信息学院 · 捷克' ['mirrors.abroad.41']='欧洲 · 捷克理工大学学生会俱乐部(Silicon Hill) · 捷克' ['mirrors.abroad.42']='欧洲 · Vodafone · 捷克' ['mirrors.abroad.43']='欧洲 · CZ.NIC · 捷克' ['mirrors.abroad.44']='欧洲 · 苏黎世联邦理工学院 · 瑞士' ['mirrors.abroad.45']='北美 · Linux Kernel · 美国' ['mirrors.abroad.46']='北美 · 麻省理工学院(MIT) · 美国' ['mirrors.abroad.47']='北美 · 普林斯顿大学数学系 · 美国' ['mirrors.abroad.48']='北美 · 俄勒冈州立大学开源实验室 · 美国' ['mirrors.abroad.49']='北美 · Fremont Cabal Internet Exchange(FCIX) · 美国' ['mirrors.abroad.50']='北美 · xTom · 美国' ['mirrors.abroad.51']='北美 · Steadfast · 美国' ['mirrors.abroad.52']='北美 · 不列颠哥伦比亚大学 · 加拿大' ['mirrors.abroad.53']='北美 · GoCodeIT · 加拿大' ['mirrors.abroad.54']='北美 · Switch · 加拿大' ['mirrors.abroad.55']='南美 · PoP-SC · 巴西' ['mirrors.abroad.56']='南美 · 蓬塔格罗萨州立大学 · 巴西' ['mirrors.abroad.57']='南美 · UFSCar · 巴西' ['mirrors.abroad.58']='南美 · Sysarmy Community · 阿根廷' ['mirrors.abroad.59']='大洋 · Fremont Cabal Internet Exchange(FCIX) · 澳大利亚' ['mirrors.abroad.60']='大洋 · AARNet · 澳大利亚' ['mirrors.abroad.61']='大洋 · DataMossa · 澳大利亚' ['mirrors.abroad.62']='大洋 · Amaze · 澳大利亚' ['mirrors.abroad.63']='大洋 · xTom · 澳大利亚' ['mirrors.abroad.64']='大洋 · Over the Wire · 澳大利亚' ['mirrors.abroad.65']='大洋 · Free Software Mirror Group · 新西兰' ['mirrors.abroad.66']='非洲 · Liquid Telecom · 肯尼亚' ['mirrors.abroad.67']='非洲 · Dimension Data · 南非' ['mirrors.abroad.68']='官方源' ) } function msg_pack_zh_hant() { MESSAGE_CONTENTS=( ['start.welcome']='歡迎使用 GNU/Linux 更換系統軟體源腳本' ['start.runtimeEnv']='執行環境' ['start.dateTime']='系統時間' ['end.moreInfo']='腳本執行完畢,更多使用教學詳見官網' ['end.sponsorAds']='【贊助商廣告】' ['error.cmd.options.needConfirm']='請確認後重新輸入' ['error.cmd.options.needSpecify']='請在該選項後指定{}' ['error.cmd.options.invalid']='命令選項 {} 無效,{}!' ['error.cmd.options.invalid']='命令選項 {} 無效,{}!' ['error.cmd.options.validAddress']='有效的地址' ['error.cmd.options.sourceAddress']='軟體源地址' ['error.cmd.options.sourceRepository']='軟體源倉庫' ['error.cmd.options.codename']='版本代號' ['error.cmd.options.boolean']=' true 或 false ' ['error.cmd.options.protocol']=' http 或 https ' ['error.cmd.options.needProtocol']=' Web 協定(http/https)' ['error.cmd.options.validLangKey']='有效的語言 ID ' ['error.cmd.options.langKey']='語言 ID ' ['error.cmd.options.unsupportTwoSourceMode']='不可同時使用兩種軟體源模式,請確認後重試!' ['error.cmd.options.unsupportCodename']='當前系統不支援使用指定版本代號命令選項,請確認後重試!' ['error.cmd.options.unsupportEPEL']='當前系統不支援安裝 EPEL 附加軟體包,請確認後重試!' ['error.unsupportSystem']='不支援當前系統({}),請前往官網查看支援清單!' ['error.unsupportVersion']='不支援當前系統版本' ['error.unknownSystem']='未知系統' ['error.unknownVersion']='系統版本未知' ['error.input']='輸入錯誤,{}!' ['error.needRoot']='權限不足,請切換至 root 帳戶後執行本腳本,切換指令 {}' ['error.defaultBehavior.https']='預設使用 HTTPS 協定' ['error.defaultBehavior.noReplace']='預設不更換' ['error.defaultBehavior.noOverwrite']='預設不覆蓋' ['error.defaultBehavior.noUpdate']='預設不更新' ['error.defaultBehavior.noClean']='預設不清理' ['error.defaultBehavior.noUseIntranetSource']='預設不使用內網地址' ['warn.usedIntranetSource']='已切換至內網專用地址,僅限在特定環境下使用!' ['warn.unstableDebian']='偵測到當前系統為 {} 版本,可能會產生一些無法預料的問題。' ['warn.EPEL7']='Extra Packages for Enterprise Linux 7 已結束生命週期並被官方移至封存庫!' ['warn.needValidNumberIndex']='請輸入有效的數字序號!' ['warn.needInputNumberIndex']='請輸入數字序號!' ['info.backuped.sourceFile']='已備份原有 {} 源檔案' ['tip.EPEL7']='目前部分鏡像站尚未同步該封存倉庫,若換源後出現錯誤請先檢查目標鏡像站是否支援該倉庫。' ['interaction.source.type.public']='外網' ['interaction.source.type.intranet']='內網' ['interaction.source.type.select']='請選擇軟體源的網路地址(存取方式):' ['interaction.source.type.usePublicAddress']='預設使用軟體源的外網地址,是否繼續' ['interaction.source.select']='請選擇你想使用的軟體源:' ['interaction.source.selectAndInput']='請選擇並輸入你想使用的軟體源' ['interaction.protocol.select']='請選擇軟體源網路協定:' ['interaction.protocol.useHttp']='軟體源是否使用 HTTP 协议' ['interaction.epel.skipReplace']='偵測到系統已安裝 EPEL 附加軟體包,是否替換/覆蓋軟體源' ['interaction.epel.install']='是否安裝 EPEL 附加軟體包' ['interaction.backup.skipOverwrite.sourceFile']='偵測到系統存在已備份的 {} 源檔案,是否跳過覆蓋備份' ['interaction.upgrade.skip']='是否跳過更新軟體包' ['interaction.cache.autoClean']='在更新軟體包後,是否自動清理下載快取' ['interaction.common.tip']='提示' ['interaction.common.operationCanceled']='操作已取消' ['interaction.common.yes']='是' ['interaction.common.no']='否' ['work.upgradeSoftware']='更新軟體包' ['work.installEPELPackage']='正在安裝 epel-release 套件...' ['source.sync.text1']='更新軟體源' ['source.sync.text2']='產生軟體源快取' ['source.sync.text3']='重新整理軟體源' ['source.sync.text4']='同步軟體源' ['source.sync.text5']='更新二進位快取與頻道來源' ['source.comment.disabledSourceCode']='預設停用原始碼鏡像以提升更新速度,如需啟用請自行取消註解' ['source.comment.securitySource']='安全更新軟體源' ['source.comment.proposedSource']='預發布軟體源(不建議啟用)' ['source.changeResult.success']='軟體源更換完畢' ['source.changeResult.fail']='軟體源更換完畢,但{}失敗' ['source.changeResult.tipTitle']='請再次執行腳本並更換相同軟體源後重試,若仍然{}失敗則可能由下列原因造成:' ['source.changeResult.tip1']='網路連通性問題:例如連線異常、地域因素造成的網路間歇中斷、禁止外部存取、軟體源站台防火牆阻斷等' ['source.changeResult.tip2']='目標軟體源異常:請手動前往軟體源(鏡像站)地址進行驗證:{}' ['source.changeResult.tip2.1']='若錯誤內容是提示某個檔案不存在,可能是軟體源的問題,常見於鏡像站同步期間' ['source.changeResult.tip2.2']='若錯誤內容是目錄不存在,也可能代表目標軟體源不含當前系統的鏡像倉庫,即不支援當前系統' ['source.changeResult.tip2.3']='建議更換其他鏡像站再試,少數情況下軟體源若處於同步中狀態則可能會出現檔案同步錯誤' ['source.changeResult.tip3']='原有軟體源報錯:請先排除系統其他軟體源的錯誤,因為腳本不會處理無關的軟體源配置,解決後重新執行腳本即可' ['commands.help']='命令選項(名稱/含義/值): --abroad 使用境外以及海外軟體源 無 --edu 使用中國大陸教育網軟體源 無 --source 指定軟體源地址(網域名稱或IP) 位址 --source-epel 指定 EPEL 附加軟體包倉庫的軟體源地址(網域名稱或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) 位址 --branch 指定軟體源倉庫(路徑) 倉庫名稱 --branch-epel 指定 EPEL 附加軟體包倉庫的軟體源倉庫(路徑) 倉庫名稱 --branch-security 指定 Debian 系統 security 倉庫的軟體源倉庫(路徑) 倉庫名稱 --branch-vault 指定 CentOS / AlmaLinux 系統 vault 倉庫的軟體源倉庫(路徑) 倉庫名稱 --branch-portage 指定 Gentoo 系統 portage 倉庫的軟體源倉庫(路徑) 倉庫名稱 --branch-base-system 指定 Linux Mint / Raspberry Pi OS 底層系統的軟體源倉庫(路徑) 倉庫名稱 --codename 指定 Debian 系 / openKylin 系統的版本代號 代號名稱 --protocol 指定 Web 協定 http 或 https --use-intranet-source 是否優先使用內部網路軟體源位址 true 或 false --use-official-source 是否使用目標系統的官方軟體源 true 或 false --use-official-source-epel 是否使用 EPEL 附加軟體包的官方軟體源 true 或 false --install-epel 是否安裝 EPEL 附加軟體包 true 或 false --backup 是否備份原有軟體源 true 或 false --upgrade-software 是否更新軟體包 true 或 false --clean-cache 是否在更新軟體包後清理下載快取 true 或 false --clean-screen 是否在運行前清除螢幕上的所有內容 true 或 false --lang 指定腳本輸出的語言 语言 --only-epel 僅更換 EPEL 軟體源模式 無 --ignore-backup-tips 忽略覆蓋備份提示 無 --print-diff 是否列印原始文件修改前後差異 無 --pure-mode 純淨模式,精簡列印內容 無 --help 查看幫助選單 無 問題報告 {}' ['mirrors.default.0']='阿里雲' ['mirrors.default.1']='騰訊雲' ['mirrors.default.2']='華為雲' ['mirrors.default.3']='移動雲' ['mirrors.default.4']='天翼雲' ['mirrors.default.5']='網易' ['mirrors.default.6']='火山引擎' ['mirrors.default.7']='清華大學' ['mirrors.default.8']='北京大學' ['mirrors.default.9']='浙江大學' ['mirrors.default.10']='南京大學' ['mirrors.default.11']='蘭州大學' ['mirrors.default.12']='上海交通大學' ['mirrors.default.13']='重慶郵電大學' ['mirrors.default.14']='中國科學技術大學' ['mirrors.default.15']='中國科學院軟件研究所' ['mirrors.default.16']='官方源' ['mirrors.edu.0']='北京大學' ['mirrors.edu.1']='北京交通大學' ['mirrors.edu.2']='北京外國語大學' ['mirrors.edu.3']='北京郵電大學' ['mirrors.edu.4']='重慶大學' ['mirrors.edu.5']='重慶郵電大學' ['mirrors.edu.6']='大連東軟信息學院' ['mirrors.edu.7']='電子科技大學' ['mirrors.edu.8']='華南農業大學' ['mirrors.edu.9']='華中科技大學' ['mirrors.edu.10']='吉林大學' ['mirrors.edu.11']='荊楚理工學院' ['mirrors.edu.12']='江西理工大學' ['mirrors.edu.13']='蘭州大學' ['mirrors.edu.14']='南京大學' ['mirrors.edu.15']='南京工業大學' ['mirrors.edu.16']='南京郵電大學' ['mirrors.edu.17']='南方科技大學' ['mirrors.edu.18']='南陽理工學院' ['mirrors.edu.19']='齊魯工業大學' ['mirrors.edu.20']='清華大學' ['mirrors.edu.21']='山東大學' ['mirrors.edu.22']='上海科技大學' ['mirrors.edu.23']='上海交通大學(思源)' ['mirrors.edu.24']='上海交通大學(致遠)' ['mirrors.edu.25']='武昌首義學院' ['mirrors.edu.26']='西安交通大學' ['mirrors.edu.27']='西北農林科技大學' ['mirrors.edu.28']='浙江大學' ['mirrors.edu.29']='中國科學技術大學' ['mirrors.edu.30']='官方源' ['mirrors.abroad.0']='亞洲 · xTom · 香港' ['mirrors.abroad.1']='亞洲 · 01Link · 香港' ['mirrors.abroad.2']='亞洲 · 新加坡國立大學(NUS) · 新加坡' ['mirrors.abroad.3']='亞洲 · SG.GS · 新加坡' ['mirrors.abroad.4']='亞洲 · xTom · 新加坡' ['mirrors.abroad.5']='亞洲 · 自由軟體實驗室(NCHC) · 臺灣' ['mirrors.abroad.6']='亞洲 · OSS Planet · 臺灣' ['mirrors.abroad.7']='亞洲 · 國立陽明交通大學 · 臺灣' ['mirrors.abroad.8']='亞洲 · 淡江大學 · 臺灣' ['mirrors.abroad.9']='亞洲 · Taiwan Digital Streaming · 臺灣' ['mirrors.abroad.10']='亞洲 · AniGil Linux Archive · 韓國' ['mirrors.abroad.11']='亞洲 · 工業網路安全中心(ICSCoE) · 日本' ['mirrors.abroad.12']='亞洲 · 北陸先端科學技術大學院大學(JAIST) · 日本' ['mirrors.abroad.13']='亞洲 · 山形大學 · 日本' ['mirrors.abroad.14']='亞洲 · xTom · 日本' ['mirrors.abroad.15']='亞洲 · GB Network Solutions · 馬來西亞' ['mirrors.abroad.16']='亞洲 · 孔敬大學 · 泰國' ['mirrors.abroad.17']='歐洲 · Vorboss Ltd · 英國' ['mirrors.abroad.18']='歐洲 · QuickHost · 英國' ['mirrors.abroad.19']='歐洲 · dogado · 德國' ['mirrors.abroad.20']='歐洲 · xTom · 德國' ['mirrors.abroad.21']='歐洲 · 亞琛工業大學(RWTH Aachen) · 德國' ['mirrors.abroad.22']='歐洲 · 德勒斯登大學(AG DSN) · 德國' ['mirrors.abroad.23']='歐洲 · CCIN2P3 · 法國' ['mirrors.abroad.24']='歐洲 · Ircam · 法國' ['mirrors.abroad.25']='歐洲 · Crans · 法國' ['mirrors.abroad.26']='歐洲 · CRIHAN · 法國' ['mirrors.abroad.27']='歐洲 · xTom · 荷蘭' ['mirrors.abroad.28']='歐洲 · DataPacket · 荷蘭' ['mirrors.abroad.29']='歐洲 · Linux Kernel · 荷蘭' ['mirrors.abroad.30']='歐洲 · xTom · 愛沙尼亞' ['mirrors.abroad.31']='歐洲 · netsite · 丹麥' ['mirrors.abroad.32']='歐洲 · Dotsrc · 丹麥' ['mirrors.abroad.33']='歐洲 · Academic Computer Club · 瑞典' ['mirrors.abroad.34']='歐洲 · Lysator · 瑞典' ['mirrors.abroad.35']='歐洲 · Yandex · 俄羅斯' ['mirrors.abroad.36']='歐洲 · ia64 · 俄羅斯' ['mirrors.abroad.37']='歐洲 · Truenetwork · 俄羅斯' ['mirrors.abroad.38']='歐洲 · Belgian Research Network · 比利時' ['mirrors.abroad.39']='歐洲 · 克里特大學計算機中心 · 希臘' ['mirrors.abroad.40']='歐洲 · 馬薩里克大學信息學院 · 捷克' ['mirrors.abroad.41']='歐洲 · 捷克理工大學學生會俱樂部(Silicon Hill) · 捷克' ['mirrors.abroad.42']='歐洲 · Vodafone · 捷克' ['mirrors.abroad.43']='歐洲 · CZ.NIC · 捷克' ['mirrors.abroad.44']='歐洲 · 蘇黎世聯邦理工學院 · 瑞士' ['mirrors.abroad.45']='北美 · Linux Kernel · 美國' ['mirrors.abroad.46']='北美 · 麻省理工學院(MIT) · 美國' ['mirrors.abroad.47']='北美 · 普林斯頓大學數學系 · 美國' ['mirrors.abroad.48']='北美 · 俄勒岡州立大學開源實驗室 · 美國' ['mirrors.abroad.49']='北美 · Fremont Cabal Internet Exchange(FCIX) · 美國' ['mirrors.abroad.50']='北美 · xTom · 美國' ['mirrors.abroad.51']='北美 · Steadfast · 美國' ['mirrors.abroad.52']='北美 · 不列顛哥倫比亞大學 · 加拿大' ['mirrors.abroad.53']='北美 · GoCodeIT · 加拿大' ['mirrors.abroad.54']='北美 · Switch · 加拿大' ['mirrors.abroad.55']='南美 · PoP-SC · 巴西' ['mirrors.abroad.56']='南美 · 蓬塔格羅薩州立大學 · 巴西' ['mirrors.abroad.57']='南美 · UFSCar · 巴西' ['mirrors.abroad.58']='南美 · Sysarmy Community · 阿根廷' ['mirrors.abroad.59']='大洋 · Fremont Cabal Internet Exchange(FCIX) · 澳大利亞' ['mirrors.abroad.60']='大洋 · AARNet · 澳大利亞' ['mirrors.abroad.61']='大洋 · DataMossa · 澳大利亞' ['mirrors.abroad.62']='大洋 · Amaze · 澳大利亞' ['mirrors.abroad.63']='大洋 · xTom · 澳大利亞' ['mirrors.abroad.64']='大洋 · Over the Wire · 澳大利亞' ['mirrors.abroad.65']='大洋 · Free Software Mirror Group · 紐西蘭' ['mirrors.abroad.66']='非洲 · Liquid Telecom · 肯亞' ['mirrors.abroad.67']='非洲 · Dimension Data · 南非' ['mirrors.abroad.68']='官方源' ) SPONSOR_ADS[0]="1Panel · 新一代的 Linux 伺服器維運管理面板 ➜ \033[3mhttps://1panel.cn\033[0m" } function msg_pack_en() { MESSAGE_CONTENTS=( ['start.welcome']=' GNU/Linux mirror switching script' ['start.runtimeEnv']='Runtime Env' ['start.dateTime']='System Time' ['end.moreInfo']='Script execution completed, visit our website for more tutorials' ['end.sponsorAds']='[Sponsor Ads]' ['error.cmd.options.needConfirm']='Please confirm and re-enter' ['error.cmd.options.needSpecify']='Please specify {} after this option' ['error.cmd.options.invalid']='Command option {} is invalid, {}!' ['error.cmd.options.validAddress']='a valid address' ['error.cmd.options.sourceAddress']='mirror address' ['error.cmd.options.sourceRepository']='mirror repository' ['error.cmd.options.codename']='version codename' ['error.cmd.options.boolean']=' true or false ' ['error.cmd.options.protocol']=' http or https ' ['error.cmd.options.needProtocol']=' Web protocol(http/https)' ['error.cmd.options.validLangKey']='A valid language ID ' ['error.cmd.options.langKey']='language ID ' ['error.cmd.options.unsupportTwoSourceMode']='Two mirror modes cannot be used at the same time. Please retry!' ['error.cmd.options.unsupportCodename']='The current system does not support specifying a codename. Please retry!' ['error.cmd.options.unsupportEPEL']='The current system cannot install the EPEL add-on package. Please retry!' ['error.unsupportSystem']='The operating system ({}) is not supported. Check the supported list on the website!' ['error.unsupportVersion']='The current system version is not supported' ['error.unknownSystem']='Unknown system' ['error.unknownVersion']='System version unknown' ['error.input']='Input error, {}!' ['error.needRoot']='Insufficient privileges, please run this script as root. Switch command: {}' ['error.defaultBehavior.https']='HTTPS is used by default' ['error.defaultBehavior.noReplace']='No replacement by default' ['error.defaultBehavior.noOverwrite']='No overwrite by default' ['error.defaultBehavior.noUpdate']='No update by default' ['error.defaultBehavior.noClean']='No cleanup by default' ['error.defaultBehavior.noUseIntranetSource']='Intranet mirrors are disabled by default' ['warn.usedIntranetSource']='Switched to an intranet-only mirror. Use only in the intended environment!' ['warn.unstableDebian']='Detected system version {} which may cause unpredictable issues.' ['warn.EPEL7']='Extra Packages for Enterprise Linux 7 reached end-of-life and was moved to the archive!' ['warn.needValidNumberIndex']='Please enter a valid number index!' ['warn.needInputNumberIndex']='Please enter a number index!' ['info.backuped.sourceFile']='Backed up existing {} source file' ['tip.EPEL7']="Some mirrors don't sync that archive. If errors occur, verify the target mirror provides it." ['interaction.source.type.public']='Public' ['interaction.source.type.intranet']='Intranet' ['interaction.source.type.select']='Please select network address (access method) for mirror:' ['interaction.source.type.usePublicAddress']='Use public network address for mirror by default, continue' ['interaction.source.select']='Please select the mirror you want to use:' ['interaction.source.selectAndInput']='Please select and enter the mirror you want to use' ['interaction.protocol.select']='Please select network protocol for mirror:' ['interaction.protocol.useHttp']='Use HTTP protocol for mirror' ['interaction.epel.skipReplace']='EPEL already installed. Replace/overwrite mirror' ['interaction.epel.install']='Install EPEL add-on package' ['interaction.backup.skipOverwrite.sourceFile']='A backup of {} already exists. Skip overwriting' ['interaction.upgrade.skip']='Skip upgrading packages' ['interaction.cache.autoClean']='Clean download cache after upgrading packages' ['interaction.common.tip']='Tip' ['interaction.common.operationCanceled']='Operation canceled' ['interaction.common.yes']='Yes' ['interaction.common.no']='No' ['work.upgradeSoftware']='Upgrading packages' ['work.installEPELPackage']='Installing epel-release package...' ['source.sync.text1']='Update APT package index' ['source.sync.text2']='Generate mirror cache' ['source.sync.text3']='Refreshing mirrors' ['source.sync.text4']='Synchronizing mirrors' ['source.sync.text5']='Updating binary cache and channels' ['source.comment.disabledSourceCode']='Source code mirrors are disabled by default for speed. Uncomment to enable' ['source.comment.securitySource']='Security updates' ['source.comment.proposedSource']='Proposed repository (not recommended)' ['source.changeResult.success']='Mirror switching complete' ['source.changeResult.fail']='Mirror switching complete, but {} failed' ['source.changeResult.tipTitle']='Run the script again with the same mirror. If {} still fails, consider:' ['source.changeResult.tip1']='Connectivity issues: unstable network, blocked access, or mirror-side firewall rules' ['source.changeResult.tip2']='Mirror issues: test the mirror manually at {}' ['source.changeResult.tip2.1']='If a file is missing, the mirror might still be syncing' ['source.changeResult.tip2.2']='If a path is missing, the mirror may not provide this system repository' ['source.changeResult.tip2.3']='Try another mirror. Syncing mirrors may temporarily serve broken content' ['source.changeResult.tip3']='Original mirrors failing: fix unrelated mirror errors and rerun the script' ['commands.help']='Command options(name/meaning/value): --abroad Use overseas mirrors none --edu Use China education network mirrors none --source Specify mirror address (domain or IP) address --source-epel Specify EPEL repository address (domain or IP) address --source-security Specify Debian/Ubuntu security repo address (domain or IP) address --source-vault Specify CentOS/AlmaLinux vault repo address (domain or IP) address --source-portage Specify Gentoo portage repo address (domain or IP) address --source-base-system Specify Linux Mint/Raspberry Pi OS base system repo address (domain or IP) address --branch Specify mirror repository (repo name) repo name --branch-epel Specify EPEL repository (path) repo name --branch-security Specify Debian security repo (path) repo name --branch-vault Specify CentOS/AlmaLinux vault repo (path) repo name --branch-portage Specify Gentoo portage repo (path) repo name --branch-base-system Specify Linux Mint/Raspberry Pi OS base system repo (path) repo name --codename Specify Debian/openKylin codename codename --protocol Specify web protocol http or https --use-intranet-source Prefer intranet mirror address true or false --use-official-source Use official mirror of target OS true or false --use-official-source-epel Use official EPEL repo true or false --install-epel Install EPEL repository true or false --backup Backup original mirrors true or false --upgrade-software Upgrade packages true or false --clean-cache Clean cache after upgrade true or false --clean-screen Clear screen before running true or false --lang Specify the language of the script output language --only-epel Only switch EPEL repo none --ignore-backup-tips Ignore backup overwrite prompt none --print-diff Print diff before and after modification none --pure-mode Pure mode, minimal output none --help Show help menu none Issue Report {}' ['mirrors.default.0']='Alibaba Cloud' ['mirrors.default.1']='Tencent Cloud' ['mirrors.default.2']='Huawei Cloud' ['mirrors.default.3']='China Mobile Cloud' ['mirrors.default.4']='China Telecom Cloud' ['mirrors.default.5']='NetEase' ['mirrors.default.6']='Volcengine' ['mirrors.default.7']='Tsinghua University' ['mirrors.default.8']='Peking University' ['mirrors.default.9']='Zhejiang University' ['mirrors.default.10']='Nanjing University' ['mirrors.default.11']='Lanzhou University' ['mirrors.default.12']='Shanghai Jiao Tong University' ['mirrors.default.13']='Chongqing University of Posts and Telecommunications' ['mirrors.default.14']='University of Science and Technology of China' ['mirrors.default.15']='Institute of Software, Chinese Academy of Sciences' ['mirrors.default.16']='Official Source' ['mirrors.edu.0']='Peking University' ['mirrors.edu.1']='Beijing Jiaotong University' ['mirrors.edu.2']='Beijing Foreign Studies University' ['mirrors.edu.3']='Beijing University of Posts and Telecommunications' ['mirrors.edu.4']='Chongqing University' ['mirrors.edu.5']='Chongqing University of Posts and Telecommunications' ['mirrors.edu.6']='Dalian Neusoft University of Information' ['mirrors.edu.7']='University of Electronic Science and Technology of China' ['mirrors.edu.8']='South China Agricultural University' ['mirrors.edu.9']='Huazhong University of Science and Technology' ['mirrors.edu.10']='Jilin University' ['mirrors.edu.11']='Jingchu University of Technology' ['mirrors.edu.12']='Jiangxi University of Science and Technology' ['mirrors.edu.13']='Lanzhou University' ['mirrors.edu.14']='Nanjing University' ['mirrors.edu.15']='Nanjing Tech University' ['mirrors.edu.16']='Nanjing University of Posts and Telecommunications' ['mirrors.edu.17']='Southern University of Science and Technology' ['mirrors.edu.18']='Nanyang Institute of Technology' ['mirrors.edu.19']='Qilu University of Technology' ['mirrors.edu.20']='Tsinghua University' ['mirrors.edu.21']='Shandong University' ['mirrors.edu.22']='ShanghaiTech University' ['mirrors.edu.23']='Shanghai Jiao Tong University (Siyuan)' ['mirrors.edu.24']='Shanghai Jiao Tong University (Zhiyuan)' ['mirrors.edu.25']='Wuchang Shouyi University' ['mirrors.edu.26']="Xi'an Jiaotong University" ['mirrors.edu.27']='Northwest A&F University' ['mirrors.edu.28']='Zhejiang University' ['mirrors.edu.29']='University of Science and Technology of China' ['mirrors.edu.30']='Official Source' ['mirrors.abroad.0']='AS · xTom · Hong Kong' ['mirrors.abroad.1']='AS · 01Link · Hong Kong' ['mirrors.abroad.2']='AS · National University of Singapore (NUS) · Singapore' ['mirrors.abroad.3']='AS · SG.GS · Singapore' ['mirrors.abroad.4']='AS · xTom · Singapore' ['mirrors.abroad.5']='AS · NCHC Free Software Lab · Taiwan' ['mirrors.abroad.6']='AS · OSS Planet · Taiwan' ['mirrors.abroad.7']='AS · National Yang Ming Chiao Tung University · Taiwan' ['mirrors.abroad.8']='AS · Tamkang University · Taiwan' ['mirrors.abroad.9']='AS · Taiwan Digital Streaming · Taiwan' ['mirrors.abroad.10']='AS · AniGil Linux Archive · Korea' ['mirrors.abroad.11']='AS · ICSCoE (Industrial Cyber Security Center of Excellence) · Japan' ['mirrors.abroad.12']='AS · JAIST (Japan Advanced Institute of Science and Technology) · Japan' ['mirrors.abroad.13']='AS · Yamagata University · Japan' ['mirrors.abroad.14']='AS · xTom · Japan' ['mirrors.abroad.15']='AS · GB Network Solutions · Malaysia' ['mirrors.abroad.16']='AS · Khon Kaen University · Thailand' ['mirrors.abroad.17']='EU · Vorboss Ltd · United Kiongdom' ['mirrors.abroad.18']='EU · QuickHost · United Kiongdom' ['mirrors.abroad.19']='EU · dogado · Germany' ['mirrors.abroad.20']='EU · xTom · Germany' ['mirrors.abroad.21']='EU · RWTH Aachen University · Germany' ['mirrors.abroad.22']='EU · Dresden University (AG DSN) · Germany' ['mirrors.abroad.23']='EU · CCIN2P3 · France' ['mirrors.abroad.24']='EU · Ircam · France' ['mirrors.abroad.25']='EU · Crans · France' ['mirrors.abroad.26']='EU · CRIHAN · France' ['mirrors.abroad.27']='EU · xTom · Netherlands' ['mirrors.abroad.28']='EU · DataPacket · Netherlands' ['mirrors.abroad.29']='EU · Linux Kernel · Netherlands' ['mirrors.abroad.30']='EU · xTom · Estonia' ['mirrors.abroad.31']='EU · netsite · Denmark' ['mirrors.abroad.32']='EU · Dotsrc · Denmark' ['mirrors.abroad.33']='EU · Academic Computer Club · Sweden' ['mirrors.abroad.34']='EU · Lysator · Sweden' ['mirrors.abroad.35']='EU · Yandex · Russia' ['mirrors.abroad.36']='EU · ia64 · Russia' ['mirrors.abroad.37']='EU · Truenetwork · Russia' ['mirrors.abroad.38']='EU · Belgian Research Network · Belgium' ['mirrors.abroad.39']='EU · University of Crete Computer Center · Greece' ['mirrors.abroad.40']='EU · Masaryk University Faculty of Informatics · Czech' ['mirrors.abroad.41']='EU · Czech Technical University Student Club (Silicon Hill) · Czech' ['mirrors.abroad.42']='EU · Vodafone · Czech' ['mirrors.abroad.43']='EU · CZ.NIC · Czech' ['mirrors.abroad.44']='EU · ETH Zurich · Switzerland' ['mirrors.abroad.45']='NA · Linux Kernel · United States' ['mirrors.abroad.46']='NA · MIT · United States' ['mirrors.abroad.47']='NA · Princeton University Department of Mathematics · United States' ['mirrors.abroad.48']='NA · Oregon State University Open Source Lab · United States' ['mirrors.abroad.49']='NA · Fremont Cabal Internet Exchange(FCIX) · United States' ['mirrors.abroad.50']='NA · xTom · United States' ['mirrors.abroad.51']='NA · Steadfast · United States' ['mirrors.abroad.52']='NA · University of British Columbia · Canada' ['mirrors.abroad.53']='NA · GoCodeIT · Canada' ['mirrors.abroad.54']='NA · Switch · Canada' ['mirrors.abroad.55']='SA · PoP-SC · Brazil' ['mirrors.abroad.56']='SA · State University of Ponta Grossa · Brazil' ['mirrors.abroad.57']='SA · UFSCar · Brazil' ['mirrors.abroad.58']='SA · Sysarmy Community · Argentina' ['mirrors.abroad.59']='OC · Fremont Cabal Internet Exchange(FCIX) · Australia' ['mirrors.abroad.60']='OC · AARNet · Australia' ['mirrors.abroad.61']='OC · DataMossa · Australia' ['mirrors.abroad.62']='OC · Amaze · Australia' ['mirrors.abroad.63']='OC · xTom · Australia' ['mirrors.abroad.64']='OC · Over the Wire · Australia' ['mirrors.abroad.65']='OC · Free Software Mirror Group · New Zealand' ['mirrors.abroad.66']='AF · Liquid Telecom · Kenya' ['mirrors.abroad.67']='AF · Dimension Data · South Africa' ['mirrors.abroad.68']='Official Source' ) SPONSOR_ADS=( "1Panel · Top-Rated Web-based Linux Server Management Tool ➜ \033[3mhttps://1panel.cn\033[0m" ) } ############################################################################## init_msg_pack handle_command_options "$@" main ================================================ FILE: ChangeMirrorsLite.sh ================================================ #!/bin/bash ## Author: SuperManito ## Modified: 2026-03-04 ## License: MIT ## GitHub: https://github.com/SuperManito/LinuxMirrors ## Website: https://linuxmirrors.cn WEB_PROTOCOL="http" INSTALL_EPEL="true" IGNORE_BACKUP_TIPS="true" UPGRADE_SOFTWARE="false" ############################################################################## ## 定义系统判定变量 SYSTEM_DEBIAN="Debian" SYSTEM_UBUNTU="Ubuntu" SYSTEM_KALI="Kali" SYSTEM_DEEPIN="Deepin" SYSTEM_LINUX_MINT="Linuxmint" SYSTEM_ZORIN="Zorin" SYSTEM_RASPBERRY_PI_OS="Raspberry Pi OS" SYSTEM_REDHAT="RedHat" SYSTEM_RHEL="Red Hat Enterprise Linux" SYSTEM_CENTOS="CentOS" SYSTEM_CENTOS_STREAM="CentOS Stream" SYSTEM_ROCKY="Rocky" SYSTEM_ALMALINUX="AlmaLinux" SYSTEM_FEDORA="Fedora" SYSTEM_ORACLE="Oracle Linux" SYSTEM_OPENCLOUDOS="OpenCloudOS" SYSTEM_OPENCLOUDOS_STREAM="OpenCloudOS Stream" SYSTEM_TENCENTOS="TencentOS" SYSTEM_OPENEULER="openEuler" SYSTEM_ANOLISOS="Anolis" SYSTEM_KYLIN_DESKTOP="Kylin Desktop" SYSTEM_KYLIN_SERVER="Kylin Server" SYSTEM_OPENKYLIN="openKylin" SYSTEM_OPENSUSE="openSUSE" SYSTEM_ARCH="Arch" SYSTEM_MANJARO="Manjaro" SYSTEM_ALPINE="Alpine" SYSTEM_GENTOO="Gentoo" SYSTEM_NIXOS="NixOS" ## 定义系统版本文件 File_LinuxRelease=/etc/os-release File_RedHatRelease=/etc/redhat-release File_DebianVersion=/etc/debian_version File_ArmbianRelease=/etc/armbian-release File_RaspberryPiOSRelease=/etc/rpi-issue File_openEulerRelease=/etc/openEuler-release File_HuaweiCloudEulerOSRelease=/etc/hce-release File_OpenCloudOSRelease=/etc/opencloudos-release File_TencentOSServerRelease=/etc/tlinux-release File_AnolisOSRelease=/etc/anolis-release File_AlibabaCloudLinuxRelease=/etc/alinux-release File_OracleLinuxRelease=/etc/oracle-release File_ArchLinuxRelease=/etc/arch-release File_ManjaroRelease=/etc/manjaro-release File_AlpineRelease=/etc/alpine-release File_GentooRelease=/etc/gentoo-release File_KylinRelease=/etc/kylin-release File_kylinVersion=/etc/kylin-version/kylin-system-version.conf File_ProxmoxVersion=/etc/pve/.version ## 定义软件源相关文件或目录 Dir_AptAdditionalSources=/etc/apt/sources.list.d Dir_AptAdditionalSourcesBackup=$Dir_AptAdditionalSources.bak Dir_YumRepos=/etc/yum.repos.d Dir_YumReposBackup=$Dir_YumRepos.bak Dir_ZYppRepos=/etc/zypp/repos.d Dir_ZYppReposBackup=$Dir_ZYppRepos.bak Dir_GentooReposConf=/etc/portage/repos.conf Dir_NixConfig=/etc/nix File_AptSourceList=/etc/apt/sources.list File_AptSourceListBackup=$File_AptSourceList.bak File_DebianSources=$Dir_AptAdditionalSources/debian.sources File_DebianSourcesBackup=$File_DebianSources.bak File_UbuntuSources=$Dir_AptAdditionalSources/ubuntu.sources File_UbuntuSourcesBackup=$File_UbuntuSources.bak File_ArmbianSourceList=$Dir_AptAdditionalSources/armbian.list File_ArmbianSourceListBackup=$File_ArmbianSourceList.bak File_ProxmoxSourceList=$Dir_AptAdditionalSources/pve-no-subscription.list File_ProxmoxSourceListBackup=$File_ProxmoxSourceList.bak File_ProxmoxSources=$Dir_AptAdditionalSources/pve-no-subscription.sources File_ProxmoxSourcesBackup=$File_ProxmoxSources.bak File_ProxmoxCephSourceList=$Dir_AptAdditionalSources/ceph.list File_ProxmoxCephSourceListBackup=$File_ProxmoxCephSourceList.bak File_ProxmoxCephSources=$Dir_AptAdditionalSources/ceph.sources File_ProxmoxCephSourcesBackup=$File_ProxmoxCephSources.bak File_LinuxMintSourceList=$Dir_AptAdditionalSources/official-package-repositories.list File_LinuxMintSourceListBackup=$File_LinuxMintSourceList.bak File_RaspberryPiSourceList=$Dir_AptAdditionalSources/raspi.list File_RaspberryPiSourceListBackup=$File_RaspberryPiSourceList.bak File_PacmanMirrorList=/etc/pacman.d/mirrorlist File_PacmanMirrorListBackup=$File_PacmanMirrorList.bak File_PacmanEndeavourOSMirrorList=/etc/pacman.d/endeavouros-mirrorlist File_PacmanEndeavourOSMirrorListBackup=$File_PacmanEndeavourOSMirrorList.bak File_AlpineRepositories=/etc/apk/repositories File_AlpineRepositoriesBackup=$File_AlpineRepositories.bak File_GentooMakeConf=/etc/portage/make.conf File_GentooMakeConfBackup=$File_GentooMakeConf.bak File_GentooReposConf=/etc/portage/repos.conf/gentoo.conf File_GentooReposConfBackup=$File_GentooReposConf.bak File_NixConf=/etc/nix/nix.conf File_NixConfBackup=$File_NixConf.bak ## 定义颜色和样式变量 RED='\033[31m' GREEN='\033[32m' YELLOW='\033[33m' BLUE='\033[34m' PURPLE='\033[35m' AZURE='\033[36m' PLAIN='\033[0m' BOLD='\033[1m' SUCCESS="\033[1;32m✔${PLAIN}" COMPLETE="\033[1;32m✔${PLAIN}" WARN="\033[1;43m WARN ${PLAIN}" ERROR="\033[1;31m✘${PLAIN}" FAIL="\033[1;31m✘${PLAIN}" TIP="\033[1;44m TIP ${PLAIN}" WORKING="\033[1;36m◉${PLAIN}" function main() { permission_judgment collect_system_info check_command_options run_start choose_mirrors choose_protocol choose_install_epel_packages backup_original_mirrors remove_original_mirrors change_mirrors_main upgrade_software run_end } function handle_command_options() { while [ $# -gt 0 ]; do case "$1" in ## 指定软件源地址 --source) if [ "$2" ]; then echo "$2" | grep -Eq "\(|\)|\[|\]|\{|\}" if [ $? -eq 0 ]; then command_error "$2" "$(msg "error.cmd.options.validAddress")" else SOURCE="$(echo "$2" | sed -e 's,^http[s]\?://,,g' -e 's,/$,,')" shift fi else command_error "$1" "$(msg "error.cmd.options.sourceAddress")" fi ;; --source-epel) if [ "$2" ]; then echo "$2" | grep -Eq "\(|\)|\[|\]|\{|\}" if [ $? -eq 0 ]; then command_error "$2" "$(msg "error.cmd.options.validAddress")" else SOURCE_EPEL="$(echo "$2" | sed -e 's,^http[s]\?://,,g' -e 's,/$,,')" shift fi else command_error "$1" "$(msg "error.cmd.options.sourceAddress")" fi ;; --source-security) if [ "$2" ]; then echo "$2" | grep -Eq "\(|\)|\[|\]|\{|\}" if [ $? -eq 0 ]; then command_error "$2" "$(msg "error.cmd.options.validAddress")" else SOURCE_SECURITY="$(echo "$2" | sed -e 's,^http[s]\?://,,g' -e 's,/$,,')" shift fi else command_error "$1" "$(msg "error.cmd.options.sourceAddress")" fi ;; --source-vault) if [ "$2" ]; then echo "$2" | grep -Eq "\(|\)|\[|\]|\{|\}" if [ $? -eq 0 ]; then command_error "$2" "$(msg "error.cmd.options.validAddress")" else SOURCE_VAULT="$(echo "$2" | sed -e 's,^http[s]\?://,,g' -e 's,/$,,')" shift fi else command_error "$1" "$(msg "error.cmd.options.sourceAddress")" fi ;; --source-portage) if [ "$2" ]; then echo "$2" | grep -Eq "\(|\)|\[|\]|\{|\}" if [ $? -eq 0 ]; then command_error "$2" "$(msg "error.cmd.options.validAddress")" else SOURCE_PORTAGE="$(echo "$2" | sed -e 's,^http[s]\?://,,g' -e 's,/$,,')" shift fi else command_error "$1" "$(msg "error.cmd.options.sourceAddress")" fi ;; --source-base-system) if [ "$2" ]; then echo "$2" | grep -Eq "\(|\)|\[|\]|\{|\}" if [ $? -eq 0 ]; then command_error "$2" "$(msg "error.cmd.options.validAddress")" else SOURCE_BASE_SYSTEM="$(echo "$2" | sed -e 's,^http[s]\?://,,g' -e 's,/$,,')" shift fi else command_error "$1" "$(msg "error.cmd.options.sourceAddress")" fi ;; ## 指定软件源仓库 --branch) if [ "$2" ]; then SOURCE_BRANCH="$2" shift else command_error "$1" "$(msg "error.cmd.options.sourceRepository")" fi ;; --branch-epel) if [ "$2" ]; then SOURCE_EPEL_BRANCH="$2" shift else command_error "$1" "$(msg "error.cmd.options.sourceRepository")" fi ;; --branch-security) if [ "$2" ]; then SOURCE_SECURITY_BRANCH="$2" shift else command_error "$1" "$(msg "error.cmd.options.sourceRepository")" fi ;; --branch-vault) if [ "$2" ]; then SOURCE_VAULT_BRANCH="$2" shift else command_error "$1" "$(msg "error.cmd.options.sourceRepository")" fi ;; --branch-portage) if [ "$2" ]; then SOURCE_PORTAGE_BRANCH="$2" shift else command_error "$1" "$(msg "error.cmd.options.sourceRepository")" fi ;; --branch-base-system) if [ "$2" ]; then SOURCE_BASE_SYSTEM_BRANCH="$2" shift else command_error "$1" "$(msg "error.cmd.options.sourceRepository")" fi ;; ## 指定 Debian 系操作系统的版本代号 --codename) if [ "$2" ]; then DEBIAN_CODENAME="$2" shift else command_error "$1" "$(msg "error.cmd.options.codename")" fi ;; ## 使用官方源 --use-official-source) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) USE_OFFICIAL_SOURCE="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.boolean")" ;; esac else command_error "$1" "$(msg "error.cmd.options.boolean")" fi ;; ## EPEL 使用 官方源 --use-official-source-epel) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) USE_OFFICIAL_SOURCE_EPEL="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.boolean")" ;; esac else command_error "$1" "$(msg "error.cmd.options.boolean")" fi ;; ## Web 协议(HTTP/HTTPS) --protocol | --web-protocol) if [ "$2" ]; then case "$2" in http | https | HTTP | HTTPS) WEB_PROTOCOL="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.protocol")" ;; esac else ocommand_error "$1" "$(msg "error.cmd.options.needProtocol")" fi ;; ## 安装 EPEL 附加软件包 --install-epel) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) INSTALL_EPEL="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.boolean")" ;; esac else command_error "$1" "$(msg "error.cmd.options.boolean")" fi ;; --only-epel) ONLY_EPEL="true" INSTALL_EPEL="true" ;; ## 备份原有软件源 --backup) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) BACKUP="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.boolean")" ;; esac else command_error "$1" "$(msg "error.cmd.options.boolean")" fi ;; ## 更新软件包 --upgrade-software | --updata-software) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) UPGRADE_SOFTWARE="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.boolean")" ;; esac else command_error "$1" "$(msg "error.cmd.options.boolean")" fi ;; ## 在更新软件包后清理下载缓存 --clean-cache) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) CLEAN_CACHE="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.boolean")" ;; esac else command_error "$1" "$(msg "error.cmd.options.boolean")" fi ;; ## 清除屏幕上的所有内容 --clean-screen) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) CLEAN_SCREEN="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.boolean")" ;; esac else command_error "$1" "$(msg "error.cmd.options.boolean")" fi ;; ## 打印源文件修改前后差异 --print-diff) PRINT_DIFF="true" ;; ## 纯净模式 --pure-mode) PURE_MODE="true" ;; ## 命令帮助 --help) echo -e "\n$(msg "commands.help" "https://github.com/SuperManito/LinuxMirrors/issues")\n" exit ;; *) command_error "$1" ;; esac shift done ## 设置部分功能的默认值 ONLY_EPEL="${ONLY_EPEL:-"false"}" BACKUP="${BACKUP:-"true"}" USE_OFFICIAL_SOURCE="${USE_OFFICIAL_SOURCE:-"false"}" IGNORE_BACKUP_TIPS="${IGNORE_BACKUP_TIPS:-"false"}" PRINT_DIFF="${PRINT_DIFF:-"false"}" PURE_MODE="${PURE_MODE:-"false"}" } function run_start() { :; } function run_end() { if [[ "${PURE_MODE}" == "true" ]]; then echo '' return fi echo -e "\n\033[3;1mPowered by \033[34mLinuxMirrors\033[0m - \033[3mhttps://linuxmirrors.cn\033[0m\n" } function output_error() { [ "$1" ] && echo -e "\n$ERROR $1\n" exit 1 } function command_error() { local tmp_text="$(msg "error.cmd.options.needConfirm")" if [[ "${2}" ]]; then tmp_text="$(msg "error.cmd.options.needSpecify" "${2}")" fi output_error "$(msg "error.cmd.options.invalid" "${BLUE}$1${PLAIN}" "${tmp_text}")" } function unsupport_system_error() { output_error "$(msg "error.unsupportSystem" "${1}")" } function input_error() { echo -e "\n$WARN $(msg "error.input" "${1}")" } function command_exists() { command -v "$@" &>/dev/null } function permission_judgment() { if [ $UID -ne 0 ]; then local change_cmd="su root" if command_exists sudo; then change_cmd="sudo -i" fi output_error "$(msg "error.needRoot" "${BLUE}${change_cmd}${PLAIN}")" fi } function get_os_release_value() { grep -E "^${1}=" $File_LinuxRelease | cut -d= -f2- | sed "s/[\'\"]//g" } function collect_system_info() { if [ ! -s "${File_LinuxRelease}" ]; then unsupport_system_error "$(msg "error.unknownSystem")" fi ## 定义系统名称 SYSTEM_NAME="$(get_os_release_value NAME)" SYSTEM_PRETTY_NAME="$(get_os_release_value PRETTY_NAME)" ## 定义系统版本号 SYSTEM_VERSION_ID="$(get_os_release_value VERSION_ID)" SYSTEM_VERSION_ID_MAJOR="${SYSTEM_VERSION_ID%%.*}" SYSTEM_VERSION_ID_MINOR="${SYSTEM_VERSION_ID#*.}" ## 定义系统ID SYSTEM_ID="$(get_os_release_value ID)" ## 判定当前系统派系 if [ -s "${File_DebianVersion}" ]; then SYSTEM_FACTIONS="${SYSTEM_DEBIAN}" elif [ -s "${File_RedHatRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_REDHAT}" elif [ -s "${File_openEulerRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_OPENEULER}" elif [ -s "${File_OpenCloudOSRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_OPENCLOUDOS}" # 自 9.0 版本起不再基于红帽 elif [ -s "${File_AnolisOSRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_ANOLISOS}" # 自 8.8 版本起不再基于红帽 elif [ -s "${File_kylinVersion}" ] && [[ "${SYSTEM_ID}" == *"openkylin"* ]]; then SYSTEM_FACTIONS="${SYSTEM_OPENKYLIN}" elif [ -f "${File_ArchLinuxRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_ARCH}" elif [ -f "${File_AlpineRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_ALPINE}" elif [ -f "${File_GentooRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_GENTOO}" elif [[ "${SYSTEM_NAME}" == *"openSUSE"* ]]; then SYSTEM_FACTIONS="${SYSTEM_OPENSUSE}" elif [[ "${SYSTEM_NAME}" == *"NixOS"* ]]; then SYSTEM_FACTIONS="${SYSTEM_NIXOS}" else unsupport_system_error "$(msg "error.unknownSystem")" fi ## 判定系统类型、版本、版本号 case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") if command_exists lsb_release; then SYSTEM_JUDGMENT="$(lsb_release -is)" SYSTEM_VERSION_CODENAME="${DEBIAN_CODENAME:-"$(lsb_release -cs)"}" else ## https://codeberg.org/gioele/lsb-release-minimal SYSTEM_JUDGMENT="${SYSTEM_ID^}" if [ "${SYSTEM_NAME}" ]; then if [[ "${SYSTEM_ID,,}" == "${SYSTEM_NAME,,}" ]]; then SYSTEM_JUDGMENT="${SYSTEM_NAME}" fi fi SYSTEM_VERSION_CODENAME="${DEBIAN_CODENAME:-"$(get_os_release_value VERSION_CODENAME)"}" fi ## Raspberry Pi OS 判定 if [[ "${SYSTEM_FACTIONS}" == "${SYSTEM_DEBIAN}" ]] && [ -s "${File_RaspberryPiOSRelease}" ]; then SYSTEM_JUDGMENT="${SYSTEM_RASPBERRY_PI_OS}" SYSTEM_PRETTY_NAME="${SYSTEM_RASPBERRY_PI_OS}" fi ## 针对特定系统的判定 if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_DEBIAN}" ]]; then ## 尚未正式发布的版本 if [[ -z "${SYSTEM_VERSION_ID}" && "${SYSTEM_VERSION_CODENAME}" == "trixie" ]]; then SYSTEM_VERSION_ID="13" SYSTEM_VERSION_ID_MAJOR="${SYSTEM_VERSION_ID%%.*}" SYSTEM_VERSION_ID_MINOR="${SYSTEM_VERSION_ID#*.}" fi ## 是否使用 DEB822 格式 if [[ "${SYSTEM_VERSION_ID_MAJOR}" && "${SYSTEM_VERSION_ID_MAJOR}" -ge 13 ]]; then USE_DEB822_FORMAT="true" fi fi if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_UBUNTU}" ]]; then ## 是否使用 DEB822 格式 if [[ "${SYSTEM_VERSION_ID_MAJOR}" && "${SYSTEM_VERSION_ID_MAJOR}" -ge 24 ]]; then USE_DEB822_FORMAT="true" fi fi ;; "${SYSTEM_REDHAT}") SYSTEM_JUDGMENT="$(awk '{printf $1}' $File_RedHatRelease)" ## 针对特定系统的判定 # Red Hat Enterprise Linux grep -q "${SYSTEM_RHEL}" $File_RedHatRelease && SYSTEM_JUDGMENT="${SYSTEM_RHEL}" # CentOS Stream grep -q "${SYSTEM_CENTOS_STREAM}" $File_RedHatRelease && SYSTEM_JUDGMENT="${SYSTEM_CENTOS_STREAM}" # Oracle Linux [ -s "${File_OracleLinuxRelease}" ] && SYSTEM_JUDGMENT="${SYSTEM_ORACLE}" ;; "${SYSTEM_ARCH}") if [ -f "${File_ManjaroRelease}" ]; then SYSTEM_JUDGMENT="${SYSTEM_MANJARO}" else SYSTEM_JUDGMENT="${SYSTEM_FACTIONS}" fi ;; *) SYSTEM_JUDGMENT="${SYSTEM_FACTIONS}" ;; esac ## 判断系统及版本是否适配 local is_supported="true" case "${SYSTEM_JUDGMENT}" in "${SYSTEM_DEBIAN}") if [[ ! "${SYSTEM_VERSION_ID_MAJOR}" =~ ^(1[0-3]|[8-9])$ ]]; then is_supported="false" fi if [[ "${SYSTEM_VERSION_CODENAME}" == "sid" ]]; then if [[ "${PURE_MODE}" != "true" ]]; then echo -e "\n${WARN} $(msg "warn.unstableDebian" "${BLUE}unstable(sid)${PLAIN}")\n" fi fi ;; "${SYSTEM_UBUNTU}") if [[ ! "${SYSTEM_VERSION_ID_MAJOR}" =~ ^(1[4-9]|2[0-5])$ ]]; then is_supported="false" fi ;; "${SYSTEM_LINUX_MINT}") if [[ "${SYSTEM_NAME}" == *"LMDE"* ]]; then if [[ "${SYSTEM_VERSION_ID_MAJOR}" != [6-7] ]]; then is_supported="false" fi else if [[ ! "${SYSTEM_VERSION_ID_MAJOR}" =~ ^(19|2[0-2])$ ]]; then is_supported="false" fi fi ;; "${SYSTEM_RHEL}") if [[ ! "${SYSTEM_VERSION_ID_MAJOR}" =~ ^([7-9]|10)$ ]]; then is_supported="false" fi ;; "${SYSTEM_CENTOS}") if [[ "${SYSTEM_VERSION_ID_MAJOR}" != [7-8] ]]; then is_supported="false" fi ;; "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ROCKY}" | "${SYSTEM_ALMALINUX}" | "${SYSTEM_ORACLE}") if [[ ! "${SYSTEM_VERSION_ID_MAJOR}" =~ ^([8-9]|10)$ ]]; then is_supported="false" fi ;; "${SYSTEM_FEDORA}") if [[ "${SYSTEM_VERSION_ID}" != [3-4][0-9] ]]; then is_supported="false" fi ;; "${SYSTEM_OPENEULER}") if [[ "${SYSTEM_VERSION_ID_MAJOR}" != 2[0-5] ]]; then is_supported="false" fi ;; "${SYSTEM_OPENCLOUDOS}") if [[ ! "${SYSTEM_VERSION_ID_MAJOR}" =~ ^([8-9]|23)$ ]] || [[ "${SYSTEM_VERSION_ID_MAJOR}" == 8 && "${SYSTEM_VERSION_ID_MINOR}" -lt 6 ]]; then is_supported="false" fi ;; "${SYSTEM_ANOLISOS}") if [[ ! "${SYSTEM_VERSION_ID_MAJOR}" =~ ^(8|23)$ ]]; then is_supported="false" fi ;; "${SYSTEM_OPENSUSE}") case "${SYSTEM_ID}" in "opensuse-leap") if [[ "${SYSTEM_VERSION_ID_MAJOR}" != 1[5-6] ]]; then is_supported="false" fi ;; "opensuse-tumbleweed") ;; *) is_supported="false" ;; esac ;; # 理论全部支持或不作判断 "${SYSTEM_KALI}" | "${SYSTEM_DEEPIN}" | "${SYSTEM_ZORIN}" | "${SYSTEM_RASPBERRY_PI_OS}" | "${SYSTEM_OPENKYLIN}") ;; "${SYSTEM_ARCH}" | "${SYSTEM_MANJARO}" | "${SYSTEM_ALPINE}" | "${SYSTEM_GENTOO}" | "${SYSTEM_NIXOS}") ;; *) unsupport_system_error "$(msg "error.unknownVersion")" ;; esac if [[ "${is_supported}" == "false" ]]; then unsupport_system_error "$(msg "error.unsupportVersion")" fi ## 判定系统处理器架构 DEVICE_ARCH_RAW="$(uname -m)" case "${DEVICE_ARCH_RAW}" in x86_64) DEVICE_ARCH="x86_64" ;; aarch64) DEVICE_ARCH="ARM64" ;; armv8l) DEVICE_ARCH="ARMv8_32" ;; armv7l) DEVICE_ARCH="ARMv7" ;; armv6l) DEVICE_ARCH="ARMv6" ;; armv5tel) DEVICE_ARCH="ARMv5" ;; i686) DEVICE_ARCH="x86_32" ;; *) DEVICE_ARCH="${DEVICE_ARCH_RAW}" ;; esac ## 定义软件源仓库名称 if [[ -z "${SOURCE_BRANCH}" ]]; then ## 默认为系统名称小写,替换空格 SOURCE_BRANCH="${SYSTEM_JUDGMENT,,}" SOURCE_BRANCH="${SOURCE_BRANCH// /-}" ## 处理特殊的仓库名称 case "${SYSTEM_JUDGMENT}" in "${SYSTEM_DEBIAN}") case "${SYSTEM_VERSION_ID_MAJOR}" in 8 | 9 | 10 | 11) SOURCE_BRANCH="debian-archive/debian" ;; *) SOURCE_BRANCH="debian" ;; esac ;; "${SYSTEM_UBUNTU}" | "${SYSTEM_ZORIN}") if [[ "${DEVICE_ARCH_RAW}" == "x86_64" || "${DEVICE_ARCH_RAW}" == *i?86* ]]; then SOURCE_BRANCH="ubuntu" else SOURCE_BRANCH="ubuntu-ports" fi ;; "${SYSTEM_RASPBERRY_PI_OS}") SOURCE_BRANCH="raspberrypi" ;; "${SYSTEM_RHEL}") case "${SYSTEM_VERSION_ID_MAJOR}" in 7 | 8) if [[ "${DEVICE_ARCH_RAW}" == "x86_64" ]]; then SOURCE_BRANCH="centos-vault" else SOURCE_BRANCH="centos-altarch" fi ;; *) SOURCE_BRANCH="centos-stream" # 使用 CentOS Stream 仓库 ;; esac ;; "${SYSTEM_CENTOS}") if [[ "${DEVICE_ARCH_RAW}" == "x86_64" ]]; then SOURCE_BRANCH="centos-vault" else SOURCE_BRANCH="centos-altarch" fi ;; "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ORACLE}") # 自 CentOS Stream 9 开始使用 centos-stream 仓库,旧版本使用 centos 仓库 case "${SYSTEM_VERSION_ID_MAJOR}" in 8) if [[ "${DEVICE_ARCH_RAW}" == "x86_64" ]]; then SOURCE_BRANCH="centos-vault" else SOURCE_BRANCH="centos-altarch" fi ;; *) SOURCE_BRANCH="centos-stream" ;; esac ;; "${SYSTEM_FEDORA}") if [[ "${SYSTEM_VERSION_ID}" -lt 39 ]]; then SOURCE_BRANCH="fedora-archive" fi ;; "${SYSTEM_ARCH}") if [[ "${DEVICE_ARCH_RAW}" == "x86_64" || "${DEVICE_ARCH_RAW}" == *i?86* ]]; then SOURCE_BRANCH="archlinux" else SOURCE_BRANCH="archlinuxarm" fi # EndeavourOS if [[ "${SYSTEM_NAME}" == *"EndeavourOS"* ]] && [[ -f "${File_PacmanEndeavourOSMirrorList}" ]]; then SOURCE_BRANCH="archlinux" fi ;; "${SYSTEM_OPENCLOUDOS}") # OpenCloudOS Stream grep -q "${SYSTEM_OPENCLOUDOS_STREAM}" $File_OpenCloudOSRelease if [ $? -eq 0 ]; then SOURCE_BRANCH="${SYSTEM_OPENCLOUDOS_STREAM,,}" SOURCE_BRANCH="${SOURCE_BRANCH// /-}" fi ;; "${SYSTEM_NIXOS}") SOURCE_BRANCH="nix-channels" ;; esac fi ## 定义软件源更新文字 case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_ALPINE}" | "${SYSTEM_OPENKYLIN}") SYNC_MIRROR_TEXT="$(msg "source.sync.text1")" ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}") SYNC_MIRROR_TEXT="$(msg "source.sync.text2")" ;; "${SYSTEM_OPENSUSE}") SYNC_MIRROR_TEXT="$(msg "source.sync.text3")" ;; "${SYSTEM_ARCH}" | "${SYSTEM_GENTOO}") SYNC_MIRROR_TEXT="$(msg "source.sync.text4")" ;; "${SYSTEM_NIXOS}") SYNC_MIRROR_TEXT="$(msg "source.sync.text5")" ;; esac ## 判断是否可以使用高级交互式选择器 CAN_USE_ADVANCED_INTERACTIVE_SELECTION="false" if command_exists tput; then CAN_USE_ADVANCED_INTERACTIVE_SELECTION="true" fi } ## 命令选项兼容性判断 function check_command_options() { if [[ "${DEBIAN_CODENAME}" ]]; then if [[ "${SYSTEM_FACTIONS}" != "${SYSTEM_DEBIAN}" && "${SYSTEM_FACTIONS}" != "${SYSTEM_OPENKYLIN}" ]]; then output_error "$(msg "error.cmd.options.unsupportCodename")" fi fi if [[ "${ONLY_EPEL}" == "true" ]]; then case "${SYSTEM_FACTIONS}" in "${SYSTEM_REDHAT}") if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_FEDORA}" ]]; then output_error "$(msg "error.cmd.options.unsupportEPEL")" fi ;; *) output_error "$(msg "error.cmd.options.unsupportEPEL")" ;; esac fi } function choose_display_language() { :; } function choose_mirrors() { :; } function choose_protocol() { :; } function choose_install_epel_packages() { :; } ## 备份原有软件源(文件/目录) function backup_original_mirrors() { function backup_file() { local target_file=$1 local backup_file=$2 local type="$3" ## 判断是否存在源文件 [ -f "${target_file}" ] || touch "${target_file}" if [ ! -s "${target_file}" ]; then return fi ## 判断是否存在已备份的源文件 if [ -s "${backup_file}" ]; then if [[ "${IGNORE_BACKUP_TIPS}" != "false" ]]; then return fi local ask_text="$(msg "interaction.backup.skipOverwrite.sourceFile" "${type}")?" if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then echo '' interactive_select_boolean "${BOLD}${ask_text}${PLAIN}" if [[ "${_SELECT_RESULT}" == "false" ]]; then echo '' cp -rvf "${target_file}" "${backup_file}" 2>&1 BACKED_UP="true" fi else local CHOICE_BACKUP="$(echo -e "\n${BOLD}└─ ${ask_text} [Y/n] ${PLAIN}")" read -rp "${CHOICE_BACKUP}" INPUT [[ -z "${INPUT}" ]] && INPUT=Y case "${INPUT}" in [Yy] | [Yy][Ee][Ss]) ;; [Nn] | [Nn][Oo]) echo '' cp -rvf "${target_file}" "${backup_file}" 2>&1 BACKED_UP="true" ;; *) input_error "$(msg "error.defaultBehavior.noOverwrite")" ;; esac fi else echo '' cp -rvf "${target_file}" "${backup_file}" 2>&1 BACKED_UP="true" echo -e "\n$COMPLETE $(msg "info.backuped.sourceFile" "${type}")" sleep 1s fi } function backup_dir() { local target_dir=$1 local backup_dir=$2 [ -d "${target_dir}" ] || mkdir -p "${target_dir}" [ -d "${backup_dir}" ] || mkdir -p "${backup_dir}" ## 判断是否存在 repo 源文件 ls "${target_dir}" | grep '\.repo$' -q if [ $? -ne 0 ]; then return fi ## 判断是否存在已备份的 repo 源文件 ls "${backup_dir}" | grep '\.repo$' -q if [ $? -eq 0 ]; then if [[ "${IGNORE_BACKUP_TIPS}" != "false" ]]; then return fi local ask_text="$(msg "interaction.backup.skipOverwrite.sourceFile" "repo")?" if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then echo '' interactive_select_boolean "${BOLD}${ask_text}${PLAIN}" if [[ "${_SELECT_RESULT}" == "false" ]]; then echo '' cp -rvf $target_dir/* "${backup_dir}" 2>&1 BACKED_UP="true" fi else local CHOICE_BACKUP="$(echo -e "\n${BOLD}└─ ${ask_text} [Y/n] ${PLAIN}")" read -rp "${CHOICE_BACKUP}" INPUT [[ -z "${INPUT}" ]] && INPUT=Y case "${INPUT}" in [Yy] | [Yy][Ee][Ss]) ;; [Nn] | [Nn][Oo]) echo '' cp -rvf $target_dir/* "${backup_dir}" 2>&1 BACKED_UP="true" ;; *) input_error "$(msg "error.defaultBehavior.noOverwrite")" ;; esac fi else echo '' cp -rvf $target_dir/* "${backup_dir}" 2>&1 BACKED_UP="true" echo -e "\n$COMPLETE $(msg "info.backuped.sourceFile" "repo")" sleep 1s fi } BACKED_UP="false" # 是否已备份 if [[ "${BACKUP}" == "true" ]]; then case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") # Debian DEB822 格式源文件 if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_DEBIAN}" ]] && [ -f "${File_DebianSources}" ]; then backup_file $File_DebianSources $File_DebianSourcesBackup "debian.sources" USE_DEB822_FORMAT="true" fi # Ubuntu DEB822 格式源文件 if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_UBUNTU}" ]] && [ -f "${File_UbuntuSources}" ]; then 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" fi # Proxmox VE if [ -f "${File_ProxmoxVersion}" ]; then if [[ "${USE_DEB822_FORMAT}" == "true" ]]; then backup_file $File_ProxmoxSources $File_ProxmoxSourcesBackup "pve-no-subscription.sources" [ -f "${File_ProxmoxCephSources}" ] && backup_file $File_ProxmoxCephSources $File_ProxmoxCephSourcesBackup "ceph.sources" else backup_file $File_ProxmoxSourceList $File_ProxmoxSourceListBackup "pve-no-subscription.list" [ -f "${File_ProxmoxCephSourceList}" ] && backup_file $File_ProxmoxCephSourceList $File_ProxmoxCephSourceListBackup "ceph.list" fi fi # Linux Mint if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_LINUX_MINT}" ]]; then backup_file $File_LinuxMintSourceList $File_LinuxMintSourceListBackup "official-package-repositories.list" fi # Raspberry Pi OS if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_RASPBERRY_PI_OS}" ]]; then backup_file $File_RaspberryPiSourceList $File_RaspberryPiSourceListBackup "raspi.list" fi ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}") # /etc/yum.repos.d backup_dir $Dir_YumRepos $Dir_YumReposBackup ;; "${SYSTEM_OPENSUSE}") # /etc/zypp/repos.d backup_dir $Dir_ZYppRepos $Dir_ZYppReposBackup ;; "${SYSTEM_ARCH}") # /etc/pacman.d/mirrorlist backup_file $File_PacmanMirrorList $File_PacmanMirrorListBackup "mirrorlist" # EndeavourOS if [[ "${SYSTEM_NAME}" == *"EndeavourOS"* ]] && [[ -f "${File_PacmanEndeavourOSMirrorList}" ]]; then # /etc/pacman.d/endeavouros-mirrorlist backup_file $File_PacmanEndeavourOSMirrorList $File_PacmanEndeavourOSMirrorListBackup "endeavouros-mirrorlist" fi ;; "${SYSTEM_ALPINE}") # /etc/apk/repositories backup_file $File_AlpineRepositories $File_AlpineRepositoriesBackup "repositories" ;; "${SYSTEM_GENTOO}") # /etc/portage/make.conf backup_file $File_GentooMakeConf $File_GentooMakeConfBackup "make.conf" # /etc/portage/repos.conf/gentoo.conf [ -d "${Dir_GentooReposConf}" ] || mkdir -p "${Dir_GentooReposConf}" backup_file $File_GentooReposConf $File_GentooReposConfBackup "gentoo.conf" ;; "${SYSTEM_NIXOS}") [ ! -d "${Dir_NixConfig}" ] && mkdir -p "${Dir_NixConfig}" # /etc/nix/nix.conf backup_file $File_NixConf $File_NixConfBackup "nix.conf" ;; esac fi } ## 移除原有软件源 function remove_original_mirrors() { function clear_file() { [ -f "$1" ] && sed -i '1,$d' "$1" } case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") # /etc/apt/sources.list.d [ -d "${Dir_AptAdditionalSources}" ] || mkdir -p $Dir_AptAdditionalSources # Debian DEB822 格式源文件 if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_DEBIAN}" ]] && [ -f "${File_DebianSources}" ]; then clear_file $File_DebianSources USE_DEB822_FORMAT="true" fi # Ubuntu DEB822 格式源文件 if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_UBUNTU}" ]] && [ -f "${File_UbuntuSources}" ]; then clear_file $File_UbuntuSources USE_DEB822_FORMAT="true" fi # /etc/apt/sources.list if [[ "${USE_DEB822_FORMAT}" != "true" ]] && [[ "${SYSTEM_JUDGMENT}" != "${SYSTEM_LINUX_MINT}" ]]; then [ -s "${File_AptSourceList}" ] && clear_file $File_AptSourceList fi ## 解决软件源冲突 if [[ "${USE_DEB822_FORMAT}" == "true" ]] && [ -s "${File_AptSourceList}" ]; then if [[ "${SOURCE_BRANCH}" ]]; then sed -e "/^deb\(-src\)\? http.*\/${SOURCE_BRANCH}/d" \ -e "/^#[[:space:]]*deb\(-src\)\? http.*\/${SOURCE_BRANCH}/d" \ -e "/^#.*\(默认禁用源码镜像以提高更新速度\|安全更新软件源\|预发布软件源\).*/d" \ -i \ $File_AptSourceList fi fi # Armbian [ -f "${File_ArmbianRelease}" ] && clear_file $File_ArmbianSourceList # Proxmox VE if [ -f "${File_ProxmoxVersion}" ]; then if [[ "${USE_DEB822_FORMAT}" == "true" ]]; then clear_file $File_ProxmoxSources [ -f "${File_ProxmoxCephSources}" ] && clear_file $File_ProxmoxCephSources else clear_file $File_ProxmoxSourceList [ -f "${File_ProxmoxCephSourceList}" ] && clear_file $File_ProxmoxCephSourceList fi fi # Linux Mint [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_LINUX_MINT}" ]] && clear_file $File_LinuxMintSourceList # Raspberry Pi OS [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_RASPBERRY_PI_OS}" ]] && clear_file $File_RaspberryPiSourceList ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}") if [ ! -d "${Dir_YumRepos}" ]; then mkdir -p "${Dir_YumRepos}" return fi local -a repo_patterns=() if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_FEDORA}" ]]; then repo_patterns=( "fedora.repo" "fedora-updates.repo" "fedora-updates-testing.repo" "fedora-modular.repo" "fedora-updates-modular.repo" "fedora-updates-testing-modular.repo" ) else if [[ "${ONLY_EPEL}" != "false" ]]; then return fi case "${SYSTEM_JUDGMENT}" in "${SYSTEM_RHEL}") case "${SYSTEM_VERSION_ID_MAJOR}" in 7 | 8) repo_patterns=("CentOS-*") ;; *) repo_patterns=( "centos-stream.repo" "centos-stream-addons.repo" ) ;; esac ;; "${SYSTEM_CENTOS}") repo_patterns=("CentOS-*") ;; "${SYSTEM_CENTOS_STREAM}") case "${SYSTEM_VERSION_ID_MAJOR}" in 9 | 10) repo_patterns=( "centos-stream.repo" "centos-stream-addons.repo" ) ;; 8) repo_patterns=("CentOS-Stream-*") ;; esac ;; "${SYSTEM_ROCKY}") case "${SYSTEM_VERSION_ID_MAJOR}" in 9) repo_patterns=( "rocky.repo" "rocky-addons.repo" "rocky-devel.repo" "rocky-extras.repo" ) ;; 8) repo_patterns=("Rocky-*") ;; esac ;; "${SYSTEM_ALMALINUX}") repo_patterns=("almalinux*") ;; "${SYSTEM_ORACLE}") case "${SYSTEM_VERSION_ID_MAJOR}" in 9 | 10) repo_patterns=( "*ol${SYSTEM_VERSION_ID_MAJOR}.repo" "centos-stream.repo" "centos-stream-addons.repo" ) ;; 8) repo_patterns=( "*ol${SYSTEM_VERSION_ID_MAJOR}.repo" "CentOS-Stream-*" ) ;; esac ;; "${SYSTEM_OPENCLOUDOS}") repo_patterns=("OpenCloudOS*") ;; "${SYSTEM_ANOLISOS}") repo_patterns=("AnolisOS*") ;; "${SYSTEM_OPENEULER}") repo_patterns=("openEuler.repo") ;; esac fi for pattern in "${repo_patterns[@]}"; do if [[ -n "$pattern" ]]; then eval "rm -rf $Dir_YumRepos/$pattern" fi done ;; "${SYSTEM_OPENSUSE}") if [ ! -d "${Dir_ZYppRepos}" ]; then mkdir -p "${Dir_ZYppRepos}" return fi rm -rf $Dir_ZYppRepos/repo-* rm -rf $Dir_ZYppRepos/openSUSE:repo-* rm -rf $Dir_ZYppRepos/download.opensuse.org-* ;; "${SYSTEM_ARCH}") clear_file $File_PacmanMirrorList # EndeavourOS if [[ "${SYSTEM_NAME}" == *"EndeavourOS"* ]] && [[ -f "${File_PacmanEndeavourOSMirrorList}" ]]; then clear_file $File_PacmanEndeavourOSMirrorList fi ;; "${SYSTEM_ALPINE}") clear_file $File_AlpineRepositories ;; "${SYSTEM_GENTOO}") clear_file $File_GentooReposConf ;; esac } ## 换源 function change_mirrors_main() { ## 打印软件源内容修改前后差异 function print_diff() { ## 单一文件 function diff_file() { local diff_file=$1 local origin_file=$2 if [ -s "${diff_file}" ] && [ -s "${origin_file}" ]; then if [[ "$(cat "${diff_file}")" != "$(cat "${origin_file}")" ]]; then echo -e "\n${BLUE}${diff_file}${PLAIN} -> ${BLUE}${origin_file}${PLAIN}" diff "${diff_file}" "${origin_file}" -d --color=always -I -B -E fi fi } ## 目录文件 function diff_dir() { local diff_dir=$1 local origin_dir=$2 for item in $(ls $diff_dir | xargs); do diff_file "${diff_dir}/${item}" "${origin_dir}/${item}" done } if command_exists diff && [[ "${BACKED_UP}" == "true" ]]; then case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") if [[ "${USE_DEB822_FORMAT}" == "true" ]]; then # DEB822 格式源文件 if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_DEBIAN}" ]]; then diff_file $File_DebianSourcesBackup $File_DebianSources fi if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_UBUNTU}" ]]; then diff_file $File_UbuntuSourcesBackup $File_UbuntuSources fi else if [[ "${SYSTEM_JUDGMENT}" != "${SYSTEM_LINUX_MINT}" ]]; then diff_file $File_AptSourceListBackup $File_AptSourceList fi fi # Armbian if [ -f "${File_ArmbianRelease}" ]; then diff_file $File_ArmbianSourceListBackup $File_ArmbianSourceList fi # Proxmox VE if [ -f "${File_ProxmoxVersion}" ]; then if [[ "${USE_DEB822_FORMAT}" == "true" ]]; then diff_file $File_ProxmoxSourcesBackup $File_ProxmoxSources [ -f "${File_ProxmoxCephSources}" ] && diff_file $File_ProxmoxCephSourcesBackup $File_ProxmoxCephSources else diff_file $File_ProxmoxSourceListBackup $File_ProxmoxSourceList [ -f "${File_ProxmoxCephSourceList}" ] && diff_file $File_ProxmoxCephSourceListBackup $File_ProxmoxCephSourceList fi fi # Linux Mint if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_LINUX_MINT}" ]]; then diff_file $File_LinuxMintSourceListBackup $File_LinuxMintSourceList fi # Raspberry Pi OS if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_RASPBERRY_PI_OS}" ]]; then diff_file $File_RaspberryPiSourceListBackup $File_RaspberryPiSourceList fi ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}") diff_dir $Dir_YumReposBackup $Dir_YumRepos ;; "${SYSTEM_OPENSUSE}") diff_dir $Dir_ZYppReposBackup $Dir_ZYppRepos ;; "${SYSTEM_ARCH}") diff_file $File_PacmanMirrorListBackup $File_PacmanMirrorList # EndeavourOS if [[ "${SYSTEM_NAME}" == *"EndeavourOS"* ]] && [[ -f "${File_PacmanEndeavourOSMirrorList}" ]]; then diff_file $File_PacmanEndeavourOSMirrorListBackup $File_PacmanEndeavourOSMirrorList fi ;; "${SYSTEM_ALPINE}") diff_file $File_AlpineRepositoriesBackup $File_AlpineRepositories ;; "${SYSTEM_GENTOO}") diff_file $File_GentooMakeConfBackup $File_GentooMakeConf diff_file $File_GentooReposConfBackup $File_GentooReposConf ;; "${SYSTEM_NIXOS}") diff_file $File_NixConfBackup $File_NixConf ;; esac fi } if [[ -z "${SOURCE}" ]]; then USE_OFFICIAL_SOURCE="true" fi ## 调用换源函数 case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}") change_mirrors_Debian ;; "${SYSTEM_REDHAT}") change_mirrors_RedHat ;; "${SYSTEM_OPENEULER}") change_mirrors_openEuler ;; "${SYSTEM_OPENCLOUDOS}") change_mirrors_OpenCloudOS ;; "${SYSTEM_OPENKYLIN}") change_mirrors_openKylin ;; "${SYSTEM_ANOLISOS}") change_mirrors_AnolisOS ;; "${SYSTEM_OPENSUSE}") change_mirrors_openSUSE ;; "${SYSTEM_ARCH}") change_mirrors_ArchLinux ;; "${SYSTEM_ALPINE}") change_mirrors_Alpine ;; "${SYSTEM_GENTOO}") change_mirrors_Gentoo ;; "${SYSTEM_NIXOS}") change_mirrors_NixOS ;; esac ## 比较差异 if [[ "${PRINT_DIFF}" == "true" ]]; then print_diff fi ## 更新软件源 local -a commands=() case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") commands+=("apt-get update") ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}") local package_manager="$(get_package_manager)" commands+=("${package_manager} makecache") ;; "${SYSTEM_OPENSUSE}") commands+=("zypper ref") ;; "${SYSTEM_ARCH}") commands+=("pacman -Sy") ;; "${SYSTEM_ALPINE}") commands+=("apk update -f") ;; "${SYSTEM_GENTOO}") commands+=("emerge --sync --quiet") ;; "${SYSTEM_NIXOS}") commands+=("nix-store --verify") commands+=("nix-channel --update") ;; esac if [[ "${PURE_MODE}" == "true" ]]; then local exec_cmd="" for cmd in "${commands[@]}"; do if [[ -z "${exec_cmd}" ]]; then exec_cmd="${cmd}" else exec_cmd="${exec_cmd} ; ${cmd}" fi done echo '' animate_exec "${exec_cmd}" "${SYNC_MIRROR_TEXT}" if [ $? -ne 0 ]; then echo '' exit 1 fi else echo -e "\n$WORKING ${SYNC_MIRROR_TEXT}...\n" for cmd in "${commands[@]}"; do eval "${cmd}" done if [ $? -eq 0 ]; then echo -e "\n$SUCCESS $(msg "source.changeResult.success")" else echo -e "\n$FAIL $(msg "source.changeResult.fail" "${SYNC_MIRROR_TEXT}")" echo -e "\n$TIP $(msg "source.changeResult.tipTitle" "${SYNC_MIRROR_TEXT}")" echo -e "\n1. $(msg "source.changeResult.tip1")" echo -e "2. $(msg "source.changeResult.tip2" "${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}")" echo -e " $(msg "source.changeResult.tip2.1")" echo -e " $(msg "source.changeResult.tip2.2")" echo -e " $(msg "source.changeResult.tip2.3")" echo -e "3. $(msg "source.changeResult.tip3")\n" exit 1 fi fi } ## 升级软件包 function upgrade_software() { ## 跳过特殊的系统 case "${SYSTEM_JUDGMENT}" in "${SYSTEM_RHEL}" | "${SYSTEM_ORACLE}") return ;; esac local ask_text="" ## 交互确认 if [[ -z "${UPGRADE_SOFTWARE}" ]]; then UPGRADE_SOFTWARE="false" ask_text="$(msg "interaction.upgrade.skip")?" if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then echo '' interactive_select_boolean "${BOLD}${ask_text}${PLAIN}" if [[ "${_SELECT_RESULT}" == "false" ]]; then UPGRADE_SOFTWARE="true" fi else local CHOICE="$(echo -e "\n${BOLD}└─ ${ask_text} [Y/n] ${PLAIN}")" read -rp "${CHOICE}" INPUT [[ -z "${INPUT}" ]] && INPUT=Y case "${INPUT}" in [Yy] | [Yy][Ee][Ss]) ;; [Nn] | [Nn][Oo]) UPGRADE_SOFTWARE="true" ;; *) input_error "$(msg "error.defaultBehavior.noUpdate")" ;; esac fi fi if [[ "${UPGRADE_SOFTWARE}" == "false" ]]; then return fi if [[ -z "${CLEAN_CACHE}" ]]; then CLEAN_CACHE="false" ask_text="$(msg "interaction.cache.autoClean")?" if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then echo '' interactive_select_boolean "${BOLD}${ask_text}${PLAIN}" if [[ "${_SELECT_RESULT}" == "true" ]]; then CLEAN_CACHE="true" fi else local CHOICE="$(echo -e "\n${BOLD}└─ ${ask_text} [Y/n] ${PLAIN}")" read -rp "${CHOICE}" INPUT [[ -z "${INPUT}" ]] && INPUT=Y case "${INPUT}" in [Yy] | [Yy][Ee][Ss]) CLEAN_CACHE="true" ;; [Nn] | [Nn][Oo]) ;; *) input_error "$(msg "error.defaultBehavior.noClean")" ;; esac fi fi local -a commands=() case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") commands+=("apt-get upgrade -y") ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}") local package_manager="$(get_package_manager)" commands+=("${package_manager} upgrade -y") ;; "${SYSTEM_OPENSUSE}") commands+=("zypper update -y") ;; "${SYSTEM_ARCH}") commands+=("pacman -Syu --noconfirm") ;; "${SYSTEM_ALPINE}") commands+=("apk upgrade --no-cache") ;; "${SYSTEM_GENTOO}") commands+=("emerge --update --deep --with-bdeps=y --ask=n @world") ;; "${SYSTEM_NIXOS}") commands+=("nixos-rebuild switch") ;; esac if [[ "${PURE_MODE}" == "true" ]]; then local exec_cmd="" for cmd in "${commands[@]}"; do if [[ -z "${exec_cmd}" ]]; then exec_cmd="${cmd}" else exec_cmd="${exec_cmd} ; ${cmd}" fi done echo '' animate_exec "${exec_cmd}" "$(msg "work.upgradeSoftware")" else echo '' for cmd in "${commands[@]}"; do eval "${cmd}" done fi if [[ "${CLEAN_CACHE}" == "false" ]]; then return fi case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") apt-get autoremove -y >/dev/null 2>&1 apt-get clean >/dev/null 2>&1 ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}") local package_manager="$(get_package_manager)" $package_manager autoremove -y >/dev/null 2>&1 $package_manager clean packages -y >/dev/null 2>&1 ;; "${SYSTEM_OPENSUSE}") rm -rf /var/cache/zypp/* >/dev/null 2>&1 ;; "${SYSTEM_ARCH}") pacman -Scc --noconfirm >/dev/null 2>&1 ;; "${SYSTEM_ALPINE}") rm -rf /var/cache/apk/* >/dev/null 2>&1 ;; "${SYSTEM_GENTOO}") eclean-dist --deep >/dev/null 2>&1 eclean-packages --deep >/dev/null 2>&1 ;; "${SYSTEM_NIXOS}") nix-collect-garbage -d >/dev/null 2>&1 ;; esac } ############################################################################## ## 更换基于 Debian 系 Linux 发行版的软件源 function change_mirrors_Debian() { local apt_source_file=$File_AptSourceList local apt_source_content="" function write_apt_source() { if [[ -n "${apt_source_content}" ]]; then echo "${apt_source_content}" >>$apt_source_file fi apt_source_content="" # 重置内容 } ## 注释的提示语句 local deb_src_disabled_tips="## $(msg "source.comment.disabledSourceCode")" local security_source_tips="## $(msg "source.comment.securitySource")" local proposed_source_tips="## $(msg "source.comment.proposedSource")" ## one-line 格式模板 function _template_deb() { echo "${1} ${WEB_PROTOCOL}://${2}/ ${3} ${4}" } function gen_deb() { echo "$(_template_deb "deb" "${1}" "${2}" "${3}") $(_template_deb "deb-src" "${1}" "${2}" "${3}" | sed -e "s|^|# |g")" } function gen_deb_unsrc() { echo "$(_template_deb "deb" "${1}" "${2}" "${3}")" } function gen_deb_disabled() { echo "$(gen_deb "${1}" "${2}" "${3}" | sed -e "s|^|# |g")" } function gen_deb_unsrc_disabled() { echo "$(gen_deb_unsrc "${1}" "${2}" "${3}" | sed -e "s|^|# |g")" } function gen_deb_security() { echo "${security_source_tips} $(gen_deb "${1}" "${2}-security" "${3}")" } ## DEB822 格式模板 function _template_deb822() { echo "Types: ${1} URIs: ${WEB_PROTOCOL}://${2}/ Suites: ${3} Components: ${4} Signed-By: /usr/share/keyrings/${_DEB22_ARCHIVE_KEYRING:-"${SYSTEM_JUDGMENT,,}-archive-keyring.gpg"}" } function gen_deb822() { echo "$(_template_deb822 "deb" "${1}" "${2}" "${3}") $(_template_deb822 "deb-src" "${1}" "${2}" "${3}" | sed -e "s|^|# |g")" } function gen_deb822_unsrc() { echo "$(_template_deb822 "deb" "${1}" "${2}" "${3}")" } function gen_deb822_disabled() { echo "$(_template_deb822 "deb" "${1}" "${2}" "${3}" | sed -e "s|^|# |g") $(_template_deb822 "deb-src" "${1}" "${2}" "${3}" | sed -e "s|^|# |g")" } function gen_deb822_security() { echo "${security_source_tips} $(gen_deb822 "${1}" "${2}-security" "${3}")" } ## 获取 Debian 软件源相关信息 function _template_get_debian_info() { local data1="${1}" local data2="${2}" local mode="${3:-main}" local codename="${4}" local result="${data2}" case "${mode}" in "security") local -a majors=(8 9 10) local -a codenames=("jessie" "stretch" "buster") ;; *) local -a majors=(8 9 10 11) local -a codenames=("jessie" "stretch" "buster" "bullseye") ;; esac if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_DEBIAN}" ]]; then for version in "${majors[@]}"; do if [[ "${SYSTEM_VERSION_ID_MAJOR}" == "${version}" ]]; then result="${data1}" break fi done else for name in "${codenames[@]}"; do if [[ "${codename}" == "${name}" ]]; then result="${data1}" break fi done fi echo "${result}" } function get_debian_official_source() { # 注:使用官方源时仓库分支固定为 debian,应同此方法一起使用 _template_get_debian_info "archive.debian.org" "deb.debian.org" "main" "${1}" } function get_debian_source_branch() { _template_get_debian_info "debian-archive/debian" "debian" "main" "${1}" } function get_debian_repo_components() { _template_get_debian_info "main contrib non-free" "main contrib non-free non-free-firmware" "main" "${1}" } function get_debian_official_source_security_host() { # 注:使用官方源时仓库分支固定为 debian-security,应同此方法一起使用 _template_get_debian_info "archive.debian.org" "security.debian.org" "security" "${1}" } function get_debian_source_security_branch() { _template_get_debian_info "debian-archive/debian-security" "debian-security" "security" "${1}" } ## Debian 软件源模板 # debian-backports: https://ftp.debian.org/debian/dists # debian-security: https://security.debian.org/debian-security/dists function _template_gen_debian_source() { local mode="${4:-main}" local type="${5:-deb}" local result="" case "${mode}" in "security") case "${2}" in "forky" | "trixie" | "bookworm" | "bullseye" | "oldoldstable" | "oldstable" | "stable" | "testing") if [[ "${type}" == "deb822" ]]; then result="$(gen_deb822_security "${1}" "${2}" "${3}")" else result="$(gen_deb_security "${1}" "${2}" "${3}")" fi ;; "jessie" | "stretch" | "buster") if [[ "${type}" == "deb822" ]]; then result="${security_source_tips} $(gen_deb822 "${1}" "${2}" "${3}")" else result="${security_source_tips} $(gen_deb "${1}" "${2}" "${3}")" fi ;; *) result="" ;; esac ;; *) case "${2}" in "forky" | "trixie" | "bookworm" | "stable" | "oldstable" | "testing") if [[ "${type}" == "deb822" ]]; then result="${deb_src_disabled_tips} $(gen_deb822 "${1}" "${2} ${2}-updates ${2}-backports" "${3}")" else result="$(gen_deb "${1}" "${2}" "${3}") $(gen_deb "${1}" "${2}-updates" "${3}") $(gen_deb "${1}" "${2}-backports" "${3}")" fi ;; *) if [[ "${type}" == "deb822" ]]; then result="${deb_src_disabled_tips} $(gen_deb822 "${1}" "${2} ${2}-updates" "${3}")" else result="$(gen_deb "${1}" "${2}" "${3}") $(gen_deb "${1}" "${2}-updates" "${3}")" fi ;; esac ;; esac echo "${result}" } function gen_debian_deb() { _template_gen_debian_source "${1}" "${2}" "${3}" "main" "deb" } function gen_debian_deb_security() { _template_gen_debian_source "${1}" "${2}" "${3}" "security" "deb" } function gen_debian_deb822() { _template_gen_debian_source "${1}" "${2}" "${3}" "main" "deb822" } function gen_debian_deb822_security() { _template_gen_debian_source "${1}" "${2}" "${3}" "security" "deb822" } ## Ubuntu 软件源模板 function gen_ubuntu_deb() { echo "$(gen_deb "${1}" "${2}" "${3}") $(gen_deb "${1}" "${2}-updates" "${3}") $(gen_deb "${1}" "${2}-backports" "${3}") ${proposed_source_tips} $(gen_deb_disabled "${1}" "${2}-proposed" "${3}")" } function gen_ubuntu_deb822() { echo "${deb_src_disabled_tips} $(gen_deb822 "${1}" "${2} ${2}-updates ${2}-backports" "${3}") ${proposed_source_tips} $(gen_deb822_disabled "${1}" "${2}-proposed" "${3}")" } ## 使用官方源 if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then case "${SYSTEM_JUDGMENT}" in "${SYSTEM_UBUNTU}" | "${SYSTEM_ZORIN}") if [[ "${DEVICE_ARCH_RAW}" == "x86_64" || "${DEVICE_ARCH_RAW}" == *i?86* ]]; then SOURCE="archive.ubuntu.com" else SOURCE="ports.ubuntu.com" fi ;; "${SYSTEM_KALI}") SOURCE="http.kali.org" ;; "${SYSTEM_DEEPIN}") SOURCE="community-packages.deepin.com" ;; esac fi # 注:SOURCE_ SOURCE__BRANCH 系列变量默认为空值,仅在自定义(使用相关命令选项)时提供,需注意逻辑顺序 local repo_components="" # 软件源仓库区域 local source_address="${SOURCE}/${SOURCE_BRANCH}" # 软件源地址 local source_security_host="${SOURCE}" local source_security_branch="${SOURCE_BRANCH}" local source_security_address="" case "${SYSTEM_JUDGMENT}" in "${SYSTEM_DEBIAN}") repo_components="$(get_debian_repo_components "${SYSTEM_VERSION_CODENAME}")" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="$(get_debian_official_source "${SYSTEM_VERSION_CODENAME}")" SOURCE_BRANCH="debian" source_address="${SOURCE}/${SOURCE_BRANCH}" fi # 安全更新源 source_security_branch="$(get_debian_source_security_branch "${SYSTEM_VERSION_CODENAME}")" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then source_security_host="$(get_debian_official_source_security_host "${SYSTEM_VERSION_CODENAME}")" source_security_branch="debian-security" fi source_security_address="${SOURCE_SECURITY:-${source_security_host}}/${SOURCE_SECURITY_BRANCH:-${source_security_branch}}" ## DEB822 / one-line if [[ "${USE_DEB822_FORMAT}" == "true" ]]; then apt_source_file="${File_DebianSources}" if [[ "${SYSTEM_VERSION_CODENAME}" != "sid" ]]; then apt_source_content="$(gen_debian_deb822 "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}") $(gen_debian_deb822_security "${source_security_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}")" else apt_source_content="$(gen_debian_deb822 "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}")" fi else apt_source_file="${File_AptSourceList}" if [[ "${SYSTEM_VERSION_CODENAME}" != "sid" ]]; then apt_source_content="${deb_src_disabled_tips} $(gen_debian_deb "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}") $(gen_debian_deb_security "${source_security_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}")" else apt_source_content="${deb_src_disabled_tips} $(gen_deb "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}")" fi fi write_apt_source ;; "${SYSTEM_UBUNTU}" | "${SYSTEM_ZORIN}") repo_components="main restricted universe multiverse" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then if [[ "${DEVICE_ARCH_RAW}" == "x86_64" || "${DEVICE_ARCH_RAW}" == *i?86* ]]; then SOURCE="archive.ubuntu.com" SOURCE_BRANCH="ubuntu" source_address="${SOURCE}/${SOURCE_BRANCH}" else SOURCE="ports.ubuntu.com" SOURCE_BRANCH="" # 官方源默认无分支(注:有 ubuntu-ports 重定向) source_address="${SOURCE}" fi fi # 安全更新源 source_security_address="${SOURCE_SECURITY:-${source_security_host}}/${SOURCE_SECURITY_BRANCH:-${source_security_branch}}" ## DEB822 / one-line if [[ "${USE_DEB822_FORMAT}" == "true" ]]; then apt_source_file="${File_UbuntuSources}" apt_source_content="$(gen_ubuntu_deb822 "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}") $(gen_deb822_security "${source_security_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}")" else apt_source_file="${File_AptSourceList}" apt_source_content="${deb_src_disabled_tips} $(gen_ubuntu_deb "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}") $(gen_deb_security "${source_security_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}")" fi write_apt_source ;; "${SYSTEM_KALI}") repo_components="main contrib non-free non-free-firmware" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="http.kali.org" SOURCE_BRANCH="" # 官方源无分支 source_address="${SOURCE}" fi apt_source_content="${deb_src_disabled_tips} $(gen_deb "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}")" write_apt_source ;; "${SYSTEM_DEEPIN}") if [[ "${SYSTEM_VERSION_ID_MAJOR}" == "25" ]]; then repo_components="main commercial community" else repo_components="main contrib non-free" fi if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="community-packages.deepin.com" SOURCE_BRANCH="deepin" source_address="${SOURCE}/${SOURCE_BRANCH}" fi apt_source_content="${deb_src_disabled_tips} $(gen_deb "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}")" write_apt_source ;; "${SYSTEM_LINUX_MINT}") # 专用源 repo_components="main upstream import backport" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="packages.linuxmint.com" SOURCE_BRANCH="" # 官方源无分支 source_address="${SOURCE}" fi apt_source_file="${File_LinuxMintSourceList}" apt_source_content="${deb_src_disabled_tips} $(gen_deb_unsrc "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}") " # 注:此处空行用于隔开两种软件源内容 write_apt_source # 底层系统软件源 local base_system_branch base_system_codename if [[ "${SYSTEM_NAME}" == *"LMDE"* ]]; then ## Debian 版(LMDE) base_system_codename="$(get_os_release_value DEBIAN_CODENAME)" [[ -z "${base_system_codename}" ]] && base_system_codename="bookworm" base_system_branch="$(get_debian_source_branch "${base_system_codename}")" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="$(get_debian_official_source "${base_system_codename}")" base_system_branch="debian" fi repo_components="$(get_debian_repo_components "${base_system_codename}")" source_address="${SOURCE_BASE_SYSTEM:-${SOURCE}}/${SOURCE_BASE_SYSTEM_BRANCH:-${base_system_branch}}" # 安全更新源 source_security_branch="$(get_debian_source_security_branch "${base_system_codename}")" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then source_security_host="$(get_debian_official_source_security_host "${base_system_codename}")" source_security_branch="debian-security" fi source_security_address="${SOURCE_SECURITY:-${SOURCE_BASE_SYSTEM:-${source_security_host}}}/${SOURCE_SECURITY_BRANCH:-${source_security_branch}}" # 写入源文件 apt_source_file="${File_LinuxMintSourceList}" apt_source_content="$(gen_debian_deb "${source_address}" "${base_system_codename}" "${repo_components}") $(gen_debian_deb_security "${source_security_address}" "${base_system_codename}" "${repo_components}")" write_apt_source else ## Ubuntu 版 base_system_codename="$(get_os_release_value UBUNTU_CODENAME)" [[ -z "${base_system_codename}" ]] && base_system_codename="noble" if [[ "${DEVICE_ARCH_RAW}" == "x86_64" || "${DEVICE_ARCH_RAW}" == *i?86* ]]; then base_system_branch="ubuntu" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="archive.ubuntu.com" fi else base_system_branch="ubuntu-ports" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="ports.ubuntu.com" fi fi repo_components="main restricted universe multiverse" source_address="${SOURCE_BASE_SYSTEM:-${SOURCE}}/${SOURCE_BASE_SYSTEM_BRANCH:-${base_system_branch}}" # 安全更新源 source_security_address="${SOURCE_SECURITY:-${SOURCE_BASE_SYSTEM:-${source_security_host}}}/${SOURCE_BASE_SYSTEM_BRANCH:-${base_system_branch}}" # 写入源文件 apt_source_file="${File_LinuxMintSourceList}" apt_source_content="$(gen_ubuntu_deb "${source_address}" "${base_system_codename}" "${repo_components}") $(gen_deb_security "${source_security_address}" "${base_system_codename}" "${repo_components}")" write_apt_source fi ;; "${SYSTEM_RASPBERRY_PI_OS}") # 专用源 repo_components="main" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="archive.raspberrypi.org" SOURCE_BRANCH="debian" source_address="${SOURCE}/${SOURCE_BRANCH}" fi apt_source_file="${File_RaspberryPiSourceList}" apt_source_content="${deb_src_disabled_tips} $(gen_deb "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}")" write_apt_source # 底层系统软件源(注:64位系统为 Debian 官方仓库,32位为 Raspbian 仓库) local base_system_branch base_system_codename case "${DEVICE_ARCH_RAW}" in x86_64 | aarch64) ## Debian 版 base_system_codename="${SYSTEM_VERSION_CODENAME}" base_system_branch="$(get_debian_source_branch "${base_system_codename}")" repo_components="$(get_debian_repo_components "${base_system_codename}")" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="$(get_debian_official_source "${base_system_codename}")" base_system_branch="debian" fi source_address="${SOURCE_BASE_SYSTEM:-${SOURCE}}/${SOURCE_BASE_SYSTEM_BRANCH:-${base_system_branch}}" # 安全更新源 source_security_branch="$(get_debian_source_security_branch "${base_system_codename}")" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then source_security_host="$(get_debian_official_source_security_host "${base_system_codename}")" source_security_branch="debian-security" fi source_security_address="${SOURCE_SECURITY:-${SOURCE_BASE_SYSTEM:-${source_security_host}}}/${SOURCE_SECURITY_BRANCH:-${source_security_branch}}" # 写入源文件 apt_source_file="${File_AptSourceList}" apt_source_content="${deb_src_disabled_tips} $(gen_debian_deb "${source_address}" "${base_system_codename}" "${repo_components}") $(gen_debian_deb_security "${source_security_address}" "${base_system_codename}" "${repo_components}")" write_apt_source ;; *) ## Raspbian 版 base_system_branch="raspbian" base_system_codename="${SYSTEM_VERSION_CODENAME}" repo_components="main contrib non-free rpi" if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="raspbian.raspberrypi.org" source_address="${SOURCE_BASE_SYSTEM:-${SOURCE}}/${SOURCE_BASE_SYSTEM_BRANCH:-${base_system_branch}}" else source_address="${SOURCE_BASE_SYSTEM:-${SOURCE}}/${SOURCE_BASE_SYSTEM_BRANCH:-${base_system_branch}}/raspbian" fi # 写入源文件 apt_source_file="${File_AptSourceList}" apt_source_content="${deb_src_disabled_tips} $(gen_deb "${source_address}" "${base_system_codename}" "${repo_components}")" # multiarch 源 if [[ "${DEVICE_ARCH_RAW}" == "armv7l" && "${USE_OFFICIAL_SOURCE}" != "true" ]]; then source_address="${SOURCE_BASE_SYSTEM:-${SOURCE}}/${SOURCE_BASE_SYSTEM_BRANCH:-${base_system_branch}}" apt_source_content="${apt_source_content} ## multiarch # deb [arch=arm64] ${WEB_PROTOCOL}://${source_address}/multiarch/ ${base_system_codename} ${repo_components}" fi write_apt_source ;; esac ;; esac ## 处理其它衍生操作系统的专用源 # Armbian if [ -f "${File_ArmbianRelease}" ]; then apt_source_file="${File_ArmbianSourceList}" apt_source_content="deb [signed-by=/usr/share/keyrings/armbian.gpg] ${WEB_PROTOCOL}://${SOURCE}/armbian ${SYSTEM_VERSION_CODENAME} main ${SYSTEM_VERSION_CODENAME}-utils ${SYSTEM_VERSION_CODENAME}-desktop" write_apt_source fi # Proxmox VE if [ -f "${File_ProxmoxVersion}" ]; then if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then source_address="download.proxmox.com" else source_address="${SOURCE}/proxmox" fi if [[ "${USE_DEB822_FORMAT}" == "true" ]]; then _DEB22_ARCHIVE_KEYRING="proxmox-archive-keyring.gpg" apt_source_file="${File_ProxmoxSources}" apt_source_content="$(gen_deb822_unsrc "${source_address}/debian/pve" "${SYSTEM_VERSION_CODENAME}" "pve-no-subscription")" write_apt_source _DEB22_ARCHIVE_KEYRING="" # Ceph 仓库 if [ -f "${File_ProxmoxCephSources}" ]; then local ceph_codename="$(ceph -v | grep ceph | awk '{print $(NF-1)}')" apt_source_file="${File_ProxmoxCephSources}" apt_source_content="$(gen_deb822_unsrc "${source_address}/debian/ceph-${ceph_codename}" "${SYSTEM_VERSION_CODENAME}" "no-subscription")" write_apt_source fi else apt_source_file="${File_ProxmoxSourceList}" apt_source_content="$(gen_deb_unsrc "${source_address}/debian/pve" "${SYSTEM_VERSION_CODENAME}" "pve-no-subscription")" write_apt_source # Ceph 仓库 if [ -f "${File_ProxmoxCephSourceList}" ]; then local ceph_codename="$(ceph -v | grep ceph | awk '{print $(NF-1)}')" apt_source_file="${File_ProxmoxCephSourceList}" apt_source_content="$(gen_deb_unsrc "${source_address}/debian/ceph-${ceph_codename}" "${SYSTEM_VERSION_CODENAME}" "no-subscription")" write_apt_source fi fi # CT Templates if [ -s /usr/share/perl5/PVE/APLInfo.pm ]; then sed -e "s|url => [\"']https\?://[^/]*/images[\"']|url => \"${WEB_PROTOCOL}://${source_address}/images\"|g" \ -i \ /usr/share/perl5/PVE/APLInfo.pm fi fi } ## 更换基于 RedHat 系 Linux 发行版的软件源 function change_mirrors_RedHat() { ## 仅 EPEL 模式 if [[ "${ONLY_EPEL}" == "true" ]]; then change_mirrors_or_install_EPEL # EPEL 附加软件包 return fi ## 生成 repo 源文件 case "${SYSTEM_JUDGMENT}" in "${SYSTEM_RHEL}") case "${SYSTEM_VERSION_ID_MAJOR}" in 7 | 8) gen_repo_files_CentOS "${SYSTEM_VERSION_ID_MAJOR}" ;; *) gen_repo_files_CentOSStream "${SYSTEM_VERSION_ID_MAJOR}" ;; esac ;; "${SYSTEM_CENTOS}") gen_repo_files_CentOS "${SYSTEM_VERSION_ID_MAJOR}" ;; "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ORACLE}") gen_repo_files_CentOSStream "${SYSTEM_VERSION_ID_MAJOR}" ;; "${SYSTEM_ROCKY}") gen_repo_files_RockyLinux "${SYSTEM_VERSION_ID_MAJOR}" ;; "${SYSTEM_ALMALINUX}") gen_repo_files_AlmaLinux "${SYSTEM_VERSION_ID_MAJOR}" ;; "${SYSTEM_FEDORA}") gen_repo_files_Fedora "${SYSTEM_VERSION_ID}" ;; "${SYSTEM_OPENCLOUDOS}") gen_repo_files_OpenCloudOS "${SYSTEM_VERSION_ID}" ;; "${SYSTEM_ANOLISOS}") gen_repo_files_AnolisOS "${SYSTEM_VERSION_ID}" ;; esac ## 使用官方源 if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_CENTOS}" ]]; then SOURCE="vault.centos.org" SOURCE_BRANCH="centos" else case "${SYSTEM_JUDGMENT}" in "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ORACLE}") if [[ "${SYSTEM_VERSION_ID_MAJOR}" == 8 ]]; then SOURCE="vault.centos.org" SOURCE_BRANCH="centos" else change_mirrors_or_install_EPEL # EPEL 附加软件包 return fi ;; *) change_mirrors_or_install_EPEL # EPEL 附加软件包 return ;; esac fi fi ## 修改源 cd $Dir_YumRepos case "${SYSTEM_JUDGMENT}" in "${SYSTEM_RHEL}") case "${SYSTEM_VERSION_ID_MAJOR}" in 7 | 8) sed -e "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" \ -e "s|^mirrorlist=|#mirrorlist=|g" \ -i \ CentOS-* case "${SYSTEM_VERSION_ID_MAJOR}" in 8) sed -e "s|mirror.centos.org/\$contentdir|mirror.centos.org/${SOURCE_BRANCH}|g" \ -e "s|\$releasever|8.5.2111|g" \ -i \ CentOS-* sed -e "s|vault.centos.org/\$contentdir|vault.centos.org/${SOURCE_VAULT_BRANCH:-"centos-vault"}|g" \ -i \ CentOS-Linux-Sources.repo ;; 7) sed -e "s|mirror.centos.org/centos|mirror.centos.org/${SOURCE_BRANCH}|g" \ -e "s|\$releasever|7.9.2009|g" \ -i \ CentOS-* sed -e "s|vault.centos.org/centos|vault.centos.org/${SOURCE_VAULT_BRANCH:-"centos-vault"}|g" \ -i \ CentOS-Sources.repo ;; esac sed -e "s|mirror.centos.org|${SOURCE}|g" \ -e "s|vault.centos.org|${SOURCE_VAULT:-${SOURCE}}|g" \ -i \ CentOS-* ;; *) sed -e "s|^#baseurl=https|baseurl=${WEB_PROTOCOL}|g" \ -e "s|^metalink=|#metalink=|g" \ -e "s|mirror.stream.centos.org|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ centos.repo \ centos-addons.repo # 禁用 GPG 签名检查 sed -e "s|gpgcheck=1|gpgcheck=0|g" \ -i \ centos.repo \ centos-addons.repo ;; esac ;; "${SYSTEM_CENTOS}") sed -e "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" \ -e "s|^mirrorlist=|#mirrorlist=|g" \ -i \ CentOS-* if [[ "${DEVICE_ARCH_RAW}" == "x86_64" ]]; then SOURCE_BRANCH="centos-vault" else SOURCE_BRANCH="centos-altarch" fi case "${SYSTEM_VERSION_ID_MAJOR}" in 8) # 最终版本为 8.5.2011(2022-02) sed -e "s|mirror.centos.org/\$contentdir|mirror.centos.org/${SOURCE_BRANCH}|g" \ -e "s|\$releasever|8.5.2111|g" \ -i \ CentOS-* sed -e "s|vault.centos.org/\$contentdir|vault.centos.org/${SOURCE_VAULT_BRANCH:-"centos-vault"}|g" \ -i \ CentOS-Linux-Sources.repo ;; 7) # 最终版本为 7.9.2009(2024-07) sed -e "s|mirror.centos.org/centos|mirror.centos.org/${SOURCE_BRANCH}|g" \ -e "s|\$releasever|7.9.2009|g" \ -i \ CentOS-* sed -e "s|vault.centos.org/centos|vault.centos.org/${SOURCE_VAULT_BRANCH:-"centos-vault"}|g" \ -i \ CentOS-Sources.repo ;; esac sed -e "s|mirror.centos.org|${SOURCE}|g" \ -e "s|vault.centos.org|${SOURCE_VAULT:-${SOURCE}}|g" \ -i \ CentOS-* ;; "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ORACLE}") case "${SYSTEM_VERSION_ID_MAJOR}" in 9 | 10) sed -e "s|^#baseurl=https|baseurl=${WEB_PROTOCOL}|g" \ -e "s|^metalink=|#metalink=|g" \ -e "s|mirror.stream.centos.org|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ centos.repo \ centos-addons.repo if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_ORACLE}" ]]; then # 禁用 GPG 签名检查 sed -e "s|gpgcheck=1|gpgcheck=0|g" \ -i \ centos.repo \ centos-addons.repo fi ;; 8) sed -e "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" \ -e "s|^mirrorlist=|#mirrorlist=|g" \ -e "s|mirror.centos.org/\$contentdir|${SOURCE}/${SOURCE_BRANCH}|g" \ -e "s|vault.centos.org/\$contentdir|${SOURCE_VAULT:-${SOURCE}}/${SOURCE_VAULT_BRANCH:-"centos-vault"}|g" \ -i \ CentOS-Stream-* if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_ORACLE}" ]]; then # 禁用 GPG 签名检查 sed -e "s|gpgcheck=1|gpgcheck=0|g" \ -i \ CentOS-Stream-* fi ;; esac ;; "${SYSTEM_ROCKY}") case "${SYSTEM_VERSION_ID_MAJOR}" in 9 | 10) sed -e "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" \ -e "s|^mirrorlist=|#mirrorlist=|g" \ -e "s|dl.rockylinux.org/\$contentdir|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ rocky.repo \ rocky-addons.repo \ rocky-devel.repo \ rocky-extras.repo ;; 8) sed -e "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" \ -e "s|^mirrorlist=|#mirrorlist=|g" \ -e "s|dl.rockylinux.org/\$contentdir|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ Rocky-* ;; esac ;; "${SYSTEM_ALMALINUX}") case "${SYSTEM_VERSION_ID_MAJOR}" in 10) sed -e "s|^# baseurl=https|baseurl=${WEB_PROTOCOL}|g" \ -e "s|^mirrorlist=|#mirrorlist=|g" \ -e "s|vault.almalinux.org|${SOURCE_VAULT:-${SOURCE}}/${SOURCE_VAULT_BRANCH:-"almalinux-vault"}|g" \ -e "s|repo.almalinux.org/almalinux|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ almalinux-appstream.repo \ almalinux-baseos.repo \ almalinux-crb.repo \ almalinux-extras.repo \ almalinux-highavailability.repo \ almalinux-nfv.repo \ almalinux-rt.repo \ almalinux-saphana.repo \ almalinux-sap.repo ;; 9) sed -e "s|^# baseurl=https|baseurl=${WEB_PROTOCOL}|g" \ -e "s|^mirrorlist=|#mirrorlist=|g" \ -e "s|repo.almalinux.org/vault|${SOURCE_VAULT:-${SOURCE}}/${SOURCE_VAULT_BRANCH:-"almalinux-vault"}|g" \ -e "s|repo.almalinux.org/almalinux|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ almalinux-appstream.repo \ almalinux-baseos.repo \ almalinux-crb.repo \ almalinux-extras.repo \ almalinux-highavailability.repo \ almalinux-nfv.repo \ almalinux-plus.repo \ almalinux-resilientstorage.repo \ almalinux-rt.repo \ almalinux-sap.repo \ almalinux-saphana.repo ;; 8) sed -e "s|^mirrorlist=|#mirrorlist=|g" \ -e "s|^# baseurl=https|baseurl=${WEB_PROTOCOL}|g" \ -e "s|repo.almalinux.org/vault|${SOURCE_VAULT:-${SOURCE}}/${SOURCE_VAULT_BRANCH:-"almalinux-vault"}|g" \ -e "s|repo.almalinux.org/almalinux|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ almalinux-ha.repo \ almalinux-nfv.repo \ almalinux-plus.repo \ almalinux-powertools.repo \ almalinux-resilientstorage.repo \ almalinux-rt.repo \ almalinux-sap.repo \ almalinux-saphana.repo \ almalinux.repo ;; esac ;; "${SYSTEM_FEDORA}") # 自 Fedora 39 起不再使用 modular 仓库 local fedora_repo_files="fedora.repo fedora-updates.repo fedora-updates-testing.repo" if [[ "${SYSTEM_VERSION_ID}" -lt 39 ]]; then fedora_repo_files="${fedora_repo_files} fedora-modular.repo fedora-updates-modular.repo fedora-updates-testing-modular.repo" fi sed -e "s|^metalink=|#metalink=|g" \ -e "s|^#baseurl=http|baseurl=${WEB_PROTOCOL}|g" \ -e "s|download.example/pub/fedora/linux|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ $fedora_repo_files ;; "${SYSTEM_OPENCLOUDOS}") case "${SYSTEM_VERSION_ID_MAJOR}" in 8) sed -e "s|^baseurl=https|baseurl=${WEB_PROTOCOL}|g" \ -e "s|mirrors.opencloudos.tech/opencloudos|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ OpenCloudOS-Debuginfo.repo \ OpenCloudOS.repo \ OpenCloudOS-Sources.repo ;; esac ;; "${SYSTEM_ANOLISOS}") # Anolis OS 仓库配置特殊,baseurl 同时使用 http 和 https 协议,gpgkey 同时使用软件源仓库远程路径和本地路径 case "${SYSTEM_VERSION_ID_MAJOR}" in 8) sed -e "s|http\(s\)\?://mirrors.openanolis.cn/anolis|${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ AnolisOS-* ;; esac ;; esac ## 重置使用官方源时定义的变量 if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_CENTOS}" ]]; then SOURCE="" SOURCE_BRANCH="" else case "${SYSTEM_JUDGMENT}" in "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ORACLE}") if [[ "${SYSTEM_VERSION_ID_MAJOR}" == 8 ]]; then SOURCE="" SOURCE_BRANCH="" fi ;; esac fi fi change_mirrors_or_install_EPEL # EPEL 附加软件包 } ## 更换 openEuler 软件源 function change_mirrors_openEuler() { ## 生成 repo 源文件 gen_repo_files_openEuler ## 使用官方源 [[ "${USE_OFFICIAL_SOURCE}" == "true" ]] && return ## 修改源 cd $Dir_YumRepos sed -e "s|^baseurl=http|baseurl=${WEB_PROTOCOL}|g" \ -e "s|repo.openeuler.org|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ openEuler.repo } ## 更换 OpenCloudOS 软件源 function change_mirrors_OpenCloudOS() { ## 生成 repo 源文件 gen_repo_files_OpenCloudOS "${SYSTEM_VERSION_ID}" ## 使用官方源 [[ "${USE_OFFICIAL_SOURCE}" == "true" ]] && return ## 修改源 cd $Dir_YumRepos if [[ "${SYSTEM_VERSION_ID}" == 23 ]]; then sed -e "s|^baseurl=https|baseurl=${WEB_PROTOCOL}|g" \ -e "s|mirrors.opencloudos.tech/opencloudos-stream|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ OpenCloudOS-Stream.repo else sed -e "s|^baseurl=https|baseurl=${WEB_PROTOCOL}|g" \ -e "s|mirrors.opencloudos.tech/opencloudos|${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ OpenCloudOS.repo fi } ## 更换 openKylin 软件源 function change_mirrors_openKylin() { local deb_src_disabled_tips="## $(msg "source.comment.disabledSourceCode")" function gen_deb() { echo "deb ${WEB_PROTOCOL}://${1}/ ${2} ${3} # deb-src ${WEB_PROTOCOL}://${1}/ ${2} ${3} deb ${WEB_PROTOCOL}://${1}/ ${2}-security ${3} # deb-src ${WEB_PROTOCOL}://${1}/ ${2}-security ${3} deb ${WEB_PROTOCOL}://${1}/ ${2}-updates ${3} # deb-src ${WEB_PROTOCOL}://${1}/ ${2}-updates ${3}" } ## 使用官方源 if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="archive.build.openkylin.top" fi local repo_components="main cross pty" # 仓库区域 local source_address="${SOURCE}/${SOURCE_BRANCH}" echo "${deb_src_disabled_tips} $(gen_deb "${source_address}" "${SYSTEM_VERSION_CODENAME}" "${repo_components}")" >>$File_AptSourceList } ## 更换 Anolis OS 软件源 function change_mirrors_AnolisOS() { ## 生成 repo 源文件 gen_repo_files_AnolisOS "${SYSTEM_VERSION_ID}" ## 使用官方源 [[ "${USE_OFFICIAL_SOURCE}" == "true" ]] && return ## 修改源 cd $Dir_YumRepos # Anolis OS 仓库配置特殊,baseurl 同时使用 http 和 https 协议,gpgkey 同时使用软件源仓库远程路径和本地路径 case "${SYSTEM_VERSION_ID_MAJOR}" in 23) sed -e "s|http\(s\)\?://mirrors.openanolis.cn/anolis|${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ AnolisOS-Debuginfo.repo \ AnolisOS.repo \ AnolisOS-Source.repo ;; 8) sed -e "s|http\(s\)\?://mirrors.openanolis.cn/anolis|${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}|g" \ -i \ AnolisOS-* ;; esac } ## 更换 openSUSE 软件源 function change_mirrors_openSUSE() { ## 禁用 RIS zypper remove -y openSUSE-repos-* >/dev/null 2>&1 ## 生成 repo 源文件 case "${SYSTEM_ID}" in "opensuse-leap") gen_repo_files_openSUSE "leap" "${SYSTEM_VERSION_ID}" ;; "opensuse-tumbleweed") gen_repo_files_openSUSE "tumbleweed" ;; esac ## 使用官方源 [[ "${USE_OFFICIAL_SOURCE}" == "true" ]] && return ## 修改源 cd $Dir_ZYppRepos local -a opensuse_repo_files=() case "${SYSTEM_ID}" in opensuse-leap) case "${SYSTEM_VERSION_ID_MAJOR}" in 16) opensuse_repo_files=( "openSUSE:repo-non-oss-debug.repo" "openSUSE:repo-non-oss.repo" "openSUSE:repo-oss-debug.repo" "openSUSE:repo-oss.repo" "openSUSE:repo-oss-source.repo" ) ;; 15) case "${SYSTEM_VERSION_ID_MINOR}" in [0-2]) opensuse_repo_files=( "repo-debug-non-oss.repo" "repo-debug.repo" "repo-debug-update-non-oss.repo" "repo-debug-update.repo" "repo-non-oss.repo" "repo-oss.repo" "repo-source-non-oss.repo" "repo-source.repo" "repo-update-non-oss.repo" "repo-update.repo" ) ;; *) opensuse_repo_files=( "repo-backports-debug-update.repo" "repo-backports-update.repo" "repo-debug-non-oss.repo" "repo-debug.repo" "repo-debug-update-non-oss.repo" "repo-debug-update.repo" "repo-non-oss.repo" "repo-openh264.repo" "repo-oss.repo" "repo-sle-debug-update.repo" "repo-sle-update.repo" "repo-source.repo" "repo-update-non-oss.repo" "repo-update.repo" ) ;; esac ;; esac ;; opensuse-tumbleweed) opensuse_repo_files=( "repo-debug.repo" "repo-non-oss.repo" "repo-openh264.repo" "repo-oss.repo" "repo-source.repo" "repo-update.repo" ) ;; esac sed -e "s#\(baseurl\|gpgkey\)=http://\(cdn\|download\)\.opensuse\.org/\(distribution\|update\|tumbleweed\|factory\|slowroll\|history\)/#\1=${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}/\3/#g" \ -i \ "${opensuse_repo_files[@]}" } ## 更换 Arch Linux 系 Linux 发行版的软件源 function change_mirrors_ArchLinux() { case "${SYSTEM_JUDGMENT}" in "${SYSTEM_ARCH}") ## 修改源 case "${SOURCE_BRANCH}" in "archlinuxarm") [[ "${USE_OFFICIAL_SOURCE}" == "true" ]] && SOURCE="mirror.archlinuxarm.org" ## 使用官方源 echo "Server = ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}/\$arch/\$repo" >>$File_PacmanMirrorList ;; *) [[ "${USE_OFFICIAL_SOURCE}" == "true" ]] && SOURCE="mirror.pkgbuild.com" ## 使用官方源 echo "Server = ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}/\$repo/os/\$arch" >>$File_PacmanMirrorList ;; esac # EndeavourOS if [[ "${SYSTEM_NAME}" == *"EndeavourOS"* ]] && [[ -f "${File_PacmanEndeavourOSMirrorList}" ]]; then [[ "${USE_OFFICIAL_SOURCE}" == "true" ]] && SOURCE="mirror.alpix.eu" ## 使用官方源 echo "Server = ${WEB_PROTOCOL}://${SOURCE}/endeavouros/repo/\$repo/\$arch" >>$File_PacmanEndeavourOSMirrorList fi ;; "${SYSTEM_MANJARO}") ## 使用官方源 [[ "${USE_OFFICIAL_SOURCE}" == "true" ]] && SOURCE="mirrors2.manjaro.org" ## 修改源 echo "Server = ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}/stable/\$repo/\$arch" >>$File_PacmanMirrorList ;; esac # if [[ "${USE_ARCHLINUXCN_SOURCE}" == "true" ]]; then # # /etc/pacman.conf # [[ "${USE_OFFICIAL_SOURCE}" == "true" ]] && SOURCE="repo.archlinuxcn.org" ## 使用官方源 # echo -e "[archlinuxcn]\nServer = ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}/\$arch" >>/etc/pacman.conf # fi } ## 更换 Alpine Linux 软件源 function change_mirrors_Alpine() { ## 使用官方源 if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then SOURCE="dl-cdn.alpinelinux.org" fi local version_name echo "${SYSTEM_PRETTY_NAME}" | grep " edge" -q if [ $? -eq 0 ]; then version_name="edge" else version_name="v${SYSTEM_VERSION_ID%.*}" fi ## 修改源 echo "${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}/${version_name}/main ${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}/${version_name}/community" >>$File_AlpineRepositories } ## 更换 Gentoo 软件源 function change_mirrors_Gentoo() { ## 使用官方源 if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then grep -Eq "^GENTOO_MIRRORS=" $File_GentooMakeConf if [ $? -eq 0 ]; then sed -e "/^GENTOO_MIRRORS=/d" \ -i \ $File_GentooMakeConf fi [ -f "${File_GentooReposConf}" ] && rm -rf $File_GentooReposConf return fi ## 修改源 grep -Eq "^GENTOO_MIRRORS=" $File_GentooMakeConf if [ $? -eq 0 ]; then sed -e "s|^GENTOO_MIRRORS=.*|GENTOO_MIRRORS=\"${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}\"|g" \ -i \ $File_GentooMakeConf else echo -e "\nGENTOO_MIRRORS=\"${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}\"" >>$File_GentooMakeConf fi echo "[DEFAULT] main-repo = gentoo [gentoo] location = /usr/portage sync-type = rsync sync-uri = rsync://${SOURCE_PORTAGE:-${SOURCE}}/${SOURCE_PORTAGE_BRANCH:-"gentoo-portage"} auto-sync = yes" >$File_GentooReposConf } ## 更换 NixOS 软件源 function change_mirrors_NixOS() { local binary_cache_source channel_source if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then binary_cache_source="https://cache.nixos.org/" channel_source="https://nixos.org/channels" else binary_cache_source="${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}/store https://cache.nixos.org/" channel_source="${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}" fi # binary cache sed -e "s|^substituters.*|substituters = ${binary_cache_source}|g" \ -i \ $File_NixConf # channel nix-channel --add "${channel_source}/nixos-${SYSTEM_VERSION_ID}" nixos nix-channel --update >/dev/null 2>&1 } ## EPEL (Extra Packages for Enterprise Linux) 附加软件包 - 安装或更换软件源 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 "${SYSTEM_REDHAT}") if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_FEDORA}" ]]; then return else epel_version="${SYSTEM_VERSION_ID_MAJOR}" fi ;; *) return ;; esac ## EPEL 7 if [[ "${epel_version}" == "7" ]]; then [ -z "${SOURCE_EPEL_BRANCH}" ] && SOURCE_EPEL_BRANCH="epel-archive" [[ "${PURE_MODE}" != "true" ]] && echo -e "\n$WARN $(msg "warn.EPEL7")" [[ "${PURE_MODE}" != "true" ]] && echo -e "\n$TIP $(msg "tip.EPEL7")\n\n${GREEN}➜${PLAIN} ${WEB_PROTOCOL}://${SOURCE_EPEL:-${SOURCE}}/${SOURCE_EPEL_BRANCH:-"epel"}" fi ## 安装 EPEL 软件包 if [ $VERIFICATION_EPEL -ne 0 ]; then echo -e "\n${WORKING} $(msg "work.installEPELPackage")\n" local package_manager="$(get_package_manager)" local package_path="epel/epel-release-latest-${epel_version}" case "${epel_version}" in 7) package_path="epel-archive/7/${DEVICE_ARCH_RAW}/Packages/e/epel-release-7-14" ;; 9) ## CentOS Stream 9 特殊,有两个不同的发行包 epel-release epel-next-release case "${SYSTEM_JUDGMENT}" in "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ORACLE}" | "${SYSTEM_RHEL}") package_path="epel/epel{,-next}-release-latest-9" ;; esac ;; esac eval $package_manager install -y https://mirrors.cloud.tencent.com/${package_path}.noarch.rpm rm -rf $Dir_YumRepos/epel* fi ## 删除原有 repo 源文件 if [ -d "${Dir_YumRepos}" ]; then ls $Dir_YumRepos | grep epel -q [ $? -eq 0 ] && rm -rf $Dir_YumRepos/epel* fi if [ -d "${Dir_YumReposBackup}" ]; then ls $Dir_YumReposBackup | grep epel -q [ $? -eq 0 ] && rm -rf $Dir_YumReposBackup/epel* fi ## 生成 repo 源文件 gen_repo_files_EPEL "${SYSTEM_VERSION_ID_MAJOR}" if [[ "${epel_version}" == 9 ]]; then case "${SYSTEM_JUDGMENT}" in "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ORACLE}" | "${SYSTEM_RHEL}") gen_repo_files_EPEL_NEXT "${SYSTEM_VERSION_ID_MAJOR}" ;; esac fi ## 使用官方源 if [[ "${USE_OFFICIAL_SOURCE}" == "true" || "${USE_OFFICIAL_SOURCE_EPEL}" == "true" ]]; then case "${epel_version}" in 7) SOURCE_EPEL="dl.fedoraproject.org/pub/archive" ;; *) SOURCE_EPEL="dl.fedoraproject.org/pub" ;; esac fi ## 修改源 sed -e "s|^#baseurl=http\(s\)\?|baseurl=${WEB_PROTOCOL}|g" \ -e "s|^metalink=|#metalink=|g" \ -e "s|download.example/pub/epel|${SOURCE_EPEL:-${SOURCE}}/${SOURCE_EPEL_BRANCH:-"epel"}|g" \ -i \ $Dir_YumRepos/epel* ## 启用所需的仓库(EPEL 需要结合 PowerTools / CRB 使用) case "${epel_version}" in 9 | 10) dnf config-manager --set-enabled crb >/dev/null 2>&1 ;; 8) dnf config-manager --set-enabled powertools >/dev/null 2>&1 ;; esac } ## 选择系统包管理器 function get_package_manager() { local command="yum" case "${SYSTEM_JUDGMENT}" in "${SYSTEM_RHEL}" | "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ROCKY}" | "${SYSTEM_ALMALINUX}" | "${SYSTEM_ORACLE}") case "${SYSTEM_VERSION_ID_MAJOR}" in 9 | 10) command="dnf" ;; esac ;; "${SYSTEM_FEDORA}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}") command="dnf" ;; esac echo "${command}" } function interactive_select_list() { _SELECT_RESULT="" eval "local -a __values=(\"\${${1}[@]}\")" local -a __labels=() local message="${2}" local selected=0 local start=0 local page_size=$(($(tput lines 2>/dev/null) - 3)) if [[ "${3}" ]]; then eval "__labels=(\"\${${3}[@]}\")" fi function clear_menu() { tput rc 2>/dev/null for ((i = 0; i < ${#__values[@]} + 1; i++)); do echo -e "\r\033[K" done tput rc 2>/dev/null } function cleanup() { clear_menu tput rc 2>/dev/null tput cnorm 2>/dev/null tput rmcup 2>/dev/null echo -e "\n\033[1;44m $(msg "interaction.common.tip") \033[0m \033[31m$(msg "interaction.common.operationCanceled")\033[0m\n" exit 130 } function draw_menu() { tput clear 2>/dev/null tput cup 0 0 2>/dev/null echo -e "${message}" local end=$((start + page_size - 1)) local label if [ $end -ge ${#__values[@]} ]; then end=${#__values[@]}-1 fi for ((i = start; i <= end; i++)); do if [[ "${__labels[$i]}" ]]; then label="${__labels[$i]}" else label="${__values[$i]}" fi if [ "$i" -eq "${selected}" ]; then echo -e "\e[34;4m➤ ${label}\e[0m" else echo -e " ${label}" fi done } function read_key() { IFS= read -rsn1 key if [[ $key == $'\x1b' ]]; then IFS= read -rsn2 key key="$key" fi echo "$key" } tput smcup 2>/dev/null tput sc 2>/dev/null tput civis 2>/dev/null trap "cleanup" INT TERM draw_menu while true; do key=$(read_key) case "$key" in "[A" | "w" | "W") if [ "${selected}" -gt 0 ]; then selected=$((selected - 1)) if [ "${selected}" -lt "$start" ]; then start=$((start - 1)) fi fi ;; "[B" | "s" | "S") if [ "${selected}" -lt $((${#__values[@]} - 1)) ]; then selected=$((selected + 1)) if [ "${selected}" -ge $((start + page_size)) ]; then start=$((start + 1)) fi fi ;; "") tput rmcup break ;; *) ;; esac draw_menu done tput cnorm 2>/dev/null tput rmcup 2>/dev/null _SELECT_RESULT="${__values[${selected}]}" if [ "${__labels[${selected}]}" ]; then _SELECT_RESULT="${_SELECT_RESULT}@@${__labels[${selected}]}" fi } function interactive_select_boolean() { _SELECT_RESULT="" local selected=0 local message="$1" local positive_title="${2:-"$(msg "interaction.common.yes")"}" local negative_title="${3:-"$(msg "interaction.common.no")"}" local menu_height=3 local original_line function store_position() { original_line=$(tput lines 2>/dev/null) } function clear_menu() { for ((i = 0; i < $menu_height; i++)); do tput cuu1 2>/dev/null tput el 2>/dev/null done } function cleanup() { clear_menu tput cnorm 2>/dev/null echo -e "\n\033[1;44m $(msg "interaction.common.tip") \033[0m \033[31m$(msg "interaction.common.operationCanceled")\033[0m\n" exit 130 } function draw_menu() { echo -e "╭─ ${message}" echo -e "│" if [ "${selected}" -eq 0 ]; then echo -e "╰─ \033[34m●\033[0m ${positive_title}\033[2m / ○ ${negative_title}\033[0m" else echo -e "╰─ \033[2m○ ${positive_title} / \033[0m\033[34m●\033[0m ${negative_title}" fi } function read_key() { IFS= read -rsn1 key if [[ $key == $'\x1b' ]]; then IFS= read -rsn2 key key="$key" fi echo "$key" } tput civis 2>/dev/null store_position trap "cleanup" INT TERM draw_menu while true; do key=$(read_key) case "$key" in "[D" | "a" | "A") if [ "${selected}" -gt 0 ]; then selected=$((selected - 1)) clear_menu draw_menu fi ;; "[C" | "d" | "D") if [ "${selected}" -lt 1 ]; then selected=$((selected + 1)) clear_menu draw_menu fi ;; "") clear_menu break ;; *) ;; esac done echo -e "╭─ ${message}" echo -e "│" if [ "${selected}" -eq 0 ]; then echo -e "╰─ \033[32m●\033[0m \033[1m${positive_title}\033[0m\033[2m / ○ ${negative_title}\033[0m" _SELECT_RESULT="true" else echo -e "╰─ \033[2m○ ${positive_title} / \033[0m\033[32m●\033[0m \033[1m${negative_title}\033[0m" _SELECT_RESULT="false" fi tput cnorm 2>/dev/null } function animate_exec() { local cmd="$1" local title="$2" local max_lines=${3:-5} local spinner_style="${4:-dots}" local refresh_rate="${5:-0.1}" local scroll_mode="${6:-1}" if [[ "${scroll_mode}" == "0" ]]; then echo -e "◉ ${title} \n" eval "${cmd}" return $? fi local -A spinners=([dots]="⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏" [circle]="◐ ◓ ◑ ◒" [classic]="-\\ |/") local -A recommended_rates=([dots]="0.08" [circle]="0.12" [classic]="0.12") [[ -z "${spinners[$spinner_style]}" ]] && spinner_style="dots" [[ "${refresh_rate}" == "0.1" ]] && refresh_rate="${recommended_rates[$spinner_style]}" local term_width=$(tput cols 2>/dev/null || echo 80) local display_width=$((term_width - 2)) function simple_truncate() { local line="$1" local truncate_marker="..." local max_length=$((display_width - 3)) if [[ "${line}" =~ ^[[:ascii:]]*$ && ${#line} -le $display_width ]]; then echo "${line}" return fi local non_ascii_count=$(echo "${line}" | sed "s|[0-9a-zA-Z -~]||g; s| ||g" | wc -m) local total_length=${#line} local display_length=$((total_length + non_ascii_count)) local quote_count=0 [[ $(echo "${line}" | grep -c "“") -gt 0 ]] && ((quote_count += "$(echo "${line}" | grep -c "“")")) [[ $(echo "${line}" | grep -c "”") -gt 0 ]] && ((quote_count += "$(echo "${line}" | grep -c "”")")) [[ $(echo "${line}" | grep -c "‘") -gt 0 ]] && ((quote_count += "$(echo "${line}" | grep -c "‘")")) [[ $(echo "${line}" | grep -c "’") -gt 0 ]] && ((quote_count += "$(echo "${line}" | grep -c "’")")) display_length=$((display_length - quote_count)) if [[ $display_length -le $display_width ]]; then echo "$line" return fi local result="" local current_width=0 local i=0 while [ $i -lt ${#line} ]; do local char="${line:$i:1}" local char_width=1 if ! [[ "$char" =~ [0-9a-zA-Z\.\=\:\_\(\)\'\"\-\/\!\·] ]]; then if [[ "$char" != "“" && "$char" != "”" && "$char" != "‘" && "$char" != "’" ]]; then char_width=2 fi fi if [[ $((current_width + char_width)) -gt $max_length ]]; then echo "${result}${truncate_marker}" return fi result+="${char}" current_width=$((current_width + char_width)) ((i++)) done echo "${line}" } function cleanup() { [ -f "${temp_file}" ] && rm -f "${temp_file}" tput cnorm 2>/dev/null echo -e "\n\033[1;44m $(msg "interaction.common.tip") \033[0m \033[31m$(msg "interaction.common.operationCanceled")\033[0m\n" exit 130 } function make_temp_file() { local -a temp_dirs=("." "/tmp") local tmp_file="" for dir in "${temp_dirs[@]}"; do [[ ! -d "${dir}" || ! -w "${dir}" ]] && continue tmp_file="${dir}/animate_exec_$$_$(date +%s)" touch "${tmp_file}" 2>/dev/null || continue if [[ -f "${tmp_file}" && -w "${tmp_file}" ]]; then echo "${tmp_file}" return fi done echo "${tmp_file}" } function update_display() { local current_size=$(wc -c <"${temp_file}" 2>/dev/null || echo 0) if [[ $current_size -le $last_size ]]; then return 1 fi local -a lines=() mapfile -t -n "${max_lines}" lines < <(tail -n "$max_lines" "${temp_file}") local -a processed_lines=() for ((i = 0; i < ${#lines[@]}; i++)); do processed_lines[i]=$(simple_truncate "${lines[i]}") done tput cud1 2>/dev/null echo -ne "\r\033[K" tput cud1 2>/dev/null for ((i = 0; i < $max_lines; i++)); do echo -ne "\r\033[K" [[ $i -lt ${#processed_lines[@]} ]] && echo -ne "\033[2m${processed_lines[$i]}\033[0m" [[ $i -lt $((max_lines - 1)) ]] && tput cud1 2>/dev/null done for ((i = 0; i < $max_lines + 1; i++)); do tput cuu1 2>/dev/null done last_size=$current_size return 0 } local spinner_frames=(${spinners[$spinner_style]}) local temp_file="$(make_temp_file)" trap "cleanup" INT TERM tput civis 2>/dev/null echo '' echo '' for ((i = 0; i < $max_lines; i++)); do echo '' done eval "${cmd}" >"${temp_file}" 2>&1 & local cmd_pid=$! local last_size=0 local spin_idx=0 tput cuu $((max_lines + 2)) 2>/dev/null sleep 0.05 echo -ne "\r\033[K◉ ${title} [\033[1m\033[34m${spinner_frames[$spin_idx]}\033[0m]" spin_idx=$(((spin_idx + 1) % ${#spinner_frames[@]})) update_display local update_count=0 local adaptive_rate=$refresh_rate while kill -0 $cmd_pid 2>/dev/null; do echo -ne "\r\033[K◉ ${title} [\033[1m\033[34m${spinner_frames[$spin_idx]}\033[0m]" spin_idx=$(((spin_idx + 1) % ${#spinner_frames[@]})) if update_display; then update_count=$((update_count + 1)) if [[ $update_count -gt 5 ]]; then adaptive_rate=$(awk "BEGIN {print $adaptive_rate * 1.5; exit}") [[ $(awk "BEGIN {print ($adaptive_rate > 0.5); exit}") -eq 1 ]] && adaptive_rate=0.5 update_count=0 fi else update_count=0 adaptive_rate=$refresh_rate fi sleep $adaptive_rate done wait $cmd_pid local exit_status=$? update_display if [ $exit_status -eq 0 ]; then echo -ne "\r\033[K◉ ${title} [\033[1m\033[32m✓\033[0m]\n" else echo -ne "\r\033[K◉ ${title} [\033[1m\033[31m✗\033[0m]\n" fi echo -ne "\r\033[K\n" local actual_lines=$(wc -l <"${temp_file}" 2>/dev/null || echo 0) [[ $actual_lines -gt $max_lines ]] && actual_lines=$max_lines if [[ $actual_lines -gt 0 ]]; then local -a final_lines=() mapfile -t -n "$actual_lines" final_lines < <(tail -n "$actual_lines" "${temp_file}") for ((i = 0; i < actual_lines; i++)); do local line=$(simple_truncate "${final_lines[$i]}") echo -ne "\r\033[K\033[2m${line}\033[0m\n" done fi tput cnorm 2>/dev/null rm -f "${temp_file}" return $exit_status } ############################################################################## ## 生成 CentOS repo 源文件 function gen_repo_files_CentOS() { case "$1" in 8) cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-AppStream.repo [appstream] name=CentOS Linux $releasever - AppStream mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-BaseOS.repo [baseos] name=CentOS Linux $releasever - BaseOS mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-ContinuousRelease.repo [cr] name=CentOS Linux $releasever - ContinuousRelease mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=cr&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/cr/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-Debuginfo.repo [debuginfo] name=CentOS Linux $releasever - Debuginfo baseurl=http://debuginfo.centos.org/$releasever/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-Devel.repo [devel] name=CentOS Linux $releasever - Devel WARNING! FOR BUILDROOT USE ONLY! mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=Devel&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/Devel/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-Extras.repo [extras] name=CentOS Linux $releasever - Extras mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/extras/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-FastTrack.repo [fasttrack] name=CentOS Linux $releasever - FastTrack mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=fasttrack&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/fasttrack/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-HighAvailability.repo [ha] name=CentOS Linux $releasever - HighAvailability mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=HighAvailability&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/HighAvailability/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-Media.repo [media-baseos] name=CentOS Linux $releasever - Media - BaseOS baseurl=file:///media/CentOS/BaseOS file:///media/cdrom/BaseOS file:///media/cdrecorder/BaseOS gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [media-appstream] name=CentOS Linux $releasever - Media - AppStream baseurl=file:///media/CentOS/AppStream file:///media/cdrom/AppStream file:///media/cdrecorder/AppStream gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-Plus.repo [plus] name=CentOS Linux $releasever - Plus mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/centosplus/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-PowerTools.repo [powertools] name=CentOS Linux $releasever - PowerTools mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=PowerTools&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/PowerTools/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Linux-Sources.repo [baseos-source] name=CentOS Linux $releasever - BaseOS - Source baseurl=http://vault.centos.org/$contentdir/$releasever/BaseOS/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [appstream-source] name=CentOS Linux $releasever - AppStream - Source baseurl=http://vault.centos.org/$contentdir/$releasever/AppStream/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [extras-source] name=CentOS Linux $releasever - Extras - Source baseurl=http://vault.centos.org/$contentdir/$releasever/extras/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [plus-source] name=CentOS Linux $releasever - Plus - Source baseurl=http://vault.centos.org/$contentdir/$releasever/centosplus/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF ;; 7) cat <<'EOF' >$Dir_YumRepos/CentOS-Base.repo [base] name=CentOS-$releasever - Base mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 [updates] name=CentOS-$releasever - Updates mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 [extras] name=CentOS-$releasever - Extras mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 [centosplus] name=CentOS-$releasever - Plus mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 EOF cat <<'EOF' >$Dir_YumRepos/CentOS-CR.repo [cr] name=CentOS-$releasever - cr baseurl=http://mirror.centos.org/centos/$releasever/cr/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 enabled=0 EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Debuginfo.repo [base-debuginfo] name=CentOS-7 - Debuginfo baseurl=http://debuginfo.centos.org/7/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-7 enabled=0 EOF cat <<'EOF' >$Dir_YumRepos/CentOS-fasttrack.repo [fasttrack] name=CentOS-7 - fasttrack mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=fasttrack&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/fasttrack/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Media.repo [c7-media] name=CentOS-$releasever - Media baseurl=file:///media/CentOS/ file:///media/cdrom/ file:///media/cdrecorder/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Sources.repo [base-source] name=CentOS-$releasever - Base Sources baseurl=http://vault.centos.org/centos/$releasever/os/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 [updates-source] name=CentOS-$releasever - Updates Sources baseurl=http://vault.centos.org/centos/$releasever/updates/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 [extras-source] name=CentOS-$releasever - Extras Sources baseurl=http://vault.centos.org/centos/$releasever/extras/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 [centosplus-source] name=CentOS-$releasever - Plus Sources baseurl=http://vault.centos.org/centos/$releasever/centosplus/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 EOF ;; esac } ## 生成 CentOS Stream repo 源文件 function gen_repo_files_CentOSStream() { case "$1" in 10) cat <<'EOF' >$Dir_YumRepos/centos.repo [baseos] name=CentOS Stream $releasever - BaseOS #baseurl=https://mirror.stream.centos.org/$releasever-stream/BaseOS/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=1 [baseos-debuginfo] name=CentOS Stream $releasever - BaseOS - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [baseos-source] name=CentOS Stream $releasever - BaseOS - Source metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [appstream] name=CentOS Stream $releasever - AppStream #baseurl=https://mirror.stream.centos.org/$releasever-stream/AppStream/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=1 [appstream-debuginfo] name=CentOS Stream $releasever - AppStream - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [appstream-source] name=CentOS Stream $releasever - AppStream - Source metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [crb] name=CentOS Stream $releasever - CRB #baseurl=https://mirror.stream.centos.org/$releasever-stream/CRB/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-crb-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=0 [crb-debuginfo] name=CentOS Stream $releasever - CRB - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-crb-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [crb-source] name=CentOS Stream $releasever - CRB - Source metalink=https://mirrors.centos.org/metalink?repo=centos-crb-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 EOF cat <<'EOF' >$Dir_YumRepos/centos-addons.repo [highavailability] name=CentOS Stream $releasever - HighAvailability #baseurl=https://mirror.stream.centos.org/$releasever-stream/HighAvailability/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=0 [highavailability-debuginfo] name=CentOS Stream $releasever - HighAvailability - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [highavailability-source] name=CentOS Stream $releasever - HighAvailability - Source metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [nfv] name=CentOS Stream $releasever - NFV #baseurl=https://mirror.stream.centos.org/$releasever-stream/NFV/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=0 [nfv-debuginfo] name=CentOS Stream $releasever - NFV - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [nfv-source] name=CentOS Stream $releasever - NFV - Source metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [rt] name=CentOS Stream $releasever - RT #baseurl=https://mirror.stream.centos.org/$releasever-stream/RT/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-rt-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=0 [rt-debuginfo] name=CentOS Stream $releasever - RT - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-rt-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [rt-source] name=CentOS Stream $releasever - RT - Source metalink=https://mirrors.centos.org/metalink?repo=centos-rt-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [resilientstorage] name=CentOS Stream $releasever - ResilientStorage #baseurl=https://mirror.stream.centos.org/$releasever-stream/ResilientStorage/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=0 [resilientstorage-debuginfo] name=CentOS Stream $releasever - ResilientStorage - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [resilientstorage-source] name=CentOS Stream $releasever - ResilientStorage - Source metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [extras-common] name=CentOS Stream $releasever - Extras packages #baseurl=https://mirror.stream.centos.org/SIGs/$releasever-stream/extras/$basearch/extras-common/ metalink=https://mirrors.centos.org/metalink?repo=centos-extras-sig-extras-common-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=1 [extras-common-source] name=CentOS Stream $releasever - Extras packages - Source metalink=https://mirrors.centos.org/metalink?repo=centos-extras-sig-extras-common-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 EOF ;; 9) cat <<'EOF' >$Dir_YumRepos/centos.repo [baseos] name=CentOS Stream $releasever - BaseOS #baseurl=https://mirror.stream.centos.org/$releasever-stream/BaseOS/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=1 [baseos-debug] name=CentOS Stream $releasever - BaseOS - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [baseos-source] name=CentOS Stream $releasever - BaseOS - Source metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [appstream] name=CentOS Stream $releasever - AppStream #baseurl=https://mirror.stream.centos.org/$releasever-stream/AppStream/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=1 [appstream-debug] name=CentOS Stream $releasever - AppStream - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [appstream-source] name=CentOS Stream $releasever - AppStream - Source metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [crb] name=CentOS Stream $releasever - CRB #baseurl=https://mirror.stream.centos.org/$releasever-stream/CRB/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-crb-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=0 [crb-debug] name=CentOS Stream $releasever - CRB - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-crb-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [crb-source] name=CentOS Stream $releasever - CRB - Source metalink=https://mirrors.centos.org/metalink?repo=centos-crb-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 EOF cat <<'EOF' >$Dir_YumRepos/centos-addons.repo [highavailability] name=CentOS Stream $releasever - HighAvailability #baseurl=https://mirror.stream.centos.org/$releasever-stream/HighAvailability/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=0 [highavailability-debug] name=CentOS Stream $releasever - HighAvailability - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [highavailability-source] name=CentOS Stream $releasever - HighAvailability - Source metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [nfv] name=CentOS Stream $releasever - NFV #baseurl=https://mirror.stream.centos.org/$releasever-stream/NFV/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=0 [nfv-debug] name=CentOS Stream $releasever - NFV - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [nfv-source] name=CentOS Stream $releasever - NFV - Source metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [rt] name=CentOS Stream $releasever - RT #baseurl=https://mirror.stream.centos.org/$releasever-stream/RT/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-rt-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=0 [rt-debug] name=CentOS Stream $releasever - RT - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-rt-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [rt-source] name=CentOS Stream $releasever - RT - Source metalink=https://mirrors.centos.org/metalink?repo=centos-rt-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [resilientstorage] name=CentOS Stream $releasever - ResilientStorage #baseurl=https://mirror.stream.centos.org/$releasever-stream/ResilientStorage/$basearch/os/ metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=0 [resilientstorage-debug] name=CentOS Stream $releasever - ResilientStorage - Debug metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-debug-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [resilientstorage-source] name=CentOS Stream $releasever - ResilientStorage - Source metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 [extras-common] name=CentOS Stream $releasever - Extras packages #baseurl=https://mirror.stream.centos.org/SIGs/$releasever-stream/extras/$basearch/extras-common/ metalink=https://mirrors.centos.org/metalink?repo=centos-extras-sig-extras-common-$stream&arch=$basearch&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h countme=1 enabled=1 [extras-common-source] name=CentOS Stream $releasever - Extras packages - Source metalink=https://mirrors.centos.org/metalink?repo=centos-extras-sig-extras-common-source-$stream&arch=source&protocol=https,http gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512 gpgcheck=1 repo_gpgcheck=0 metadata_expire=6h enabled=0 EOF ;; 8) cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-AppStream.repo [appstream] name=CentOS Stream $releasever - AppStream mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=AppStream&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$stream/AppStream/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-BaseOS.repo [baseos] name=CentOS Stream $releasever - BaseOS mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=BaseOS&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$stream/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-Debuginfo.repo [debuginfo] name=CentOS Stream $releasever - Debuginfo baseurl=http://debuginfo.centos.org/$stream/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-Extras-common.repo [extras-common] name=CentOS Stream $releasever - Extras common packages mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=extras-extras-common #baseurl=http://mirror.centos.org/$contentdir/$stream/extras/$basearch/extras-common/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-Extras.repo [extras] name=CentOS Stream $releasever - Extras mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=extras&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$stream/extras/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-HighAvailability.repo [ha] name=CentOS Stream $releasever - HighAvailability mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=HighAvailability&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$stream/HighAvailability/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-Media.repo [media-baseos] name=CentOS Stream $releasever - Media - BaseOS baseurl=file:///media/CentOS/BaseOS file:///media/cdrom/BaseOS file:///media/cdrecorder/BaseOS gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [media-appstream] name=CentOS Stream $releasever - Media - AppStream baseurl=file:///media/CentOS/AppStream file:///media/cdrom/AppStream file:///media/cdrecorder/AppStream gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-NFV.repo [nfv] name=CentOS Stream $releasever - NFV mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=NFV&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$stream/NFV/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-PowerTools.repo [powertools] name=CentOS Stream $releasever - PowerTools mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=PowerTools&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$stream/PowerTools/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-RealTime.repo [rt] name=CentOS Stream $releasever - RealTime mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=RT&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$stream/RT/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-ResilientStorage.repo [resilientstorage] name=CentOS Stream $releasever - ResilientStorage mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=ResilientStorage&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$stream/ResilientStorage/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF cat <<'EOF' >$Dir_YumRepos/CentOS-Stream-Sources.repo [baseos-source] name=CentOS Stream $releasever - BaseOS - Source baseurl=http://vault.centos.org/$contentdir/$stream/BaseOS/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [appstream-source] name=CentOS Stream $releasever - AppStream - Source baseurl=http://vault.centos.org/$contentdir/$stream/AppStream/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [powertools-source] name=CentOS Stream $releasever - PowerTools - Source baseurl=http://vault.centos.org/$contentdir/$stream/PowerTools/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [extras-source] name=CentOS Stream $releasever - Extras - Source baseurl=http://vault.centos.org/$contentdir/$stream/extras/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [ha-source] name=CentOS Stream $releasever - HighAvailability - Source baseurl=http://vault.centos.org/$contentdir/$stream/HighAvailability/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [rt-source] name=CentOS Stream $releasever - RT - Source baseurl=http://vault.centos.org/$contentdir/$stream/RT/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [resilientstorage-source] name=CentOS Stream $releasever - ResilientStorage - Source baseurl=http://vault.centos.org/$contentdir/$stream/ResilientStorage/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [nfv-source] name=CentOS Stream $releasever - NFV - Source baseurl=http://vault.centos.org/$contentdir/$stream/NFV/Source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial EOF ;; esac } ## 生成 Rocky Linux repo 源文件 function gen_repo_files_RockyLinux() { case "$1" in 10) cat <<'EOF' >$Dir_YumRepos/rocky.repo [baseos] name=Rocky Linux $releasever - BaseOS mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=BaseOS-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [baseos-debuginfo] name=Rocky Linux $releasever - BaseOS - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=BaseOS-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [baseos-source] name=Rocky Linux $releasever - BaseOS - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=BaseOS-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [appstream] name=Rocky Linux $releasever - AppStream mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=AppStream-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [appstream-debuginfo] name=Rocky Linux $releasever - AppStream - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=AppStream-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [appstream-source] name=Rocky Linux $releasever - AppStream - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=AppStream-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [crb] name=Rocky Linux $releasever - CRB mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=CRB-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/CRB/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [crb-debuginfo] name=Rocky Linux $releasever - CRB - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=CRB-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/CRB/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [crb-source] name=Rocky Linux $releasever - CRB - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=CRB-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/CRB/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 EOF cat <<'EOF' >$Dir_YumRepos/rocky-addons.repo [highavailability] name=Rocky Linux $releasever - High Availability mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=HighAvailability-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [highavailability-debuginfo] name=Rocky Linux $releasever - High Availability - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=HighAvailability-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [highavailability-source] name=Rocky Linux $releasever - High Availability - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=HighAvailability-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [nfv] name=Rocky Linux $releasever - NFV mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=NFV-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/NFV/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [nfv-debuginfo] name=Rocky Linux $releasever - NFV Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/NFV/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [nfv-source] name=Rocky Linux $releasever - NFV Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/NFV/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [rt] name=Rocky Linux $releasever - Realtime mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/RT/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [rt-debuginfo] name=Rocky Linux $releasever - Realtime Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/RT/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [rt-source] name=Rocky Linux $releasever - Realtime Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/RT/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [sap] name=Rocky Linux $releasever - SAP mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAP-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAP/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [sap-debuginfo] name=Rocky Linux $releasever - SAP Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAP-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAP/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [sap-source] name=Rocky Linux $releasever - SAP Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAP-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAP/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [saphana] name=Rocky Linux $releasever - SAPHANA mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAPHANA-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAPHANA/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [saphana-debuginfo] name=Rocky Linux $releasever - SAPHANA Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAPHANA-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAPHANA/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [saphana-source] name=Rocky Linux $releasever - SAPHANA Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAPHANA-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAPHANA/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 EOF cat <<'EOF' >$Dir_YumRepos/rocky-devel.repo [devel] name=Rocky Linux $releasever - Devel WARNING! FOR BUILDROOT ONLY DO NOT LEAVE ENABLED mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=devel-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/devel/$basearch/os/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [devel-debuginfo] name=Rocky Linux $releasever - Devel Debug WARNING! FOR BUILDROOT ONLY DO NOT LEAVE ENABLED mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=devel-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/devel/$basearch/debug/tree/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [devel-source] name=Rocky Linux $releasever - Devel Source WARNING! FOR BUILDROOT ONLY DO NOT LEAVE ENABLED mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=devel-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/devel/source/tree/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 EOF cat <<'EOF' >$Dir_YumRepos/rocky-extras.repo [extras] name=Rocky Linux $releasever - Extras mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=extras-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/$basearch/os/ gpgcheck=1 enabled=1 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [extras-debuginfo] name=Rocky Linux $releasever - Extras Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=extras-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [extras-source] name=Rocky Linux $releasever - Extras Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=extras-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [plus] name=Rocky Linux $releasever - Plus mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=plus-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/plus/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [plus-debuginfo] name=Rocky Linux $releasever - Plus - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=plus-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/plus/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 [plus-source] name=Rocky Linux $releasever - Plus - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=plus-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/plus/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-10 EOF ;; 9) cat <<'EOF' >$Dir_YumRepos/rocky.repo [baseos] name=Rocky Linux $releasever - BaseOS mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=BaseOS-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [baseos-debug] name=Rocky Linux $releasever - BaseOS - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=BaseOS-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [baseos-source] name=Rocky Linux $releasever - BaseOS - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=BaseOS-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [appstream] name=Rocky Linux $releasever - AppStream mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=AppStream-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [appstream-debug] name=Rocky Linux $releasever - AppStream - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=AppStream-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [appstream-source] name=Rocky Linux $releasever - AppStream - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=AppStream-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [crb] name=Rocky Linux $releasever - CRB mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=CRB-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/CRB/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [crb-debug] name=Rocky Linux $releasever - CRB - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=CRB-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/CRB/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [crb-source] name=Rocky Linux $releasever - CRB - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=CRB-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/CRB/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 EOF cat <<'EOF' >$Dir_YumRepos/rocky-addons.repo [highavailability] name=Rocky Linux $releasever - High Availability mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=HighAvailability-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [highavailability-debug] name=Rocky Linux $releasever - High Availability - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=HighAvailability-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [highavailability-source] name=Rocky Linux $releasever - High Availability - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=HighAvailability-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [resilientstorage] name=Rocky Linux $releasever - Resilient Storage mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=ResilientStorage-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/ResilientStorage/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [resilientstorage-debug] name=Rocky Linux $releasever - Resilient Storage - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=ResilientStorage-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/ResilientStorage/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [resilientstorage-source] name=Rocky Linux $releasever - Resilient Storage - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=ResilientStorage-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/ResilientStorage/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [nfv] name=Rocky Linux $releasever - NFV mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=NFV-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/NFV/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [nfv-debug] name=Rocky Linux $releasever - NFV Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/NFV/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [nfv-source] name=Rocky Linux $releasever - NFV Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/NFV/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [rt] name=Rocky Linux $releasever - Realtime mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/RT/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [rt-debug] name=Rocky Linux $releasever - Realtime Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/RT/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [rt-source] name=Rocky Linux $releasever - Realtime Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/RT/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [sap] name=Rocky Linux $releasever - SAP mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAP-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAP/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [sap-debug] name=Rocky Linux $releasever - SAP Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAP-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAP/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [sap-source] name=Rocky Linux $releasever - SAP Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAP-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAP/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [saphana] name=Rocky Linux $releasever - SAPHANA mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAPHANA-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAPHANA/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [saphana-debug] name=Rocky Linux $releasever - SAPHANA Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAPHANA-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAPHANA/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [saphana-source] name=Rocky Linux $releasever - SAPHANA Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=SAPHANA-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/SAPHANA/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 EOF cat <<'EOF' >$Dir_YumRepos/rocky-devel.repo [devel] name=Rocky Linux $releasever - Devel WARNING! FOR BUILDROOT ONLY DO NOT LEAVE ENABLED mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=devel-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/devel/$basearch/os/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 EOF cat <<'EOF' >$Dir_YumRepos/rocky-extras.repo [extras] name=Rocky Linux $releasever - Extras mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=extras-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/$basearch/os/ gpgcheck=1 enabled=1 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [extras-debug] name=Rocky Linux $releasever - Extras Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=extras-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [extras-source] name=Rocky Linux $releasever - Extras Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=extras-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [plus] name=Rocky Linux $releasever - Plus mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=plus-$releasever$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/plus/$basearch/os/ gpgcheck=1 enabled=0 countme=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [plus-debug] name=Rocky Linux $releasever - Plus - Debug mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=plus-$releasever-debug$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/plus/$basearch/debug/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 [plus-source] name=Rocky Linux $releasever - Plus - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=plus-$releasever-source$rltype #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/plus/source/tree/ gpgcheck=1 enabled=0 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 EOF ;; 8) cat <<'EOF' >$Dir_YumRepos/Rocky-AppStream.repo [appstream] name=Rocky Linux $releasever - AppStream mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=AppStream-$releasever #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-BaseOS.repo [baseos] name=Rocky Linux $releasever - BaseOS mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=BaseOS-$releasever #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-Debuginfo.repo [baseos-debug] name=Rocky Linux $releasever - BaseOS - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=BaseOS-$releasever-debug #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial [appstream-debug] name=Rocky Linux $releasever - AppStream - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=AppStream-$releasever-debug #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial [ha-debug] name=Rocky Linux $releasever - High Availability - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=HighAvailability-$releasever-debug #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial [powertools-debug] name=Rocky Linux $releasever - PowerTools - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=PowerTools-$releasever-debug #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/PowerTools/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial [resilient-storage-debug] name=Rocky Linux $releasever - Resilient Storage - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=ResilientStorage-$releasever-debug #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/ResilientStorage/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-Devel.repo [devel] name=Rocky Linux $releasever - Devel WARNING! FOR BUILDROOT AND KOJI USE mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=Devel-$releasever #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/Devel/$basearch/os/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-Extras.repo [extras] name=Rocky Linux $releasever - Extras mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=extras-$releasever #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/$basearch/os/ gpgcheck=1 enabled=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-HighAvailability.repo [ha] name=Rocky Linux $releasever - HighAvailability mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=HighAvailability-$releasever #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/$basearch/os/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-Media.repo [media-baseos] name=Rocky Linux $releasever - Media - BaseOS baseurl=file:///media/Rocky/BaseOS file:///media/cdrom/BaseOS file:///media/cdrecorder/BaseOS gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial [media-appstream] name=Rocky Linux $releasever - Media - AppStream baseurl=file:///media/Rocky/AppStream file:///media/cdrom/AppStream file:///media/cdrecorder/AppStream gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-NFV.repo [nfv] name=Rocky Linux $releasever - NFV mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=NFV-$releasever #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/nfv/$basearch/os/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-Plus.repo [plus] name=Rocky Linux $releasever - Plus mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=rockyplus-$releasever #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/plus/$basearch/os/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-PowerTools.repo [powertools] name=Rocky Linux $releasever - PowerTools mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=PowerTools-$releasever #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/PowerTools/$basearch/os/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-ResilientStorage.repo [resilient-storage] name=Rocky Linux $releasever - ResilientStorage mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=ResilientStorage-$releasever #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/ResilientStorage/$basearch/os/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-RT.repo [rt] name=Rocky Linux $releasever - Realtime mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=RT-$releasever #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/RT/$basearch/os/ gpgcheck=1 enabled=0 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF cat <<'EOF' >$Dir_YumRepos/Rocky-Sources.repo [baseos-source] name=Rocky Linux $releasever - BaseOS - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=BaseOS-$releasever-source #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial [appstream-source] name=Rocky Linux $releasever - AppStream - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=AppStream-$releasever-source #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial #[extras-source] #name=Rocky Linux $releasever - Extras - Source #mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=extras-$releasever-source #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/source/tree/ #gpgcheck=1 #enabled=0 #gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial #[plus-source] #name=Rocky Linux $releasever - Plus - Source #mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=plus-$releasever-source #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/Plus/source/tree/ #gpgcheck=1 #enabled=0 #gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial [ha-source] name=Rocky Linux $releasever - High Availability - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=HighAvailability-$releasever-source #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/HighAvailability/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial [powertools-source] name=Rocky Linux $releasever - PowerTools - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=PowerTools-$releasever-source #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/PowerTools/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial [resilient-storage-source] name=Rocky Linux $releasever - Resilient Storage - Source mirrorlist=https://mirrors.rockylinux.org/mirrorlist?arch=source&repo=ResilientStorage-$releasever-source #baseurl=http://dl.rockylinux.org/$contentdir/$releasever/ResilientStorage/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial EOF ;; esac } ## 生成 AlmaLinux repo 源文件 function gen_repo_files_AlmaLinux() { case "$1" in 10) cat <<'EOF' >$Dir_YumRepos/almalinux-appstream.repo [appstream] name=AlmaLinux $releasever - AppStream mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream # baseurl=https://repo.almalinux.org/almalinux/$releasever/AppStream/$basearch/os/ enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=1 [appstream-debuginfo] name=AlmaLinux $releasever - AppStream - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream-debug # baseurl=https://vault.almalinux.org/$releasever/AppStream/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [appstream-source] name=AlmaLinux $releasever - AppStream - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream-source # baseurl=https://vault.almalinux.org/$releasever/AppStream/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-baseos.repo [baseos] name=AlmaLinux $releasever - BaseOS mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos # baseurl=https://repo.almalinux.org/almalinux/$releasever/BaseOS/$basearch/os/ enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=1 [baseos-debuginfo] name=AlmaLinux $releasever - BaseOS - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos-debug # baseurl=https://vault.almalinux.org/$releasever/BaseOS/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [baseos-source] name=AlmaLinux $releasever - BaseOS - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos-source # baseurl=https://vault.almalinux.org/$releasever/BaseOS/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-crb.repo [crb] name=AlmaLinux $releasever - CRB mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/crb # baseurl=https://repo.almalinux.org/almalinux/$releasever/CRB/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [crb-debuginfo] name=AlmaLinux $releasever - CRB - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/crb-debug # baseurl=https://vault.almalinux.org/$releasever/CRB/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [crb-source] name=AlmaLinux $releasever - CRB - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/crb-source # baseurl=https://vault.almalinux.org/$releasever/CRB/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-extras.repo [extras] name=AlmaLinux $releasever - Extras mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/extras # baseurl=https://repo.almalinux.org/almalinux/$releasever/extras/$basearch/os/ enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [extras-debuginfo] name=AlmaLinux $releasever - Extras - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/extras-debug # baseurl=https://vault.almalinux.org/$releasever/extras/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [extras-source] name=AlmaLinux $releasever - Extras - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/extras-source # baseurl=https://vault.almalinux.org/$releasever/extras/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-highavailability.repo [highavailability] name=AlmaLinux $releasever - HighAvailability mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/highavailability # baseurl=https://repo.almalinux.org/almalinux/$releasever/HighAvailability/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [highavailability-debuginfo] name=AlmaLinux $releasever - HighAvailability - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/highavailability-debug # baseurl=https://vault.almalinux.org/$releasever/HighAvailability/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [highavailability-source] name=AlmaLinux $releasever - HighAvailability - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/highavailability-source # baseurl=https://vault.almalinux.org/$releasever/HighAvailability/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-nfv.repo [nfv] name=AlmaLinux $releasever - NFV mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/nfv # baseurl=https://repo.almalinux.org/almalinux/$releasever/NFV/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [nfv-debuginfo] name=AlmaLinux $releasever - NFV - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/nfv-debug # baseurl=https://vault.almalinux.org/$releasever/NFV/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [nfv-source] name=AlmaLinux $releasever - NFV - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/nfv-source # baseurl=https://vault.almalinux.org/$releasever/NFV/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-rt.repo [rt] name=AlmaLinux $releasever - RT mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/rt # baseurl=https://repo.almalinux.org/almalinux/$releasever/RT/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [rt-debuginfo] name=AlmaLinux $releasever - RT - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/rt-debug # baseurl=https://vault.almalinux.org/$releasever/RT/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [rt-source] name=AlmaLinux $releasever - RT - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/rt-source # baseurl=https://vault.almalinux.org/$releasever/RT/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-saphana.repo [saphana] name=AlmaLinux $releasever - SAPHANA mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/saphana # baseurl=https://repo.almalinux.org/almalinux/$releasever/SAPHANA/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [saphana-debuginfo] name=AlmaLinux $releasever - SAPHANA - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/saphana-debug # baseurl=https://vault.almalinux.org/$releasever/SAPHANA/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [saphana-source] name=AlmaLinux $releasever - SAPHANA - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/saphana-source # baseurl=https://vault.almalinux.org/$releasever/SAPHANA/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-sap.repo [sap] name=AlmaLinux $releasever - SAP mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/sap # baseurl=https://repo.almalinux.org/almalinux/$releasever/SAP/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [sap-debuginfo] name=AlmaLinux $releasever - SAP - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/sap-debug # baseurl=https://vault.almalinux.org/$releasever/SAP/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 [sap-source] name=AlmaLinux $releasever - SAP - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/sap-source # baseurl=https://vault.almalinux.org/$releasever/SAP/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-10 metadata_expire=86400 enabled_metadata=0 EOF ;; 9) cat <<'EOF' >$Dir_YumRepos/almalinux-appstream.repo [appstream] name=AlmaLinux $releasever - AppStream mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream # baseurl=https://repo.almalinux.org/almalinux/$releasever/AppStream/$basearch/os/ enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=1 [appstream-debug] name=AlmaLinux $releasever - AppStream - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream-debug # baseurl=https://repo.almalinux.org/vault/$releasever/AppStream/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [appstream-source] name=AlmaLinux $releasever - AppStream - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream-source # baseurl=https://repo.almalinux.org/vault/$releasever/AppStream/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-baseos.repo [baseos] name=AlmaLinux $releasever - BaseOS mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos # baseurl=https://repo.almalinux.org/almalinux/$releasever/BaseOS/$basearch/os/ enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=1 [baseos-debug] name=AlmaLinux $releasever - BaseOS - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos-debug # baseurl=https://repo.almalinux.org/vault/$releasever/BaseOS/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [baseos-source] name=AlmaLinux $releasever - BaseOS - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos-source # baseurl=https://repo.almalinux.org/vault/$releasever/BaseOS/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-crb.repo [crb] name=AlmaLinux $releasever - CRB mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/crb # baseurl=https://repo.almalinux.org/almalinux/$releasever/CRB/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [crb-debug] name=AlmaLinux $releasever - CRB - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/crb-debug # baseurl=https://repo.almalinux.org/vault/$releasever/CRB/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [crb-source] name=AlmaLinux $releasever - CRB - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/crb-source # baseurl=https://repo.almalinux.org/vault/$releasever/CRB/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-extras.repo [extras] name=AlmaLinux $releasever - Extras mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/extras # baseurl=https://repo.almalinux.org/almalinux/$releasever/extras/$basearch/os/ enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [extras-debug] name=AlmaLinux $releasever - Extras - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/extras-debug # baseurl=https://repo.almalinux.org/vault/$releasever/extras/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [extras-source] name=AlmaLinux $releasever - Extras - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/extras-source # baseurl=https://repo.almalinux.org/vault/$releasever/extras/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-highavailability.repo [highavailability] name=AlmaLinux $releasever - HighAvailability mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/highavailability # baseurl=https://repo.almalinux.org/almalinux/$releasever/HighAvailability/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [highavailability-debug] name=AlmaLinux $releasever - HighAvailability - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/highavailability-debug # baseurl=https://repo.almalinux.org/vault/$releasever/HighAvailability/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [highavailability-source] name=AlmaLinux $releasever - HighAvailability - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/highavailability-source # baseurl=https://repo.almalinux.org/vault/$releasever/HighAvailability/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-nfv.repo [nfv] name=AlmaLinux $releasever - NFV mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/nfv # baseurl=https://repo.almalinux.org/almalinux/$releasever/NFV/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [nfv-debug] name=AlmaLinux $releasever - NFV - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/nfv-debug # baseurl=https://repo.almalinux.org/vault/$releasever/NFV/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [nfv-source] name=AlmaLinux $releasever - NFV - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/nfv-source # baseurl=https://repo.almalinux.org/vault/$releasever/NFV/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-plus.repo [plus] name=AlmaLinux $releasever - Plus mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/plus # baseurl=https://repo.almalinux.org/almalinux/$releasever/plus/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [plus-debug] name=AlmaLinux $releasever - Plus - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/plus-debug # baseurl=https://repo.almalinux.org/vault/$releasever/plus/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [plus-source] name=AlmaLinux $releasever - Plus - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/plus-source # baseurl=https://repo.almalinux.org/vault/$releasever/plus/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-resilientstorage.repo [resilientstorage] name=AlmaLinux $releasever - ResilientStorage mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/resilientstorage # baseurl=https://repo.almalinux.org/almalinux/$releasever/ResilientStorage/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [resilientstorage-debug] name=AlmaLinux $releasever - ResilientStorage - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/resilientstorage-debug # baseurl=https://repo.almalinux.org/vault/$releasever/ResilientStorage/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [resilientstorage-source] name=AlmaLinux $releasever - ResilientStorage - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/resilientstorage-source # baseurl=https://repo.almalinux.org/vault/$releasever/ResilientStorage/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-rt.repo [rt] name=AlmaLinux $releasever - RT mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/rt # baseurl=https://repo.almalinux.org/almalinux/$releasever/RT/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [rt-debug] name=AlmaLinux $releasever - RT - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/rt-debug # baseurl=https://repo.almalinux.org/vault/$releasever/RT/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [rt-source] name=AlmaLinux $releasever - RT - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/rt-source # baseurl=https://repo.almalinux.org/vault/$releasever/RT/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-sap.repo [sap] name=AlmaLinux $releasever - SAP mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/sap # baseurl=https://repo.almalinux.org/almalinux/$releasever/SAP/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [sap-debug] name=AlmaLinux $releasever - SAP - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/sap-debug # baseurl=https://repo.almalinux.org/vault/$releasever/SAP/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [sap-source] name=AlmaLinux $releasever - SAP - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/sap-source # baseurl=https://repo.almalinux.org/vault/$releasever/SAP/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF cat <<'EOF' >$Dir_YumRepos/almalinux-saphana.repo [saphana] name=AlmaLinux $releasever - SAPHANA mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/saphana # baseurl=https://repo.almalinux.org/almalinux/$releasever/SAPHANA/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [saphana-debug] name=AlmaLinux $releasever - SAPHANA - Debug mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/saphana-debug # baseurl=https://repo.almalinux.org/vault/$releasever/SAPHANA/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 [saphana-source] name=AlmaLinux $releasever - SAPHANA - Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/saphana-source # baseurl=https://repo.almalinux.org/vault/$releasever/SAPHANA/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux-9 metadata_expire=86400 enabled_metadata=0 EOF ;; 8) cat <<'EOF' >$Dir_YumRepos/almalinux-ha.repo [ha] name=AlmaLinux $releasever - HighAvailability mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/ha # baseurl=https://repo.almalinux.org/almalinux/$releasever/HighAvailability/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [ha-source] name=AlmaLinux $releasever - HighAvailability Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/ha-source # baseurl=https://repo.almalinux.org/vault/$releasever/HighAvailability/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [ha-debuginfo] name=AlmaLinux $releasever - HighAvailability debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/ha-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/HighAvailability/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux EOF cat <<'EOF' >$Dir_YumRepos/almalinux-nfv.repo [nfv] name=AlmaLinux $releasever - Real Time for NFV mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/nfv # baseurl=https://repo.almalinux.org/almalinux/$releasever/NFV/$basearch/os/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [nfv-source] name=AlmaLinux $releasever - Real Time for NFV Sources mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/nfv-source # baseurl=https://repo.almalinux.org/vault/$releasever/NFV/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [nfv-debuginfo] name=AlmaLinux $releasever - Real Time for NFV Debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/nfv-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/NFV/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux EOF cat <<'EOF' >$Dir_YumRepos/almalinux-plus.repo [plus] name=AlmaLinux $releasever - Plus mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/plus # baseurl=https://repo.almalinux.org/almalinux/$releasever/plus/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [plus-source] name=AlmaLinux $releasever - Plus Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/plus-source # baseurl=https://repo.almalinux.org/vault/$releasever/plus/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [plus-debuginfo] name=AlmaLinux $releasever - Plus debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/plus-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/plus/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux EOF cat <<'EOF' >$Dir_YumRepos/almalinux-powertools.repo [powertools] name=AlmaLinux $releasever - PowerTools mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/powertools # baseurl=https://repo.almalinux.org/almalinux/$releasever/PowerTools/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [powertools-source] name=AlmaLinux $releasever - PowerTools Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/powertools-source # baseurl=https://repo.almalinux.org/vault/$releasever/PowerTools/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [powertools-debuginfo] name=AlmaLinux $releasever - PowerTools debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/powertools-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/PowerTools/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux EOF cat <<'EOF' >$Dir_YumRepos/almalinux-resilientstorage.repo [resilientstorage] name=AlmaLinux $releasever - ResilientStorage mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/resilientstorage # baseurl=https://repo.almalinux.org/almalinux/$releasever/ResilientStorage/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [resilientstorage-source] name=AlmaLinux $releasever - ResilientStorage Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/resilientstorage-source # baseurl=https://repo.almalinux.org/vault/$releasever/ResilientStorage/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [resilientstorage-debuginfo] name=AlmaLinux $releasever - ResilientStorage debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/resilientstorage-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/ResilientStorage/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux EOF cat <<'EOF' >$Dir_YumRepos/almalinux-rt.repo [rt] name=AlmaLinux $releasever - Real Time mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/rt # baseurl=https://repo.almalinux.org/almalinux/$releasever/RT/$basearch/os/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [rt-source] name=AlmaLinux $releasever - Real Time Sources mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/rt-source # baseurl=https://repo.almalinux.org/vault/$releasever/RT/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [rt-debuginfo] name=AlmaLinux $releasever - Real Time Debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/rt-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/RT/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux EOF cat <<'EOF' >$Dir_YumRepos/almalinux-sap.repo [sap] name=AlmaLinux $releasever - SAP mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/sap # baseurl=https://repo.almalinux.org/almalinux/$releasever/SAP/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [sap-source] name=AlmaLinux $releasever - SAP Sources mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/sap-source # baseurl=https://repo.almalinux.org/vault/$releasever/SAP/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [sap-debuginfo] name=AlmaLinux $releasever - SAP Debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/sap-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/SAP/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux EOF cat <<'EOF' >$Dir_YumRepos/almalinux-saphana.repo [saphana] name=AlmaLinux $releasever - SAP HANA mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/saphana # baseurl=https://repo.almalinux.org/almalinux/$releasever/SAPHANA/$basearch/os/ enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [saphana-source] name=AlmaLinux $releasever - SAP HANA Sources mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/saphana-source # baseurl=https://repo.almalinux.org/vault/$releasever/SAPHANA/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [saphana-debuginfo] name=AlmaLinux $releasever - SAP HANA Debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/saphana-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/SAPHANA/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux EOF cat <<'EOF' >$Dir_YumRepos/almalinux.repo [baseos] name=AlmaLinux $releasever - BaseOS mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos # baseurl=https://repo.almalinux.org/almalinux/$releasever/BaseOS/$basearch/os/ enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [appstream] name=AlmaLinux $releasever - AppStream mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream # baseurl=https://repo.almalinux.org/almalinux/$releasever/AppStream/$basearch/os/ enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [extras] name=AlmaLinux $releasever - Extras mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/extras # baseurl=https://repo.almalinux.org/almalinux/$releasever/extras/$basearch/os/ enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [baseos-source] name=AlmaLinux $releasever - BaseOS Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos-source # baseurl=https://repo.almalinux.org/vault/$releasever/BaseOS/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [appstream-source] name=AlmaLinux $releasever - AppStream Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream-source # baseurl=https://repo.almalinux.org/vault/$releasever/AppStream/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [extras-source] name=AlmaLinux $releasever - Extras Source mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/extras-source # baseurl=https://repo.almalinux.org/vault/$releasever/extras/Source/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [baseos-debuginfo] name=AlmaLinux $releasever - BaseOS debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/BaseOS/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [appstream-debuginfo] name=AlmaLinux $releasever - AppStream debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/AppStream/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux [extras-debuginfo] name=AlmaLinux $releasever - Extras debuginfo mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/extras-debuginfo # baseurl=https://repo.almalinux.org/vault/$releasever/extras/debug/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux EOF ;; esac } ## 生成 Fedora repo 源文件 function gen_repo_files_Fedora() { cat <<'EOF' >$Dir_YumRepos/fedora.repo [fedora] name=Fedora $releasever - $basearch #baseurl=http://download.example/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/ metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch enabled=1 countme=1 metadata_expire=7d repo_gpgcheck=0 type=rpm gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [fedora-debuginfo] name=Fedora $releasever - $basearch - Debug #baseurl=http://download.example/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-$releasever&arch=$basearch enabled=0 metadata_expire=7d repo_gpgcheck=0 type=rpm gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [fedora-source] name=Fedora $releasever - Source #baseurl=http://download.example/pub/fedora/linux/releases/$releasever/Everything/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-source-$releasever&arch=$basearch enabled=0 metadata_expire=7d repo_gpgcheck=0 type=rpm gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False EOF cat <<'EOF' >$Dir_YumRepos/fedora-updates.repo [updates] name=Fedora $releasever - $basearch - Updates #baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Everything/$basearch/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch enabled=1 countme=1 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [updates-debuginfo] name=Fedora $releasever - $basearch - Updates - Debug #baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Everything/$basearch/debug/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-debug-f$releasever&arch=$basearch enabled=0 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [updates-source] name=Fedora $releasever - Updates Source #baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Everything/SRPMS/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-source-f$releasever&arch=$basearch enabled=0 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False EOF cat <<'EOF' >$Dir_YumRepos/fedora-updates-testing.repo [updates-testing] name=Fedora $releasever - $basearch - Test Updates #baseurl=http://download.example/pub/fedora/linux/updates/testing/$releasever/Everything/$basearch/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-f$releasever&arch=$basearch enabled=0 countme=1 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [updates-testing-debuginfo] name=Fedora $releasever - $basearch - Test Updates Debug #baseurl=http://download.example/pub/fedora/linux/updates/testing/$releasever/Everything/$basearch/debug/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-debug-f$releasever&arch=$basearch enabled=0 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [updates-testing-source] name=Fedora $releasever - Test Updates Source #baseurl=http://download.example/pub/fedora/linux/updates/testing/$releasever/Everything/SRPMS/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-source-f$releasever&arch=$basearch enabled=0 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False EOF ## 自 Fedora 39 起不再使用 modular 仓库 if [[ $1 -lt 39 ]]; then cat <<'EOF' >$Dir_YumRepos/fedora-modular.repo [fedora-modular] name=Fedora Modular $releasever - $basearch #baseurl=http://download.example/pub/fedora/linux/releases/$releasever/Modular/$basearch/os/ metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-modular-$releasever&arch=$basearch enabled=1 countme=1 #metadata_expire=7d repo_gpgcheck=0 type=rpm gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [fedora-modular-debuginfo] name=Fedora Modular $releasever - $basearch - Debug #baseurl=http://download.example/pub/fedora/linux/releases/$releasever/Modular/$basearch/debug/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-modular-debug-$releasever&arch=$basearch enabled=0 metadata_expire=7d repo_gpgcheck=0 type=rpm gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [fedora-modular-source] name=Fedora Modular $releasever - Source #baseurl=http://download.example/pub/fedora/linux/releases/$releasever/Modular/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-modular-source-$releasever&arch=$basearch enabled=0 metadata_expire=7d repo_gpgcheck=0 type=rpm gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False EOF cat <<'EOF' >$Dir_YumRepos/fedora-updates-modular.repo [updates-modular] name=Fedora Modular $releasever - $basearch - Updates #baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Modular/$basearch/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-modular-f$releasever&arch=$basearch enabled=1 countme=1 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [updates-modular-debuginfo] name=Fedora Modular $releasever - $basearch - Updates - Debug #baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Modular/$basearch/debug/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-modular-debug-f$releasever&arch=$basearch enabled=0 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [updates-modular-source] name=Fedora Modular $releasever - Updates Source #baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Modular/SRPMS/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-modular-source-f$releasever&arch=$basearch enabled=0 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False EOF cat <<'EOF' >$Dir_YumRepos/fedora-updates-testing-modular.repo [updates-testing-modular] name=Fedora Modular $releasever - $basearch - Test Updates #baseurl=http://download.example/pub/fedora/linux/updates/testing/$releasever/Modular/$basearch/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-modular-f$releasever&arch=$basearch enabled=0 countme=1 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [updates-testing-modular-debuginfo] name=Fedora Modular $releasever - $basearch - Test Updates Debug #baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Modular/$basearch/debug/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-modular-debug-f$releasever&arch=$basearch enabled=0 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [updates-testing-modular-source] name=Fedora Modular $releasever - Test Updates Source #baseurl=http://download.example/pub/fedora/linux/updates/$releasever/Modular/SRPMS/ metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-testing-modular-source-f$releasever&arch=$basearch enabled=0 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False EOF fi } ## 生成 openEuler repo 源文件 function gen_repo_files_openEuler() { cat <<'EOF' >$Dir_YumRepos/openEuler.repo [OS] name=OS baseurl=http://repo.openeuler.org/openEuler-version/OS/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-version/OS/$basearch/RPM-GPG-KEY-openEuler [everything] name=everything baseurl=http://repo.openeuler.org/openEuler-version/everything/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-version/everything/$basearch/RPM-GPG-KEY-openEuler [EPOL] name=EPOL baseurl=http://repo.openeuler.org/openEuler-version/EPOL/main/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-version/OS/$basearch/RPM-GPG-KEY-openEuler [debuginfo] name=debuginfo baseurl=http://repo.openeuler.org/openEuler-version/debuginfo/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-version/debuginfo/$basearch/RPM-GPG-KEY-openEuler [source] name=source baseurl=http://repo.openeuler.org/openEuler-version/source/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-version/source/RPM-GPG-KEY-openEuler [update] name=update baseurl=http://repo.openeuler.org/openEuler-version/update/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-version/OS/$basearch/RPM-GPG-KEY-openEuler [update-source] name=update-source baseurl=http://repo.openeuler.org/openEuler-version/update/source/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-version/source/RPM-GPG-KEY-openEuler EOF ## 替换版本号 local version_name="$(get_os_release_value VERSION | sed 's/["()]//g; s/[_ ]\+/-/g; s/^-\+\|-\+$//g')" sed -e "s|openEuler-version|openEuler-${version_name}|g" \ -i \ $Dir_YumRepos/openEuler.repo } ## 生成 OpenCloudOS repo 源文件 function gen_repo_files_OpenCloudOS() { case "${1%%.*}" in 23) cat <<'EOF' >$Dir_YumRepos/OpenCloudOS-Stream.repo [BaseOS] name=BaseOS $releasever - $basearch baseurl=https://mirrors.opencloudos.tech/opencloudos-stream/releases/$releasever/BaseOS/$basearch/Packages/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-Stream [AppStream] name=AppStream $releasever - $basearch baseurl=https://mirrors.opencloudos.tech/opencloudos-stream/releases/$releasever/AppStream/$basearch/Packages/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-Stream [BaseOS-debug] name=BaseOS-debug $releasever - $basearch baseurl=https://mirrors.opencloudos.tech/opencloudos-stream/releases/$releasever/BaseOS/$basearch/debug/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-Stream [AppStream-debug] name=AppStream-debug $releasever - $basearch baseurl=https://mirrors.opencloudos.tech/opencloudos-stream/releases/$releasever/AppStream/$basearch/debug/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-Stream [BaseOS-source] name=BaseOS-source $releasever baseurl=https://mirrors.opencloudos.tech/opencloudos-stream/releases/$releasever/BaseOS/source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-Stream [AppStream-source] name=AppStream-source $releasever baseurl=https://mirrors.opencloudos.tech/opencloudos-stream/releases/$releasever/AppStream/source/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-Stream EOF ;; 9) cat <<'EOF' >$Dir_YumRepos/OpenCloudOS.repo [BaseOS] name=BaseOS $releasever - $basearch baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-9 [AppStream] name=AppStream $releasever - $basearch baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-9 [extras] name=extras $releasever - $basearch baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/extras/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-9 [BaseOS-debuginfo] name=BaseOS-debuginfo $releasever - $basearch baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/BaseOS/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-9 [AppStream-debuginfo] name=AppStream-debuginfo $releasever - $basearch baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/AppStream/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-9 [extras-debuginfo] name=extras-debuginfo $releasever - $basearch baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/extras/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-9 [BaseOS-source] name=BaseOS-source $releasever baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/BaseOS/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-9 [AppStream-source] name=AppStream-source $releasever baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/AppStream/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-9 [extras-source] name=extras-source $releasever baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/extras/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS-9 EOF ;; 8) cat <<'EOF' >$Dir_YumRepos/OpenCloudOS-Debuginfo.repo [BaseOS-debuginfo] name=OpenCloudOS $releasever - BaseOS-debuginfo baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/BaseOS/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [AppStream-debuginfo] name=OpenCloudOS $releasever - AppStream-debuginfo baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/AppStream/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [Extras-debuginfo] name=OpenCloudOS $releasever - Extras-debuginfo baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/Extras/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [HighAvailability-debuginfo] name=OpenCloudOS $releasever - HighAvailability-debuginfo baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/HighAvailability/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [PowerTools-debuginfo] name=OpenCloudOS $releasever - PowerTools-debuginfo baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/PowerTools/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [ResilientStorage-debuginfo] name=OpenCloudOS $releasever - ResilientStorage-debuginfo baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/ResilientStorage/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [Plus-debuginfo] name=OpenCloudOS $releasever - Plus-debuginfo baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/Plus/$basearch/debug/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS EOF if [[ "${1}" == "8.6" ]]; then cat <<'EOF' >$Dir_YumRepos/OpenCloudOS.repo [BaseOS] name=OpenCloudOS $releasever - BaseOS baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [AppStream] name=OpenCloudOS $releasever - AppStream baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [Extras] name=OpenCloudOS $releasever - Extras baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/Extras/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [HighAvailability] name=OpenCloudOS $releasever - HighAvailability baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/HighAvailability/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [PowerTools] name=OpenCloudOS $releasever - PowerTools baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/PowerTools/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [ResilientStorage] name=OpenCloudOS $releasever - ResilientStorage baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/ResilientStorage/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [Plus] name=OpenCloudOS $releasever - Plus baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/Plus/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS EOF else cat <<'EOF' >$Dir_YumRepos/OpenCloudOS.repo [BaseOS] name=OpenCloudOS $releasever - BaseOS baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [AppStream] name=OpenCloudOS $releasever - AppStream baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [Extras] name=OpenCloudOS $releasever - Extras baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/Extras/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [HighAvailability] name=OpenCloudOS $releasever - HighAvailability baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/HighAvailability/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [NFV] name=OpenCloudOS $releasever - NFV baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/NFV/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [PowerTools] name=OpenCloudOS $releasever - PowerTools baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/PowerTools/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [ResilientStorage] name=OpenCloudOS $releasever - ResilientStorage baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/ResilientStorage/$basearch/os/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [Plus] name=OpenCloudOS $releasever - Plus baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/Plus/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS EOF fi cat <<'EOF' >$Dir_YumRepos/OpenCloudOS-Sources.repo [BaseOS-source] name=OpenCloudOS $releasever - Base-source baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/BaseOS/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [AppStream-source] name=OpenCloudOS $releasever - AppStream-source baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/AppStream/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [Extras-source] name=OpenCloudOS $releasever - Extras-source baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/Extras/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [HighAvailability-source] name=OpenCloudOS $releasever - HighAvailability-source baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/HighAvailability/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [PowerTools-source] name=OpenCloudOS $releasever - PowerTools-source baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/PowerTools/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [ResilientStorage-source] name=OpenCloudOS $releasever - ResilientStorage-source baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/ResilientStorage/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS [Plus-source] name=OpenCloudOS $releasever - Plus-source baseurl=https://mirrors.opencloudos.tech/opencloudos/$releasever/Plus/source/tree/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OpenCloudOS EOF ;; esac } ## 生成 Anolis OS repo 源文件 function gen_repo_files_AnolisOS() { case "${1%%.*}" in 23) cat <<'EOF' >$Dir_YumRepos/AnolisOS.repo [os] name=AnolisOS-$releasever - os baseurl=http://mirrors.openanolis.cn/anolis/$releasever/os/$basearch/os enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 [updates] name=AnolisOS-$releasever - updates baseurl=http://mirrors.openanolis.cn/anolis/$releasever/updates/$basearch/os enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 [kernel-6] name=AnolisOS-$releasever - kernel-6 baseurl=http://mirrors.openanolis.cn/anolis/$releasever/kernel-6/$basearch/os enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-Source.repo [os-source] name=AnolisOS-$releasever - os Source baseurl=https://mirrors.openanolis.cn/anolis/$releasever/os/source/ enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [updates-source] name=AnolisOS-$releasever - updates Source baseurl=https://mirrors.openanolis.cn/anolis/$releasever/updates/source/ enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [kernel-source] name=AnolisOS-$releasever - kernel-6 Source baseurl=https://mirrors.openanolis.cn/anolis/$releasever/kernel-6/source/ enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-Debuginfo.repo [os-debuginfo] name=AnolisOS-$releasever - os Debuginfo baseurl=https://mirrors.openanolis.cn/anolis/$releasever/os/$basearch/debug enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [updates-debuginfo] name=AnolisOS-$releasever - updates Debuginfo baseurl=https://mirrors.openanolis.cn/anolis/$releasever/updates/$basearch/debug enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [kernel-6-debuginfo] name=AnolisOS-$releasever - kernel-6 Debuginfo baseurl=https://mirrors.openanolis.cn/anolis/$releasever/kernel-6/$basearch/debug enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF ;; 8) cat <<'EOF' >$Dir_YumRepos/AnolisOS-AppStream.repo [AppStream] name=AnolisOS-$releasever - AppStream baseurl=http://mirrors.openanolis.cn/anolis/$releasever/AppStream/$basearch/os enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-BaseOS.repo [BaseOS] name=AnolisOS-$releasever - BaseOS baseurl=http://mirrors.openanolis.cn/anolis/$releasever/BaseOS/$basearch/os enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-DDE.repo [DDE] name=AnolisOS-$releasever - DDE baseurl=http://mirrors.openanolis.cn/anolis/$releasever/DDE/$basearch/os enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-Debuginfo.repo [AppStream-debuginfo] name=AnolisOS-$releasever - AppStream Debuginfo baseurl=https://mirrors.openanolis.cn/anolis/$releasever/AppStream/$basearch/debug enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [BaseOS-debuginfo] name=AnolisOS-$releasever - BaseOS Debuginfo baseurl=https://mirrors.openanolis.cn/anolis/$releasever/BaseOS/$basearch/debug enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [Plus-debuginfo] name=AnolisOS-$releasever - Plus Debuginfo baseurl=https://mirrors.openanolis.cn/anolis/$releasever/Plus/$basearch/debug enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [PowerTools-debuginfo] name=AnolisOS-$releasever - PowerTools Debuginfo baseurl=https://mirrors.openanolis.cn/anolis/$releasever/PowerTools/$basearch/debug enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [DDE-debuginfo] name=AnolisOS-$releasever - DDE Debuginfo baseurl=https://mirrors.openanolis.cn/anolis/$releasever/DDE/$basearch/debug enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-Extras.repo [Extras] name=AnolisOS-$releasever - Extras baseurl=http://mirrors.openanolis.cn/anolis/$releasever/Extras/$basearch/os enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-HighAvailability.repo [HighAvailability] name=AnolisOS-$releasever - HighAvailability baseurl=http://mirrors.openanolis.cn/anolis/$releasever/HighAvailability/$basearch/os enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-Plus.repo [Plus] name=AnolisOS-$releasever - Plus baseurl=http://mirrors.openanolis.cn/anolis/$releasever/Plus/$basearch/os enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-PowerTools.repo [PowerTools] name=AnolisOS-$releasever - PowerTools baseurl=http://mirrors.openanolis.cn/anolis/$releasever/PowerTools/$basearch/os enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-Source.repo [AppStream-source] name=AnolisOS-$releasever - AppStream Source baseurl=https://mirrors.openanolis.cn/anolis/$releasever/AppStream/source/ enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [BaseOS-source] name=AnolisOS-$releasever - BaseOS Source baseurl=https://mirrors.openanolis.cn/anolis/$releasever/BaseOS/source/ enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [Plus-source] name=AnolisOS-$releasever - Plus Source baseurl=https://mirrors.openanolis.cn/anolis/$releasever/Plus/source/ enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [PowerTools-source] name=AnolisOS-$releasever - PowerTools Source baseurl=https://mirrors.openanolis.cn/anolis/$releasever/PowerTools/source/ enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [DDE-source] name=AnolisOS-$releasever - DDE Source baseurl=https://mirrors.openanolis.cn/anolis/$releasever/DDE/source/ enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF ## 8.8 新增 if [[ "${1#*.}" -ge 8 ]]; then cat <<'EOF' >$Dir_YumRepos/AnolisOS-kernel-5.10.repo [kernel-5.10] name=AnolisOS-$releasever - Kernel 5.10 baseurl=http://mirrors.openanolis.cn/anolis/$releasever/kernel-5.10/$basearch/os enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 [kernel-5.10-source] name=AnolisOS-$releasever - Kernel 5.10 source baseurl=http://mirrors.openanolis.cn/anolis/$releasever/kernel-5.10/source enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 [kernel-5.10-debug] name=AnolisOS-$releasever - Kernel 5.10 debug baseurl=http://mirrors.openanolis.cn/anolis/$releasever/kernel-5.10/$basearch/debug enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF fi ## 8.10 新增 if [[ "${1#*.}" -eq 10 ]]; then cat <<'EOF' >$Dir_YumRepos/AnolisOS-Devel.repo [Devel] name=AnolisOS-$releasever - Devel baseurl=http://mirrors.openanolis.cn/anolis/$releasever/Devel/$basearch/os enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/AnolisOS-NDE.repo [NDE] name=AnolisOS-$releasever - NDE baseurl=http://mirrors.openanolis.cn/anolis/$releasever/NDE/$basearch/os enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ANOLIS gpgcheck=1 [NDE-debuginfo] name=AnolisOS-$releasever - NDE Debuginfo baseurl=https://mirrors.openanolis.cn/anolis/$releasever/NDE/$basearch/debug enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 [NDE-source] name=AnolisOS-$releasever - NDE Source baseurl=https://mirrors.openanolis.cn/anolis/$releasever/NDE/source/ enabled=0 gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS gpgcheck=1 EOF fi ;; esac } ## 生成 openSUSE repo 源文件 function gen_repo_files_openSUSE() { case "$1" in "leap") case "${2%%.*}" in 16) cat <<'EOF' >$Dir_ZYppRepos/openSUSE:repo-non-oss-debug.repo [openSUSE:repo-non-oss-debug] name=repo-non-oss-debug (${releasever}) enabled=0 autorefresh=1 baseurl=http://cdn.opensuse.org/debug/distribution/leap/${releasever}/repo/non-oss/$basearch gpgkey=http://cdn.opensuse.org/debug/distribution/leap/${releasever}/repo/non-oss/$basearch/repodata/repomd.xml.key EOF cat <<'EOF' >$Dir_ZYppRepos/openSUSE:repo-non-oss.repo [openSUSE:repo-non-oss] name=repo-non-oss (${releasever}) enabled=0 autorefresh=1 baseurl=http://cdn.opensuse.org/distribution/leap/${releasever}/repo/non-oss/$basearch gpgkey=http://cdn.opensuse.org/distribution/leap/${releasever}/repo/non-oss/$basearch/repodata/repomd.xml.key EOF cat <<'EOF' >$Dir_ZYppRepos/openSUSE:repo-openh264.repo [openSUSE:repo-openh264] name=repo-openh264 (${releasever}) enabled=1 autorefresh=1 baseurl=http://codecs.opensuse.org/openh264/openSUSE_Leap_16 gpgkey=https://codecs.opensuse.org/openh264/openSUSE_Leap_16/repodata/repomd.xml.key EOF cat <<'EOF' >$Dir_ZYppRepos/openSUSE:repo-oss-debug.repo [openSUSE:repo-oss-debug] name=repo-oss-debug (${releasever}) enabled=0 autorefresh=1 baseurl=http://cdn.opensuse.org/debug/distribution/leap/${releasever}/repo/oss/$basearch gpgkey=http://cdn.opensuse.org/debug/distribution/leap/${releasever}/repo/oss/$basearch/repodata/repomd.xml.key EOF cat <<'EOF' >$Dir_ZYppRepos/openSUSE:repo-oss.repo [openSUSE:repo-oss] name=repo-oss (${releasever}) enabled=1 autorefresh=1 baseurl=http://cdn.opensuse.org/distribution/leap/${releasever}/repo/oss/$basearch gpgkey=http://cdn.opensuse.org/distribution/leap/${releasever}/repo/oss/$basearch/repodata/repomd.xml.key EOF cat <<'EOF' >$Dir_ZYppRepos/openSUSE:repo-oss-source.repo [openSUSE:repo-oss-source] name=repo-oss-source (${releasever}) enabled=0 autorefresh=1 baseurl=http://cdn.opensuse.org/source/distribution/leap/${releasever}/repo/oss gpgkey=http://cdn.opensuse.org/source/distribution/leap/${releasever}/repo/oss/repodata/repomd.xml.key EOF ;; 15) case "${2#*.}" in [0-2]) cat <<'EOF' >$Dir_ZYppRepos/repo-debug-non-oss.repo [repo-debug-non-oss] name=Debug Repository (Non-OSS) enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/debug/distribution/leap/$releasever/repo/non-oss/ type=NONE keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-debug.repo [repo-debug] name=Debug Repository enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/debug/distribution/leap/$releasever/repo/oss/ type=NONE keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-debug-update-non-oss.repo [repo-debug-update-non-oss] name=Update Repository (Debug, Non-OSS) enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/debug/update/leap/$releasever/non-oss/ type=NONE keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-debug-update.repo [repo-debug-update] name=Update Repository (Debug) enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/debug/update/leap/$releasever/oss/ type=NONE keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-non-oss.repo [repo-non-oss] name=Non-OSS Repository enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/distribution/leap/$releasever/repo/non-oss/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-oss.repo [repo-oss] name=Main Repository enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/distribution/leap/$releasever/repo/oss/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-source-non-oss.repo [repo-source-non-oss] name=Source Repository (Non-OSS) enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/source/distribution/leap/$releasever/repo/non-oss/ type=NONE keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-source.repo [repo-source] name=Source Repository enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/source/distribution/leap/$releasever/repo/oss/ type=NONE keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-update-non-oss.repo [repo-update-non-oss] name=Update Repository (Non-Oss) enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/update/leap/$releasever/non-oss/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-update.repo [repo-update] name=Main Update Repository enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/update/leap/$releasever/oss/ type=rpm-md keeppackages=0 EOF ;; *) cat <<'EOF' >$Dir_ZYppRepos/repo-backports-debug-update.repo [repo-backports-debug-update] name=Update repository with updates for openSUSE Leap debuginfo packages from openSUSE Backports enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/update/leap/$releasever/backports_debug/ type=NONE keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-backports-update.repo [repo-backports-update] name=Update repository of openSUSE Backports enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/update/leap/$releasever/backports/ path=/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-debug-non-oss.repo [repo-debug-non-oss] name=Debug Repository (Non-OSS) enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/debug/distribution/leap/$releasever/repo/non-oss/ keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-debug.repo [repo-debug] name=Debug Repository enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/debug/distribution/leap/$releasever/repo/oss/ keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-debug-update-non-oss.repo [repo-debug-update-non-oss] name=Update Repository (Debug, Non-OSS) enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/debug/update/leap/$releasever/non-oss/ keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-debug-update.repo [repo-debug-update] name=Update Repository (Debug) enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/debug/update/leap/$releasever/oss/ keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-non-oss.repo [repo-non-oss] name=Non-OSS Repository enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/distribution/leap/$releasever/repo/non-oss/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-openh264.repo [repo-openh264] name=Open H.264 Codec (openSUSE Leap) enabled=1 autorefresh=1 baseurl=http://codecs.opensuse.org/openh264/openSUSE_Leap/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-oss.repo [repo-oss] name=Main Repository enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/distribution/leap/$releasever/repo/oss/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-sle-debug-update.repo [repo-sle-debug-update] name=Update repository with debuginfo for updates from SUSE Linux Enterprise 15 enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/debug/update/leap/$releasever/sle/ path=/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-sle-update.repo [repo-sle-update] name=Update repository with updates from SUSE Linux Enterprise 15 enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/update/leap/$releasever/sle/ path=/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-source.repo [repo-source] name=Source Repository enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/source/distribution/leap/$releasever/repo/oss/ keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-update-non-oss.repo [repo-update-non-oss] name=Update Repository (Non-Oss) enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/update/leap/$releasever/non-oss/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-update.repo [repo-update] name=Main Update Repository enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/update/leap/$releasever/oss/ type=rpm-md keeppackages=0 EOF ;; esac ;; esac ;; "tumbleweed") cat <<'EOF' >$Dir_ZYppRepos/repo-debug.repo [repo-debug] name=openSUSE-Tumbleweed-Debug enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/debug/tumbleweed/repo/oss/ path=/ keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-non-oss.repo [repo-non-oss] name=openSUSE-Tumbleweed-Non-Oss enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/tumbleweed/repo/non-oss/ path=/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-openh264.repo [repo-openh264] name=Open H.264 Codec (openSUSE Tumbleweed) enabled=1 autorefresh=1 baseurl=http://codecs.opensuse.org/openh264/openSUSE_Tumbleweed path=/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-oss.repo [repo-oss] name=openSUSE-Tumbleweed-Oss enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/tumbleweed/repo/oss/ path=/ type=rpm-md keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-source.repo [repo-source] name=openSUSE-Tumbleweed-Source enabled=0 autorefresh=1 baseurl=http://download.opensuse.org/source/tumbleweed/repo/oss/ path=/ keeppackages=0 EOF cat <<'EOF' >$Dir_ZYppRepos/repo-update.repo [repo-update] name=openSUSE-Tumbleweed-Update enabled=1 autorefresh=1 baseurl=http://download.opensuse.org/update/tumbleweed/ path=/ type=rpm-md keeppackages=0 EOF ;; esac } ## 生成 EPEL 附加软件包 repo 源文件 function gen_repo_files_EPEL() { case "${1}" in 10) cat <<'EOF' >$Dir_YumRepos/epel.repo [epel] name=Extra Packages for Enterprise Linux $releasever - $basearch #baseurl=https://download.example/pub/epel/$releasever_major${releasever_minor:+.$releasever_minor}/Everything/$basearch/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-$releasever_major${releasever_minor:+.$releasever_minor}&arch=$basearch gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever_major gpgcheck=1 repo_gpgcheck=0 metadata_expire=24h countme=1 enabled=1 [epel-debuginfo] name=Extra Packages for Enterprise Linux $releasever - $basearch - Debug #baseurl=https://download.example/pub/epel/$releasever_major${releasever_minor:+.$releasever_minor}/Everything/$basearch/debug/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-$releasever_major${releasever_minor:+.$releasever_minor}&arch=$basearch gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever_major gpgcheck=1 repo_gpgcheck=0 metadata_expire=24h enabled=0 [epel-source] name=Extra Packages for Enterprise Linux $releasever - $basearch - Source #baseurl=https://download.example/pub/epel/$releasever_major${releasever_minor:+.$releasever_minor}/Everything/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-$releasever_major${releasever_minor:+.$releasever_minor}&arch=$basearch gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever_major gpgcheck=1 repo_gpgcheck=0 metadata_expire=24h enabled=0 EOF cat <<'EOF' >$Dir_YumRepos/epel-testing.repo [epel-testing] name=Extra Packages for Enterprise Linux $releasever - Testing - $basearch #baseurl=https://download.example/pub/epel/testing/$releasever_major${releasever_minor:+.$releasever_minor}/Everything/$basearch/ metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-epel$releasever_major${releasever_minor:+.$releasever_minor}&arch=$basearch gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever_major gpgcheck=1 repo_gpgcheck=0 metadata_expire=24h countme=1 enabled=0 [epel-testing-debuginfo] name=Extra Packages for Enterprise Linux $releasever - Testing - $basearch - Debug #baseurl=https://download.example/pub/epel/testing/$releasever_major${releasever_minor:+.$releasever_minor}/Everything/$basearch/debug/ metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel$releasever_major${releasever_minor:+.$releasever_minor}&arch=$basearch gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever_major gpgcheck=1 repo_gpgcheck=0 metadata_expire=24h enabled=0 [epel-testing-source] name=Extra Packages for Enterprise Linux $releasever - Testing - $basearch - Source #baseurl=https://download.example/pub/epel/testing/$releasever_major${releasever_minor:+.$releasever_minor}/Everything/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel$releasever_major${releasever_minor:+.$releasever_minor}&arch=$basearch gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever_major gpgcheck=1 repo_gpgcheck=0 metadata_expire=24h enabled=0 EOF ;; 9) cat <<'EOF' >$Dir_YumRepos/epel.repo [epel] name=Extra Packages for Enterprise Linux $releasever - $basearch #baseurl=https://download.example/pub/epel/$releasever/Everything/$basearch/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-$releasever&arch=$basearch&infra=$infra&content=$contentdir enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever [epel-debuginfo] name=Extra Packages for Enterprise Linux $releasever - $basearch - Debug #baseurl=https://download.example/pub/epel/$releasever/Everything/$basearch/debug/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-$releasever&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever gpgcheck=1 [epel-source] name=Extra Packages for Enterprise Linux $releasever - $basearch - Source #baseurl=https://download.example/pub/epel/$releasever/Everything/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-$releasever&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/epel-testing.repo [epel-testing] name=Extra Packages for Enterprise Linux $releasever - Testing - $basearch #baseurl=https://download.example/pub/epel/testing/$releasever/Everything/$basearch/ metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever [epel-testing-debuginfo] name=Extra Packages for Enterprise Linux $releasever - Testing - $basearch - Debug #baseurl=https://download.example/pub/epel/testing/$releasever/Everything/$basearch/debug/ metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever gpgcheck=1 [epel-testing-source] name=Extra Packages for Enterprise Linux $releasever - Testing - $basearch - Source #baseurl=https://download.example/pub/epel/testing/$releasever/Everything/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever gpgcheck=1 EOF ## 此仓库特殊,默认不启用 cat <<'EOF' >$Dir_YumRepos/epel-cisco-openh264.repo [epel-cisco-openh264] name=Extra Packages for Enterprise Linux $releasever openh264 (From Cisco) - $basearch metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-cisco-openh264-$releasever&arch=$basearch type=rpm enabled=0 metadata_expire=14d repo_gpgcheck=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever skip_if_unavailable=True [epel-cisco-openh264-debuginfo] name=Extra Packages for Enterprise Linux $releasever openh264 (From Cisco) - $basearch - Debug metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-cisco-openh264-debug-$releasever&arch=$basearch type=rpm enabled=0 metadata_expire=14d repo_gpgcheck=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever skip_if_unavailable=True [epel-cisco-openh264-source] name=Extra Packages for Enterprise Linux $releasever openh264 (From Cisco) - $basearch - Source metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-cisco-openh264-source-$releasever&arch=$basearch type=rpm enabled=0 metadata_expire=14d repo_gpgcheck=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever skip_if_unavailable=True EOF ;; 8) cat <<'EOF' >$Dir_YumRepos/epel.repo [epel] name=Extra Packages for Enterprise Linux 8 - $basearch #baseurl=https://download.example/pub/epel/8/Everything/$basearch metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=$basearch&infra=$infra&content=$contentdir enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 [epel-debuginfo] name=Extra Packages for Enterprise Linux 8 - $basearch - Debug #baseurl=https://download.example/pub/epel/8/Everything/$basearch/debug metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 gpgcheck=1 [epel-source] name=Extra Packages for Enterprise Linux 8 - $basearch - Source #baseurl=https://download.example/pub/epel/8/Everything/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/epel-testing.repo [epel-testing] name=Extra Packages for Enterprise Linux 8 - Testing - $basearch #baseurl=https://download.example/pub/epel/testing/8/Everything/$basearch metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-epel8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 [epel-testing-debuginfo] name=Extra Packages for Enterprise Linux 8 - Testing - $basearch - Debug #baseurl=https://download.example/pub/epel/testing/8/Everything/$basearch/debug metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 gpgcheck=1 [epel-testing-source] name=Extra Packages for Enterprise Linux 8 - Testing - $basearch - Source #baseurl=https://download.example/pub/epel/testing/8/Everything/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/epel-modular.repo [epel-modular] name=Extra Packages for Enterprise Linux Modular 8 - $basearch - RETIRED #baseurl=https://download.example/pub/epel/8/Modular/$basearch metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-modular-8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 [epel-modular-debuginfo] name=Extra Packages for Enterprise Linux Modular 8 - $basearch - Debug - RETIRED #baseurl=https://download.example/pub/epel/8/Modular/$basearch/debug metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-modular-debug-8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 gpgcheck=1 [epel-modular-source] name=Extra Packages for Enterprise Linux Modular 8 - $basearch - Source - RETIRED #baseurl=https://download.example/pub/epel/8/Modular/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-modular-source-8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/epel-testing-modular.repo [epel-testing-modular] name=Extra Packages for Enterprise Linux Modular 8 - Testing - $basearch - RETIRED #baseurl=https://download.example/pub/epel/testing/8/Modular/$basearch metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-modular-epel8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 [epel-testing-modular-debuginfo] name=Extra Packages for Enterprise Linux Modular 8 - Testing - $basearch - Debug - RETIRED #baseurl=https://download.example/pub/epel/testing/8/Modular/$basearch/debug metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-modular-debug-epel8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 gpgcheck=1 [epel-testing-modular-source] name=Extra Packages for Enterprise Linux Modular 8 - Testing - $basearch - Source - RETIRED #baseurl=https://download.example/pub/epel/testing/8/Modular/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-modular-source-epel8&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8 gpgcheck=1 EOF ;; 7) cat <<'EOF' >$Dir_YumRepos/epel.repo [epel] name=Extra Packages for Enterprise Linux 7 - $basearch #baseurl=http://download.example/pub/epel/7/$basearch metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch&infra=$infra&content=$contentdir failovermethod=priority enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 [epel-debuginfo] name=Extra Packages for Enterprise Linux 7 - $basearch - Debug #baseurl=http://download.example/pub/epel/7/$basearch/debug metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch&infra=$infra&content=$contentdir failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 gpgcheck=1 [epel-source] name=Extra Packages for Enterprise Linux 7 - $basearch - Source #baseurl=http://download.example/pub/epel/7/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch&infra=$infra&content=$contentdir failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/epel-testing.repo [epel-testing] name=Extra Packages for Enterprise Linux 7 - Testing - $basearch #baseurl=http://download.example/pub/epel/testing/7/$basearch metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-epel7&arch=$basearch&infra=$infra&content=$contentdir failovermethod=priority enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 [epel-testing-debuginfo] name=Extra Packages for Enterprise Linux 7 - Testing - $basearch - Debug #baseurl=http://download.example/pub/epel/testing/7/$basearch/debug metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel7&arch=$basearch&infra=$infra&content=$contentdir failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 gpgcheck=1 [epel-testing-source] name=Extra Packages for Enterprise Linux 7 - Testing - $basearch - Source #baseurl=http://download.example/pub/epel/testing/7/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel7&arch=$basearch&infra=$infra&content=$contentdir failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 gpgcheck=1 EOF ;; esac } ## 生成 EPEL 附加软件包 NEXT repo 源文件 function gen_repo_files_EPEL_NEXT() { case "${1}" in 9) cat <<'EOF' >$Dir_YumRepos/epel-next.repo [epel-next] name=Extra Packages for Enterprise Linux 9 - Next - $basearch #baseurl=https://download.example/pub/epel/next/9/Everything/$basearch/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-next-9&arch=$basearch&infra=$infra&content=$contentdir enabled=1 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9 [epel-next-debuginfo] name=Extra Packages for Enterprise Linux 9 - Next - $basearch - Debug #baseurl=https://download.example/pub/epel/next/9/Everything/$basearch/debug/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-next-debug-9&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9 gpgcheck=1 [epel-next-source] name=Extra Packages for Enterprise Linux 9 - Next - $basearch - Source #baseurl=https://download.example/pub/epel/next/9/Everything/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-next-source-9&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9 gpgcheck=1 EOF cat <<'EOF' >$Dir_YumRepos/epel-next-testing.repo [epel-next-testing] name=Extra Packages for Enterprise Linux 9 - Next - Testing - $basearch #baseurl=https://download.example/pub/epel/testing/next/9/Everything/$basearch/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-testing-next-9&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgcheck=1 countme=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9 [epel-next-testing-debuginfo] name=Extra Packages for Enterprise Linux 9 - Next - Testing - $basearch - Debug #baseurl=https://download.example/pub/epel/testing/next/9/Everything/$basearch/debug/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-testing-next-debug-9&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9 gpgcheck=1 [epel-next-testing-source] name=Extra Packages for Enterprise Linux 9 - Next - Testing - $basearch - Source #baseurl=https://download.example/pub/epel/testing/next/9/Everything/source/tree/ metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-testing-next-source-9&arch=$basearch&infra=$infra&content=$contentdir enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9 gpgcheck=1 EOF ;; esac } ############################################################################## MESSAGE_LANG_DEFAULT='en' MESSAGE_LANG_KEYS=( "en" ) declare -A MESSAGE_LANG_DISPLAY=( ['en']='English' ) declare -A MESSAGE_CONTENTS function msg() { local key="$1" shift local text="${MESSAGE_CONTENTS[${key}]}" if [[ -z "${text}" ]]; then echo "${key}" return fi while [[ $# -gt 0 ]]; do if [[ "${text}" == *"{}"* ]]; then text="${text/\{\}/$1}" else break fi shift done echo "${text}" } function init_msg_pack() { function load_pack() { local func_name="${1}" if declare -f "${func_name}" >/dev/null 2>&1; then eval "${func_name}" fi } local current_lang="${1:-${MESSAGE_LANG_DEFAULT}}" current_lang="$(echo "${current_lang}" | sed 's/^-*//')" current_lang="${current_lang,,}" if [[ "${MESSAGE_LANG_DISPLAY[${current_lang}]}" ]]; then current_lang="${current_lang//-/_}" load_pack "msg_pack_${current_lang}" fi } function msg_pack_en() { MESSAGE_CONTENTS=( ['start.welcome']=' GNU/Linux mirror switching script' ['start.runtimeEnv']='Runtime Env' ['start.dateTime']='System Time' ['end.moreInfo']='Script execution completed, visit our website for more tutorials' ['end.sponsorAds']='[Sponsor Ads]' ['error.cmd.options.needConfirm']='Please confirm and re-enter' ['error.cmd.options.needSpecify']='Please specify {} after this option' ['error.cmd.options.invalid']='Command option {} is invalid, {}!' ['error.cmd.options.validAddress']='a valid address' ['error.cmd.options.sourceAddress']='mirror address' ['error.cmd.options.sourceRepository']='mirror repository' ['error.cmd.options.codename']='version codename' ['error.cmd.options.boolean']=' true or false ' ['error.cmd.options.protocol']=' http or https ' ['error.cmd.options.needProtocol']=' Web protocol(http/https)' ['error.cmd.options.validLangKey']='A valid language ID ' ['error.cmd.options.langKey']='language ID ' ['error.cmd.options.unsupportTwoSourceMode']='Two mirror modes cannot be used at the same time. Please retry!' ['error.cmd.options.unsupportCodename']='The current system does not support specifying a codename. Please retry!' ['error.cmd.options.unsupportEPEL']='The current system cannot install the EPEL add-on package. Please retry!' ['error.unsupportSystem']='The operating system ({}) is not supported. Check the supported list on the website!' ['error.unsupportVersion']='The current system version is not supported' ['error.unknownSystem']='Unknown system' ['error.unknownVersion']='System version unknown' ['error.input']='Input error, {}!' ['error.needRoot']='Insufficient privileges, please run this script as root. Switch command: {}' ['error.defaultBehavior.https']='HTTPS is used by default' ['error.defaultBehavior.noReplace']='No replacement by default' ['error.defaultBehavior.noOverwrite']='No overwrite by default' ['error.defaultBehavior.noUpdate']='No update by default' ['error.defaultBehavior.noClean']='No cleanup by default' ['error.defaultBehavior.noUseIntranetSource']='Intranet mirrors are disabled by default' ['warn.usedIntranetSource']='Switched to an intranet-only mirror. Use only in the intended environment!' ['warn.unstableDebian']='Detected system version {} which may cause unpredictable issues.' ['warn.EPEL7']='Extra Packages for Enterprise Linux 7 reached end-of-life and was moved to the archive!' ['warn.needValidNumberIndex']='Please enter a valid number index!' ['warn.needInputNumberIndex']='Please enter a number index!' ['info.backuped.sourceFile']='Backed up existing {} source file' ['tip.EPEL7']="Some mirrors don't sync that archive. If errors occur, verify the target mirror provides it." ['interaction.source.type.public']='Public' ['interaction.source.type.intranet']='Intranet' ['interaction.source.type.select']='Please select network address (access method) for mirror:' ['interaction.source.type.usePublicAddress']='Use public network address for mirror by default, continue' ['interaction.source.select']='Please select the mirror you want to use:' ['interaction.source.selectAndInput']='Please select and enter the mirror you want to use' ['interaction.protocol.select']='Please select network protocol for mirror:' ['interaction.protocol.useHttp']='Use HTTP protocol for mirror' ['interaction.epel.skipReplace']='EPEL already installed. Replace/overwrite mirror' ['interaction.epel.install']='Install EPEL add-on package' ['interaction.backup.skipOverwrite.sourceFile']='A backup of {} already exists. Skip overwriting' ['interaction.upgrade.skip']='Skip upgrading packages' ['interaction.cache.autoClean']='Clean download cache after upgrading packages' ['interaction.common.tip']='Tip' ['interaction.common.operationCanceled']='Operation canceled' ['interaction.common.yes']='Yes' ['interaction.common.no']='No' ['work.upgradeSoftware']='Upgrading packages' ['work.installEPELPackage']='Installing epel-release package...' ['source.sync.text1']='Update APT package index' ['source.sync.text2']='Generate mirror cache' ['source.sync.text3']='Refreshing mirrors' ['source.sync.text4']='Synchronizing mirrors' ['source.sync.text5']='Updating binary cache and channels' ['source.comment.disabledSourceCode']='Source code mirrors are disabled by default for speed. Uncomment to enable' ['source.comment.securitySource']='Security updates' ['source.comment.proposedSource']='Proposed repository (not recommended)' ['source.changeResult.success']='Mirror switching complete' ['source.changeResult.fail']='Mirror switching complete, but {} failed' ['source.changeResult.tipTitle']='Run the script again with the same mirror. If {} still fails, consider:' ['source.changeResult.tip1']='Connectivity issues: unstable network, blocked access, or mirror-side firewall rules' ['source.changeResult.tip2']='Mirror issues: test the mirror manually at {}' ['source.changeResult.tip2.1']='If a file is missing, the mirror might still be syncing' ['source.changeResult.tip2.2']='If a path is missing, the mirror may not provide this system repository' ['source.changeResult.tip2.3']='Try another mirror. Syncing mirrors may temporarily serve broken content' ['source.changeResult.tip3']='Original mirrors failing: fix unrelated mirror errors and rerun the script' ['commands.help']='Command options(name/meaning/value): --source Specify mirror address (domain or IP) address --source-epel Specify EPEL repository address (domain or IP) address --source-security Specify Debian/Ubuntu security repo address (domain or IP) address --source-vault Specify CentOS/AlmaLinux vault repo address (domain or IP) address --source-portage Specify Gentoo portage repo address (domain or IP) address --source-base-system Specify Linux Mint/Raspberry Pi OS base system repo address (domain or IP) address --branch Specify mirror repository (repo name) repo name --branch-epel Specify EPEL repository (path) repo name --branch-security Specify Debian security repo (path) repo name --branch-vault Specify CentOS/AlmaLinux vault repo (path) repo name --branch-portage Specify Gentoo portage repo (path) repo name --branch-base-system Specify Linux Mint/Raspberry Pi OS base system repo (path) repo name --codename Specify Debian/openKylin codename codename --protocol Specify web protocol http or https --use-official-source Use official mirror of target OS true or false --use-official-source-epel Use official EPEL repo true or false --install-epel Install EPEL repository true or false --backup Backup original mirrors true or false --upgrade-software Upgrade packages true or false --clean-cache Clean cache after upgrade true or false --clean-screen Clear screen before running true or false --only-epel Only switch EPEL repo none --print-diff Print diff before and after modification none --pure-mode Pure mode, minimal output none --help Show help menu none Issue Report {}' ) } ############################################################################## init_msg_pack handle_command_options "$@" main ================================================ FILE: DockerInstallation.sh ================================================ #!/bin/bash ## Author: SuperManito ## Modified: 2026-01-19 ## License: MIT ## GitHub: https://github.com/SuperManito/LinuxMirrors ## Website: https://linuxmirrors.cn ## Docker CE 软件源列表 mirror_list_docker_ce=( "mirrors.aliyun.com/docker-ce" "mirrors.tencent.com/docker-ce" "mirrors.huaweicloud.com/docker-ce" "mirrors.cmecloud.cn/docker-ce" "mirrors.163.com/docker-ce" "mirrors.volces.com/docker" "mirror.azure.cn/docker-ce" "mirrors.tuna.tsinghua.edu.cn/docker-ce" "mirrors.pku.edu.cn/docker-ce" "mirrors.zju.edu.cn/docker-ce" "mirrors.nju.edu.cn/docker-ce" "mirror.sjtu.edu.cn/docker-ce" "mirrors.cqupt.edu.cn/docker-ce" "mirrors.ustc.edu.cn/docker-ce" "mirror.iscas.ac.cn/docker-ce" "download.docker.com" ) ## Docker Registry 仓库列表 mirror_list_registry=( "docker.1ms.run" "dockerproxy.net" "docker.m.daocloud.io" "docker.1panel.live" "registry.cn-hangzhou.aliyuncs.com" "registry.cn-shanghai.aliyuncs.com" "registry.cn-qingdao.aliyuncs.com" "registry.cn-beijing.aliyuncs.com" "registry.cn-zhangjiakou.aliyuncs.com" "registry.cn-huhehaote.aliyuncs.com" "registry.cn-wulanchabu.aliyuncs.com" "registry.cn-shenzhen.aliyuncs.com" "registry.cn-heyuan.aliyuncs.com" "registry.cn-guangzhou.aliyuncs.com" "registry.cn-chengdu.aliyuncs.com" "registry.cn-hongkong.aliyuncs.com" "registry.ap-northeast-1.aliyuncs.com" "registry.ap-southeast-1.aliyuncs.com" "registry.ap-southeast-3.aliyuncs.com" "registry.ap-southeast-5.aliyuncs.com" "registry.eu-central-1.aliyuncs.com" "registry.eu-west-1.aliyuncs.com" "registry.us-west-1.aliyuncs.com" "registry.us-east-1.aliyuncs.com" "registry.me-east-1.aliyuncs.com" "mirror.ccs.tencentyun.com" "gcr.io" "asia.gcr.io" "eu.gcr.io" "registry.hub.docker.com" ) ## 配置需要区分公网地址和内网地址的软件源(不分地域) # 需要同时在两个数组变量中分别定义软件源地址,并且保证排列顺序一致 # 软件源公网地址列表 mirror_list_extranet=( "mirrors.aliyun.com/docker-ce" "mirrors.tencent.com/docker-ce" "mirrors.huaweicloud.com/docker-ce" "mirrors.volces.com/docker-ce" ) # 软件源内网地址列表 mirror_list_intranet=( "mirrors.cloud.aliyuncs.com/docker-ce" "mirrors.tencentyun.com/docker-ce" "mirrors.myhuaweicloud.com/docker-ce" "mirrors.ivolces.com/docker-ce" ) ## 赞助商广告 SPONSOR_ADS=( "1Panel · Linux 面板|极简运维 ➜ \033[3mhttps://1panel.cn\033[0m" "多途云 · 智能化防护,每一次连接皆在安全之下 ➜ \033[3mhttps://www.duotuyun.com\033[0m" "毫秒镜像 · 专为中国开发者提供Docker镜像加速下载服务 ➜ \033[3mhttps://1ms.run\033[0m" "林枫云 · 专注独立IP高频VPS|R9/i9系列定制 ➜ \033[3mhttps://www.dkdun.cn\033[0m" "不死鸟CDN · 香港日本高防CDN,免实名/免备案,轻松阻断DDOS/CC攻击 ➜ \033[3mhttps://bsncdn.ai\033[0m" "青叶云 · 香港1T高防|自助防火墙,无视CC|大带宽回国优化线路 ➜ \033[3mhttps://www.qingyeyun.com\033[0m" "莱卡云 · 专业云计算服务器提供商 ➜ \033[3mhttps://www.lcayun.com\033[0m" "云悠YUNYOO · 全球高性价比云服务器|低至15.99元起 ➜ \033[3mhttps://yunyoo.cc\033[0m" "HKGserver · 全球家宽|双ISP|住宅原生云服务器54元/月起 ➜ \033[3mhttps://www.hkgserver.com\033[0m" "无忧云 · BGP多线高性能、高主频自动化云、物理服务器 ➜ \033[3mhttps://www.wuyouyun.com\033[0m" "速维云 · 大陆香港美日全球千兆大带宽、BGP多线、高频云、物理服务器 ➜ \033[3mhttps://www.svyun.com\033[0m" "酷盾安全 · 集分布式DDoS防护、CC防护、WAF防护、BOT行为分析一体化防护 ➜ \033[3mhttps://www.kd.cn\033[0m" "酷番云 · 安全、稳定、可信赖的企业级云服务提供商 ➜ \033[3mhttps://www.kufanyun.com\033[0m" "语鹿云盾 · 专业CDN加速、防御,亚太百兆三网优化CDN低至9元起 ➜ \033[3mhttps://www.lucdn.cn\033[0m" "不二云 · 国内外建站快响应服务器的不二之选 ➜ \033[3mhttps://cb2.cn\033[0m" "润信云 · 国内挂机宝海外云服务器低至9.9元/月 ➜ \033[3mhttps://www.runxinyun.com\033[0m" "蓝易云 · 高防CDN,国内BGP多线/香港/死扛CC/DDos攻击 ➜ \033[3mhttps://www.tsycdn.com\033[0m" "慈云数据 · 香港直连2H2G 99元/年 ➜ \033[3mhttps://www.ciyundata.com\033[0m" "浪浪云 · BGP网络让每一次连接都纵享丝滑,明码标价、无套路续费 ➜ \033[3mhttps://langlangy.cn\033[0m" ) ############################################################################## ## 定义系统判定变量 SYSTEM_DEBIAN="Debian" SYSTEM_UBUNTU="Ubuntu" SYSTEM_KALI="Kali" SYSTEM_DEEPIN="Deepin" SYSTEM_LINUX_MINT="Linuxmint" SYSTEM_ZORIN="Zorin" SYSTEM_RASPBERRY_PI_OS="Raspberry Pi OS" SYSTEM_REDHAT="RedHat" SYSTEM_RHEL="Red Hat Enterprise Linux" SYSTEM_CENTOS="CentOS" SYSTEM_CENTOS_STREAM="CentOS Stream" SYSTEM_ROCKY="Rocky" SYSTEM_ALMALINUX="AlmaLinux" SYSTEM_FEDORA="Fedora" SYSTEM_ORACLE="Oracle Linux" SYSTEM_OPENCLOUDOS="OpenCloudOS" SYSTEM_OPENCLOUDOS_STREAM="OpenCloudOS Stream" SYSTEM_TENCENTOS="TencentOS" SYSTEM_OPENEULER="openEuler" SYSTEM_ANOLISOS="Anolis" SYSTEM_KYLIN_DESKTOP="Kylin Desktop" SYSTEM_KYLIN_SERVER="Kylin Server" SYSTEM_OPENKYLIN="openKylin" SYSTEM_OPENSUSE="openSUSE" SYSTEM_ARCH="Arch" SYSTEM_MANJARO="Manjaro" SYSTEM_ALPINE="Alpine" SYSTEM_GENTOO="Gentoo" SYSTEM_NIXOS="NixOS" ## 定义系统版本文件 File_LinuxRelease=/etc/os-release File_RedHatRelease=/etc/redhat-release File_DebianVersion=/etc/debian_version File_ArmbianRelease=/etc/armbian-release File_RaspberryPiOSRelease=/etc/rpi-issue File_openEulerRelease=/etc/openEuler-release File_HuaweiCloudEulerOSRelease=/etc/hce-release File_OpenCloudOSRelease=/etc/opencloudos-release File_TencentOSServerRelease=/etc/tlinux-release File_AnolisOSRelease=/etc/anolis-release File_AlibabaCloudLinuxRelease=/etc/alinux-release File_OracleLinuxRelease=/etc/oracle-release File_ArchLinuxRelease=/etc/arch-release File_ManjaroRelease=/etc/manjaro-release File_AlpineRelease=/etc/alpine-release File_GentooRelease=/etc/gentoo-release File_KylinRelease=/etc/kylin-release File_kylinVersion=/etc/kylin-version/kylin-system-version.conf File_ProxmoxVersion=/etc/pve/.version ## 定义软件源相关文件或目录 File_AptSourceList=/etc/apt/sources.list Dir_AptAdditionalSources=/etc/apt/sources.list.d Dir_YumRepos=/etc/yum.repos.d ## 定义 Docker 相关变量 Dir_Docker=/etc/docker File_DockerConfig=$Dir_Docker/daemon.json File_DockerConfigBackup=$Dir_Docker/daemon.json.bak File_DockerVersionTmp=docker-version.txt File_DockerCEVersionTmp=docker-ce-version.txt File_DockerCECliVersionTmp=docker-ce-cli-version.txt File_DockerSourceList=$Dir_AptAdditionalSources/docker.list File_DockerRepo=$Dir_YumRepos/docker-ce.repo ## 定义颜色和样式变量 RED='\033[31m' GREEN='\033[32m' YELLOW='\033[33m' BLUE='\033[34m' PURPLE='\033[35m' AZURE='\033[36m' PLAIN='\033[0m' BOLD='\033[1m' SUCCESS="\033[1;32m✔${PLAIN}" COMPLETE="\033[1;32m✔${PLAIN}" WARN="\033[1;43m WARN ${PLAIN}" ERROR="\033[1;31m✘${PLAIN}" FAIL="\033[1;31m✘${PLAIN}" TIP="\033[1;44m TIP ${PLAIN}" WORKING="\033[1;36m◉${PLAIN}" function main() { permission_judgment collect_system_info run_start choose_mirrors if [[ "${ONLY_REGISTRY}" == "true" ]]; then only_change_docker_registry_mirror else choose_protocol close_firewall_service install_dependency_packages configure_docker_ce_mirror install_docker_engine change_docker_registry_mirror check_installed_result fi run_end } function handle_command_options() { ## 判断参数 while [ $# -gt 0 ]; do case "$1" in ## 指定 Docker CE 软件源地址 --source) if [ "$2" ]; then echo "$2" | grep -Eq "\(|\)|\[|\]|\{|\}" if [ $? -eq 0 ]; then command_error "$2" "$(msg "error.cmd.options.validAddress")" else SOURCE="$(echo "$2" | sed -e 's,^http[s]\?://,,g' -e 's,/$,,')" shift fi else command_error "$1" "$(msg "error.cmd.options.sourceAddress")" fi ;; ## 指定 Docker Registry 仓库地址 --source-registry) if [ "$2" ]; then echo "$2" | grep -Eq "\(|\)|\[|\]|\{|\}" if [ $? -eq 0 ]; then command_error "$2" "$(msg "error.cmd.options.validAddress")" else SOURCE_REGISTRY="$(echo "$2" | sed -e 's,^http[s]\?://,,g' -e 's,/$,,')" shift fi else command_error "$1" "$(msg "error.cmd.options.registryAddress")" fi ;; ## 指定 Docker CE 软件源仓库 --branch) if [ "$2" ]; then SOURCE_BRANCH="$2" shift else command_error "$1" "$(msg "error.cmd.options.sourceRepository")" fi ;; ## 指定 Docker CE 软件源仓库版本 --branch-version) if [ "$2" ]; then echo "$2" | grep -Eq "^[0-9]{1,2}$" if [ $? -eq 0 ]; then SOURCE_BRANCH_VERSION="$2" shift else command_error "$2" "$(msg "error.cmd.options.validVersion")" fi else command_error "$1" "$(msg "error.cmd.options.ceRepositoryVersion")" fi ;; ## 指定 Docker Engine 安装版本 --designated-version) if [ "$2" ]; then echo "$2" | grep -Eq "^[0-9][0-9].[0-9]{1,2}.[0-9]{1,2}$" if [ $? -eq 0 ]; then DESIGNATED_DOCKER_VERSION="$2" shift else command_error "$2" "$(msg "error.cmd.options.validVersion")" fi else command_error "$1" "$(msg "error.cmd.options.version")" fi ;; ## 指定 Debian 版本代号 --codename) if [ "$2" ]; then DEBIAN_CODENAME="$2" shift else command_error "$1" "$(msg "error.cmd.options.codename")" fi ;; ## Web 协议(HTTP/HTTPS) --protocol) if [ "$2" ]; then case "$2" in http | https | HTTP | HTTPS) WEB_PROTOCOL="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.protocol")" ;; esac else command_error "$1" "$(msg "error.cmd.options.needProtocol")" fi ;; ## 使用内网地址 --use-intranet-source) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) USE_INTRANET_SOURCE="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.needIntranetSource")" ;; esac else command_error "$1" "$(msg "error.cmd.options.needIntranetSource")" fi ;; ## 安装最新版本 --install-latest | --install-latested) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) INSTALL_LATESTED_DOCKER="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.needIntranetSource")" ;; esac else command_error "$1" "$(msg "error.cmd.options.needIntranetSource")" fi ;; ## 忽略覆盖备份提示 --ignore-backup-tips) IGNORE_BACKUP_TIPS="true" ;; ## 关闭防火墙 --close-firewall) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) CLOSE_FIREWALL="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.needIntranetSource")" ;; esac else command_error "$1" "$(msg "error.cmd.options.needIntranetSource")" fi ;; ## 清除屏幕上的所有内容 --clean-screen) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) CLEAN_SCREEN="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.needIntranetSource")" ;; esac else command_error "$1" "$(msg "error.cmd.options.needIntranetSource")" fi ;; ## Locale --lang) if [ "$2" ]; then local lang_norm="${2//_/-}" lang_norm="${lang_norm,,}" case "$lang_norm" in zh | zh-cn | zh-hans | zh-hans-*) init_msg_pack "zh-hans" shift ;; zh-hant | zh-hant-* | zh-tw | zh-hk) init_msg_pack "zh-hant" shift ;; en | en-us | en-*) init_msg_pack "en" shift ;; auto) choose_display_language shift ;; *) command_error "$2" "$(msg "error.cmd.options.validLangKey")" ;; esac else command_error "$1" "$(msg "error.cmd.options.langKey")" fi ;; --zh | --zh-[Cc][Nn]) init_msg_pack "zh-hans" ;; --en | --en-[Uu][Ss]) init_msg_pack "en" ;; --zh-[Hh]an[st]) init_msg_pack "$1" ;; ## 仅更换镜像仓库模式 --only-registry) ONLY_REGISTRY="true" ;; ## 纯净模式 --pure-mode) PURE_MODE="true" ;; ## 命令帮助 --help) echo -e "\n$(msg "commands.help" "https://github.com/SuperManito/LinuxMirrors/issues")\n" exit ;; *) command_error "$1" ;; esac shift done ## 设置部分功能的默认值 IGNORE_BACKUP_TIPS="${IGNORE_BACKUP_TIPS:-"false"}" if [[ "${DESIGNATED_DOCKER_VERSION}" ]]; then INSTALL_LATESTED_DOCKER="false" fi PURE_MODE="${PURE_MODE:-"false"}" } function run_start() { if [ -z "${CLEAN_SCREEN}" ]; then if [[ "${ONLY_REGISTRY}" == "true" ]]; then [[ -z "${SOURCE_REGISTRY}" ]] && clear else [[ -z "${SOURCE}" || -z "${SOURCE_REGISTRY}" ]] && clear fi elif [ "${CLEAN_SCREEN}" == "true" ]; then clear fi if [[ "${PURE_MODE}" == "true" ]]; then return fi local system_name="${SYSTEM_PRETTY_NAME:-"${SYSTEM_NAME} ${SYSTEM_VERSION_ID}"}" local arch="${DEVICE_ARCH}" local date_time="$(date "+%Y-%m-%d %H:%M")" local time_zone="$(timedatectl status 2>/dev/null | grep "Time zone" | awk -F ':' '{print$2}' | awk -F ' ' '{print$1}')" echo -e "+-----------------------------------+" echo -e "| \033[0;1;35;95m⡇\033[0m \033[0;1;33;93m⠄\033[0m \033[0;1;32;92m⣀⡀\033[0m \033[0;1;36;96m⡀\033[0;1;34;94m⢀\033[0m \033[0;1;35;95m⡀⢀\033[0m \033[0;1;31;91m⡷\033[0;1;33;93m⢾\033[0m \033[0;1;32;92m⠄\033[0m \033[0;1;36;96m⡀⣀\033[0m \033[0;1;34;94m⡀\033[0;1;35;95m⣀\033[0m \033[0;1;31;91m⢀⡀\033[0m \033[0;1;33;93m⡀\033[0;1;32;92m⣀\033[0m \033[0;1;36;96m⢀⣀\033[0m |" echo -e "| \033[0;1;31;91m⠧\033[0;1;33;93m⠤\033[0m \033[0;1;32;92m⠇\033[0m \033[0;1;36;96m⠇⠸\033[0m \033[0;1;34;94m⠣\033[0;1;35;95m⠼\033[0m \033[0;1;31;91m⠜⠣\033[0m \033[0;1;33;93m⠇\033[0;1;32;92m⠸\033[0m \033[0;1;36;96m⠇\033[0m \033[0;1;34;94m⠏\033[0m \033[0;1;35;95m⠏\033[0m \033[0;1;33;93m⠣⠜\033[0m \033[0;1;32;92m⠏\033[0m \033[0;1;34;94m⠭⠕\033[0m |" echo -e "+-----------------------------------+" echo -e "$(msg "start.welcome")" echo -e '' echo -e "$(msg "start.runtimeEnv") ${BLUE}${system_name} ${arch}${PLAIN}" echo -e "$(msg "start.dateTime") ${BLUE}${date_time} ${time_zone}${PLAIN}" sleep 1 >/dev/null 2>&1 } function run_end() { if [[ "${PURE_MODE}" == "true" ]]; then echo '' return fi echo -e "\n✨ $(msg "end.moreInfo") 👉 \033[3mhttps://linuxmirrors.cn\033[0m" if [[ "${#SPONSOR_ADS[@]}" -gt 0 ]]; then echo -e "\n\033[2m$(msg "end.sponsorAds")\033[0m" _str_width() { local s="$1" shopt -s extglob s="${s//\\033\[+([0-9;])[a-zA-Z]/}" local width=0 i len val local LC_ALL=C len=${#s} for ((i = 0; i < len; )); do printf -v val '%d' "'${s:i:1}" ((val < 0)) && ((val += 256)) if ((val < 128)); then ((width += 1, i += 1)) elif ((val < 192)); then ((i += 1)) elif ((val < 224)); then ((width += 1, i += 2)) elif ((val < 240)); then ((width += 2, i += 3)) else ((width += 2, i += 4)) fi done echo $width } local -a _c1 _c2 _c3 _w1 _w2 local _max1=0 _max2=0 _w _a _b for _entry in "${SPONSOR_ADS[@]}"; do _a="${_entry%% · *}" _b="${_entry#* · }" _c1+=("$_a") _c2+=("${_b%% ➜ *}") _c3+=("${_b##* ➜ }") _w=$(_str_width "$_a") _w1+=("$_w") [[ $_w -gt $_max1 ]] && _max1=$_w _w=$(_str_width "${_b%% ➜ *}") _w2+=("$_w") [[ $_w -gt $_max2 ]] && _max2=$_w done local _pad1 _pad2 for ((_i = 0; _i < ${#SPONSOR_ADS[@]}; _i++)); do sleep 0.1 printf -v _pad1 '%*s' $((_max1 - _w1[_i])) '' printf -v _pad2 '%*s' $((_max2 - _w2[_i])) '' echo -e " \033[2m${_c1[_i]}${_pad1} ${_c2[_i]}${_pad2} ${_c3[_i]}\033[0m" done fi echo -e "\n\033[3;1mPowered by \033[34mLinuxMirrors\033[0m\n" } function output_error() { [ "$1" ] && echo -e "\n$ERROR $1\n" exit 1 } function command_error() { local tmp_text="$(msg "error.cmd.options.needConfirm")" if [[ "${2}" ]]; then tmp_text="$(msg "error.cmd.options.needSpecify" "${2}")" fi output_error "$(msg "error.cmd.options.invalid" "${BLUE}$1${PLAIN}" "${tmp_text}")" } function unsupport_system_error() { if [[ "${2}" ]]; then output_error "$(msg "error.unsupportSystem2" "${1}")\n\n${BLUE}$2${PLAIN}" else output_error "$(msg "error.unsupportSystem1" "${1}")" fi } function input_error() { echo -e "\n$WARN $(msg "error.input" "${1}")" } function command_exists() { command -v "$@" &>/dev/null } function permission_judgment() { if [ $UID -ne 0 ]; then local change_cmd="su root" if command_exists sudo; then change_cmd="sudo -i" fi output_error "$(msg "error.needRoot" "${BLUE}${change_cmd}${PLAIN}")" fi } function get_os_release_value() { grep -E "^${1}=" $File_LinuxRelease | cut -d= -f2- | sed "s/[\'\"]//g" } function collect_system_info() { if [ ! -s "${File_LinuxRelease}" ]; then unsupport_system_error "$(msg "error.unknownSystem")" fi ## 定义系统名称 SYSTEM_NAME="$(get_os_release_value NAME)" SYSTEM_PRETTY_NAME="$(get_os_release_value PRETTY_NAME)" ## 定义系统版本号 SYSTEM_VERSION_ID="$(get_os_release_value VERSION_ID)" SYSTEM_VERSION_ID_MAJOR="${SYSTEM_VERSION_ID%%.*}" SYSTEM_VERSION_ID_MINOR="${SYSTEM_VERSION_ID#*.}" ## 定义系统ID SYSTEM_ID="$(get_os_release_value ID)" ## 判定当前系统派系 if [ -s "${File_DebianVersion}" ]; then SYSTEM_FACTIONS="${SYSTEM_DEBIAN}" if [ -s "${File_kylinVersion}" ]; then [[ "${ONLY_REGISTRY}" != "true" ]] && unsupport_system_error "Kylin Desktop" "apt-get install -y docker\nsystemctl enable --now docker.io" fi elif [ -s "${File_RedHatRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_REDHAT}" elif [ -s "${File_openEulerRelease}" ] || [ -s "${File_HuaweiCloudEulerOSRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_OPENEULER}" elif [ -s "${File_OpenCloudOSRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_OPENCLOUDOS}" # 自 9.0 版本起不再基于红帽 elif [ -s "${File_AnolisOSRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_ANOLISOS}" # 自 8.8 版本起不再基于红帽 elif [ -s "${File_TencentOSServerRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_TENCENTOS}" # 自 4 版本起不再基于红帽 elif [ -s "${File_kylinVersion}" ] || [ -s "${File_KylinRelease}" ]; then if [[ "${SYSTEM_ID}" == *"openkylin"* ]]; then SYSTEM_FACTIONS="${SYSTEM_OPENKYLIN}" else SYSTEM_FACTIONS="${SYSTEM_KYLIN_SERVER}" fi elif [ -f "${File_ArchLinuxRelease}" ]; then [[ "${ONLY_REGISTRY}" != "true" ]] && unsupport_system_error "Arch Linux" "pacman -S docker\nsystemctl enable --now docker" elif [ -f "${File_GentooRelease}" ]; then [[ "${ONLY_REGISTRY}" != "true" ]] && unsupport_system_error "Gentoo" elif [[ "${SYSTEM_NAME}" == *"openSUSE"* ]]; then [[ "${ONLY_REGISTRY}" != "true" ]] && unsupport_system_error "openSUSE" "zypper install docker\nsystemctl enable --now docker" elif [[ "${SYSTEM_NAME}" == *"NixOS"* ]]; then [[ "${ONLY_REGISTRY}" != "true" ]] && unsupport_system_error "NixOS" else unsupport_system_error "$(msg "error.unknownSystem")" fi ## 判定系统类型、版本、版本号 case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") if command_exists lsb_release; then SYSTEM_JUDGMENT="$(lsb_release -is)" SYSTEM_VERSION_CODENAME="${DEBIAN_CODENAME:-"$(lsb_release -cs)"}" else ## https://codeberg.org/gioele/lsb-release-minimal SYSTEM_JUDGMENT="${SYSTEM_ID^}" if [ "${SYSTEM_NAME}" ]; then if [[ "${SYSTEM_ID,,}" == "${SYSTEM_NAME,,}" ]]; then SYSTEM_JUDGMENT="${SYSTEM_NAME}" fi fi SYSTEM_VERSION_CODENAME="${DEBIAN_CODENAME:-"$(get_os_release_value VERSION_CODENAME)"}" fi # Raspberry Pi OS if [ -s "${File_RaspberryPiOSRelease}" ]; then SYSTEM_JUDGMENT="${SYSTEM_RASPBERRY_PI_OS}" SYSTEM_PRETTY_NAME="${SYSTEM_RASPBERRY_PI_OS}" fi ;; "${SYSTEM_REDHAT}") SYSTEM_JUDGMENT="$(awk '{printf $1}' $File_RedHatRelease)" ## 特殊系统判断 # Red Hat Enterprise Linux grep -q "${SYSTEM_RHEL}" $File_RedHatRelease && SYSTEM_JUDGMENT="${SYSTEM_RHEL}" # CentOS Stream grep -q "${SYSTEM_CENTOS_STREAM}" $File_RedHatRelease && SYSTEM_JUDGMENT="${SYSTEM_CENTOS_STREAM}" # Oracle Linux [ -s "${File_OracleLinuxRelease}" ] && SYSTEM_JUDGMENT="${SYSTEM_ORACLE}" ;; *) SYSTEM_JUDGMENT="${SYSTEM_FACTIONS}" ;; esac ## 判定系统处理器架构 DEVICE_ARCH_RAW="$(uname -m)" case "${DEVICE_ARCH_RAW}" in x86_64) DEVICE_ARCH="x86_64" ;; aarch64) DEVICE_ARCH="ARM64" ;; armv8l) DEVICE_ARCH="ARMv8_32" ;; armv7l) DEVICE_ARCH="ARMv7" ;; armv6l) DEVICE_ARCH="ARMv6" ;; armv5tel) DEVICE_ARCH="ARMv5" ;; ppc64le) DEVICE_ARCH="ppc64le" ;; s390x) DEVICE_ARCH="s390x" ;; i386 | i686) output_error "$(msg "error.unsupportX86_32")" ;; *) output_error "$(msg "error.unknownArch" "${DEVICE_ARCH_RAW}")" ;; esac ## 定义软件源仓库名称 if [[ -z "${SOURCE_BRANCH}" ]]; then case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") local debian_codename_latest="trixie" case "${SYSTEM_JUDGMENT}" in "${SYSTEM_DEBIAN}") SOURCE_BRANCH="debian" ;; "${SYSTEM_UBUNTU}" | "${SYSTEM_ZORIN}") SOURCE_BRANCH="ubuntu" ;; "${SYSTEM_KALI}") SOURCE_BRANCH="debian" SOURCE_BRANCH_CODENAME="${debian_codename_latest}" ;; "${SYSTEM_LINUX_MINT}") if [[ "${SYSTEM_NAME}" == *"LMDE"* ]]; then SOURCE_BRANCH="debian" SOURCE_BRANCH_CODENAME="$(get_os_release_value DEBIAN_CODENAME)" else SOURCE_BRANCH="ubuntu" SOURCE_BRANCH_CODENAME="$(get_os_release_value UBUNTU_CODENAME)" fi if [[ -z "${SOURCE_BRANCH_CODENAME}" ]]; then SOURCE_BRANCH="debian" SOURCE_BRANCH_CODENAME="bookworm" fi ;; "${SYSTEM_RASPBERRY_PI_OS}") case "${DEVICE_ARCH_RAW}" in x86_64 | aarch64) SOURCE_BRANCH="debian" ;; *) # 注:自 Docker 29 版本起将不再提供此分支仓库 SOURCE_BRANCH="raspbian" ;; esac ;; # "${SYSTEM_KYLIN_DESKTOP}") # SOURCE_BRANCH="ubuntu" # case "${SYSTEM_VERSION_ID_MAJOR}" in # "v10") # SOURCE_BRANCH_CODENAME="focal" # ;; # "v11") # SOURCE_BRANCH_CODENAME="noble" # ;; # *) # SOURCE_BRANCH_CODENAME="noble" # ;; # esac # ;; "${SYSTEM_OPENKYLIN}") SOURCE_BRANCH="debian" SOURCE_BRANCH_CODENAME="${debian_codename_latest}" ;; *) # 其余 Debian 系衍生操作系统 SOURCE_BRANCH="debian" SOURCE_BRANCH_CODENAME="bookworm" ;; esac ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") case "${SYSTEM_JUDGMENT}" in "${SYSTEM_FEDORA}") SOURCE_BRANCH="fedora" ;; "${SYSTEM_RHEL}") SOURCE_BRANCH="rhel" ;; *) SOURCE_BRANCH="centos" ;; esac if [[ "${DEVICE_ARCH_RAW}" == "s390x" ]]; then output_error "$(msg "error.unsupportS390x")" fi ;; esac fi ## 定义软件源更新文字 case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") SYNC_MIRROR_TEXT="$(msg "source.sync.text1")" ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") SYNC_MIRROR_TEXT="$(msg "source.sync.text2")" ;; esac ## 判断是否可以使用高级交互式选择器 CAN_USE_ADVANCED_INTERACTIVE_SELECTION="false" if command_exists tput; then CAN_USE_ADVANCED_INTERACTIVE_SELECTION="true" fi } ## 选择显示语言 function choose_display_language() { local result if command_exists tput; then local -a lang_key_labels=() local language_text for ((i = 0; i < ${#MESSAGE_LANG_KEYS[@]}; i++)); do language_text="${MESSAGE_LANG_DISPLAY[${MESSAGE_LANG_KEYS[$i]}]}" if [[ "${language_text}" ]]; then lang_key_labels+=("${language_text}") else lang_key_labels+=("") fi done interactive_select_list "MESSAGE_LANG_KEYS" "\n ${BOLD}Please select the display language:${PLAIN}\n" "lang_key_labels" result="${_SELECT_RESULT%%@@*}" else echo '' for ((i = 0; i < ${#MESSAGE_LANG_KEYS[@]}; i++)); do echo -e " $((i + 1)). ${MESSAGE_LANG_DISPLAY[${MESSAGE_LANG_KEYS[$i]}]}" done local CHOICE="$(echo -e "\n${BOLD}└─ Please select and enter the display language [ 1-${#MESSAGE_LANG_KEYS[@]} ]:${PLAIN}")" while true; do read -rp "${CHOICE}" INPUT case "${INPUT}" in [1-9] | [1-9][0-9]) local tmp_result="${MESSAGE_LANG_KEYS[$((INPUT - 1))]}" if [[ -z "${tmp_result}" ]]; then echo -e "\n$WARN $(msg "warn.needValidNumberIndex")" else result="${tmp_result}" break fi ;; *) echo -e "\n$WARN $(msg "warn.needInputNumberIndex")" ;; esac done fi init_msg_pack "${result}" } function choose_mirrors() { ## 打印软件源列表 function print_mirrors_list() { local tmp_name tmp_index i j function StringLength() { local text=$1 echo "${#text}" } local -a list_arr=() local list_arr_sum="$(eval echo \${#$1[@]})" for ((i = 0; i < $list_arr_sum; i++)); do list_arr[$i]="$(eval echo \${$1[i]})" done local name_width=${2:-"30"} local -a list_labels=() if [[ "${3}" ]]; then eval "list_labels=(\"\${${3}[@]}\")" fi if command_exists printf; then local tmp_uchar_1 tmp_uchar_2 tmp_uchar_3 tmp_uchar_4 tmp_default_length tmp_length tmp_unicode_length tmp_spaces_nums tmp_max_length for ((i = 0; i < ${#list_arr[@]}; i++)); do if [[ "${list_labels[$i]}" ]]; then tmp_name="${list_labels[$i]}" else tmp_name="${list_arr[i]}" fi tmp_index=$((i + 1)) tmp_default_length="${name_width}" tmp_uchar_1=$(echo "${tmp_name}" | grep -c "“") tmp_uchar_2=$(echo "${tmp_name}" | grep -c "”") tmp_uchar_3=$(echo "${tmp_name}" | grep -c "‘") tmp_uchar_4=$(echo "${tmp_name}" | grep -c "’") [[ "${tmp_uchar_1}" -gt 0 ]] && ((tmp_default_length += tmp_uchar_1)) [[ "${tmp_uchar_2}" -gt 0 ]] && ((tmp_default_length += tmp_uchar_2)) [[ "${tmp_uchar_3}" -gt 0 ]] && ((tmp_default_length += tmp_uchar_3)) [[ "${tmp_uchar_4}" -gt 0 ]] && ((tmp_default_length += tmp_uchar_4)) tmp_length=$(StringLength "${tmp_name}") tmp_unicode_length=$(StringLength "$(echo "${tmp_name}" | sed "s|[0-9a-zA-Z -~]||g; s| ||g")") tmp_max_length=$((tmp_default_length + tmp_unicode_length)) tmp_spaces_nums=$((((tmp_default_length - tmp_unicode_length - tmp_length)) / 2)) if [[ $tmp_spaces_nums -gt 0 ]]; then tmp_name="${tmp_name}$(printf '%*s' ${tmp_spaces_nums} '')" fi printf "❖ %-${tmp_max_length}s %4s\n" "${tmp_name}" "${tmp_index})" done else for ((i = 0; i < ${#list_arr[@]}; i++)); do if [[ "${list_labels[$i]}" ]]; then tmp_name="${list_labels[$i]}" else tmp_name="${list_arr[i]}" fi tmp_index=$((i + 1)) echo -e " ❖ $tmp_index. ${tmp_name}" done fi } ## 选择使用软件源内网地址 function choose_use_intranet_address() { local intranet_source for ((i = 0; i < ${#mirror_list_extranet[@]}; i++)); do if [[ "${SOURCE}" == "${mirror_list_extranet[i]}" ]]; then intranet_source="${mirror_list_intranet[i]}" break else continue fi done if [[ -z "${USE_INTRANET_SOURCE}" ]]; then if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then echo '' interactive_select_boolean "${BOLD}$(msg "interaction.source.type.select")${PLAIN}" "$(msg "interaction.source.type.public")" "$(msg "interaction.source.type.intranet")" if [[ "${_SELECT_RESULT}" == "false" ]]; then SOURCE="${intranet_source}" ONLY_HTTP="true" # 强制使用 HTTP 协议 [[ "${PURE_MODE}" != "true" ]] && echo -e "\n$WARN $(msg "warn.usedIntranetSource")" fi else local CHOICE="$(echo -e "\n${BOLD}└─ $(msg "interaction.source.type.usePublicAddress")? [Y/n] ${PLAIN}")" read -rp "${CHOICE}" INPUT [[ -z "${INPUT}" ]] && INPUT=Y case "${INPUT}" in [Yy] | [Yy][Ee][Ss]) ;; [Nn] | [Nn][Oo]) SOURCE="${intranet_source}" ONLY_HTTP="true" # 强制使用 HTTP 协议 [[ "${PURE_MODE}" != "true" ]] && echo -e "\n$WARN $(msg "warn.usedIntranetSource")" ;; *) input_error "$(msg "error.defaultBehavior.noUseIntranetSource")" ;; esac fi elif [[ "${USE_INTRANET_SOURCE}" == "true" ]]; then SOURCE="${intranet_source}" fi } local mirror_list_name mirror_list_length local -a mirror_list_labels=() local label_msg_index label_msg_content if [[ -z "${SOURCE}" ]] && [[ "${ONLY_REGISTRY}" != "true" ]]; then mirror_list_name="mirror_list_docker_ce" mirror_list_length=$(eval "echo \${#${mirror_list_name}[@]}") for ((i = 0; i < ${mirror_list_length}; i++)); do label_msg_index="mirrors.dockerCE.${i}" label_msg_content="$(msg "${label_msg_index}")" if [[ "${label_msg_content}" == "${label_msg_index}" ]]; then mirror_list_labels+=("") else mirror_list_labels+=("${label_msg_content}") fi done if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then interactive_select_list "${mirror_list_name}" "\n ${BOLD}$(msg "interaction.source.dockerCE.select")${PLAIN}\n" "mirror_list_labels" SOURCE="${_SELECT_RESULT%%@@*}" echo -e "\n${GREEN}➜${PLAIN} ${BOLD}Docker CE: ${_SELECT_RESULT#*@@}${PLAIN}" else echo '' print_mirrors_list "${mirror_list_name}" 39 "mirror_list_labels" local CHOICE_B="$(echo -e "\n${BOLD}└─ $(msg "interaction.source.dockerCE.selectAndInput") [ 1-$(eval echo \${#${mirror_list_name}[@]}) ]:${PLAIN}")" while true; do read -rp "${CHOICE_B}" INPUT case "${INPUT}" in [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) local tmp_result="$(eval echo \${${mirror_list_name}[$((INPUT - 1))]})" if [[ -z "${tmp_result}" ]]; then echo -e "\n$WARN $(msg "warn.needValidNumberIndex")" else SOURCE="${tmp_result}" break fi ;; *) echo -e "\n$WARN $(msg "warn.needInputNumberIndex")" ;; esac done fi fi ## 选择软件源内网地址 if [[ "${mirror_list_extranet[*]}" =~ (^|[^[:alpha:]])"${SOURCE}"([^[:alpha:]]|$) ]]; then choose_use_intranet_address fi if [[ -z "${SOURCE_REGISTRY}" ]]; then mirror_list_name="mirror_list_registry" mirror_list_labels=() mirror_list_length=$(eval "echo \${#${mirror_list_name}[@]}") for ((i = 0; i < ${mirror_list_length}; i++)); do label_msg_index="mirrors.registry.${i}" label_msg_content="$(msg "${label_msg_index}")" if [[ "${label_msg_content}" == "${label_msg_index}" ]]; then mirror_list_labels+=("") else mirror_list_labels+=("${label_msg_content}") fi done if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then sleep 1 >/dev/null 2>&1 interactive_select_list "${mirror_list_name}" "\n ${BOLD}$(msg "interaction.source.dockerRegistry.select")${PLAIN}\n" "mirror_list_labels" SOURCE_REGISTRY="${_SELECT_RESULT%%@@*}" echo -e "\n${GREEN}➜${PLAIN} ${BOLD}Docker Registry: $(echo "${_SELECT_RESULT#*@@}" | sed 's|(推荐)||g; s|(推薦)||g')${PLAIN}" else echo '' print_mirrors_list "${mirror_list_name}" 45 "mirror_list_labels" local CHOICE_C="$(echo -e "\n${BOLD}└─ $(msg "interaction.source.dockerRegistry.selectAndInput") [ 1-$(eval echo \${#${mirror_list_name}[@]}) ]:${PLAIN}")" while true; do read -rp "${CHOICE_C}" INPUT case "${INPUT}" in [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) local tmp_result="$(eval echo \${${mirror_list_name}[$(($INPUT - 1))]})" if [[ -z "${tmp_result}" ]]; then echo -e "\n$WARN $(msg "warn.needValidNumberIndex")" else SOURCE_REGISTRY="${tmp_result}" break fi ;; *) echo -e "\n$WARN $(msg "warn.needInputNumberIndex")" ;; esac done fi fi } ## 选择同步或更新软件源所使用的 Web 协议( HTTP/HTTPS) function choose_protocol() { if [[ -z "${WEB_PROTOCOL}" ]]; then if [[ "${ONLY_HTTP}" == "true" ]]; then WEB_PROTOCOL="http" else if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then echo '' interactive_select_boolean "${BOLD}$(msg "interaction.protocol.select")${PLAIN}" "HTTP" "HTTPS" if [[ "${_SELECT_RESULT}" == "true" ]]; then WEB_PROTOCOL="http" else WEB_PROTOCOL="https" fi else local CHOICE="$(echo -e "\n${BOLD}└─ $(msg "interaction.protocol.useHttp")? [Y/n] ${PLAIN}")" read -rp "${CHOICE}" INPUT [[ -z "${INPUT}" ]] && INPUT=Y case "${INPUT}" in [Yy] | [Yy][Ee][Ss]) WEB_PROTOCOL="http" ;; [Nn] | [Nn][Oo]) WEB_PROTOCOL="https" ;; *) input_error "$(msg "error.defaultBehavior.https")" WEB_PROTOCOL="https" ;; esac fi fi fi WEB_PROTOCOL="${WEB_PROTOCOL,,}" } ## 关闭防火墙和SELinux function close_firewall_service() { if ! command_exists systemctl; then return fi if [[ "$(systemctl is-active firewalld)" == "active" ]]; then if [[ -z "${CLOSE_FIREWALL}" ]]; then local ask_text="$(msg "interaction.firewall.close")?" if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then echo '' interactive_select_boolean "${BOLD}${ask_text}${PLAIN}" if [[ "${_SELECT_RESULT}" == "true" ]]; then CLOSE_FIREWALL="true" fi else local CHOICE="$(echo -e "\n${BOLD}└─ ${ask_text} [Y/n] ${PLAIN}")" read -rp "${CHOICE}" INPUT [[ -z "${INPUT}" ]] && INPUT=Y case "${INPUT}" in [Yy] | [Yy][Ee][Ss]) CLOSE_FIREWALL="true" ;; [Nn] | [Nn][Oo]) ;; *) input_error "$(msg "error.defaultBehavior.noClose")" ;; esac fi fi if [[ "${CLOSE_FIREWALL}" == "true" ]]; then local SelinuxConfig=/etc/selinux/config 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 fi fi } ## 安装环境包 function install_dependency_packages() { local commands package_manager ## 删除原有源 case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") sed -i '/docker-ce/d' $File_AptSourceList rm -rf $File_DockerSourceList ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") rm -rf $Dir_YumRepos/*docker*.repo ;; esac ## 更新软件源 commands=() case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") package_manager="apt-get" commands+=("${package_manager} update") ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") package_manager="$(get_package_manager)" commands+=("${package_manager} makecache") ;; esac if [[ "${PURE_MODE}" == "true" ]]; then local exec_cmd="" for cmd in "${commands[@]}"; do if [[ -z "${exec_cmd}" ]]; then exec_cmd="${cmd}" else exec_cmd="${exec_cmd} ; ${cmd}" fi done echo '' animate_exec "${exec_cmd}" "${SYNC_MIRROR_TEXT}" else echo '' for cmd in "${commands[@]}"; do eval "${cmd}" done fi if [ $? -ne 0 ]; then output_error "$(msg "error.sync" "${SYNC_MIRROR_TEXT}" "${BLUE}${package_manager}${PLAIN}")" fi commands=() case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") commands+=("${package_manager} install -y ca-certificates curl") ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") case "${SYSTEM_VERSION_ID_MAJOR}" in 7) commands+=("${package_manager} install -y yum-utils device-mapper-persistent-data lvm2") ;; *) if [[ "${package_manager}" == "dnf" ]]; then commands+=("${package_manager} install -y dnf-plugins-core") else commands+=("${package_manager} install -y yum-utils device-mapper-persistent-data lvm2") fi ;; esac ;; esac if [[ "${PURE_MODE}" == "true" ]]; then local exec_cmd="" for cmd in "${commands[@]}"; do if [[ -z "${exec_cmd}" ]]; then exec_cmd="${cmd}" else exec_cmd="${exec_cmd} ; ${cmd}" fi done echo '' animate_exec "${exec_cmd}" "$(msg "work.installDependents")" else for cmd in "${commands[@]}"; do eval "${cmd}" done fi } ## 配置 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}") ## 处理 GPG 密钥 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 # 删除旧的密钥 [ -f "${file_keyring}" ] && rm -rf $file_keyring install -m 0755 -d /etc/apt/keyrings curl -fsSL "${WEB_PROTOCOL}://${SOURCE}/linux/${SOURCE_BRANCH}/gpg" -o $file_keyring >/dev/null if [ $? -ne 0 ]; then output_error "$(msg "error.downloadGPG")" fi chmod a+r $file_keyring ## 添加源 [ -d "${Dir_AptAdditionalSources}" ] || mkdir -p $Dir_AptAdditionalSources local apt_source_content="deb [arch=$(dpkg --print-architecture) signed-by=${file_keyring}] ${WEB_PROTOCOL}://${SOURCE}/linux/${SOURCE_BRANCH} ${DEBIAN_CODENAME:-${SOURCE_BRANCH_CODENAME:-${SYSTEM_VERSION_CODENAME}}} stable" echo "${apt_source_content}" | tee $File_DockerSourceList >/dev/null 2>&1 commands+=("apt-get update") ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") local repo_file_url="${WEB_PROTOCOL}://${SOURCE}/linux/${SOURCE_BRANCH}/docker-ce.repo" local package_manager="$(get_package_manager)" case "${SYSTEM_VERSION_ID_MAJOR}" in 7) yum-config-manager -y --add-repo "${repo_file_url}" ;; *) if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_FEDORA}" ]]; then dnf-3 config-manager -y --add-repo "${repo_file_url}" else if [[ "${package_manager}" == "dnf" ]]; then dnf config-manager -y --add-repo "${repo_file_url}" else yum-config-manager -y --add-repo "${repo_file_url}" fi fi ;; esac sed -e "s|https://download.docker.com|${WEB_PROTOCOL}://${SOURCE}|g" \ -e "s|http[s]\?://.*/linux/${SOURCE_BRANCH}/|${WEB_PROTOCOL}://${SOURCE}/linux/${SOURCE_BRANCH}/|g" \ -i \ $File_DockerRepo ## 处理版本号 if [[ "${SOURCE_BRANCH_VERSION}" ]]; then # 指定版本 sed -e "s|\$releasever|${SOURCE_BRANCH_VERSION}|g" \ -i \ $File_DockerRepo commands+=("${package_manager} makecache") elif [[ "${SYSTEM_JUDGMENT}" != "${SYSTEM_FEDORA}" ]]; then # 兼容处理 local target_version case "${SYSTEM_VERSION_ID_MAJOR}" in 7 | 8 | 9 | 10) target_version="${SYSTEM_VERSION_ID_MAJOR}" ;; *) target_version="8" # 注:部分系统使用9版本分支会有兼容性问题 ## 适配国产操作系统 # OpenCloudOS、Anolis OS 的 23 版本 if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_OPENCLOUDOS}" || "${SYSTEM_JUDGMENT}" == "${SYSTEM_ANOLISOS}" ]]; then if [[ "${SYSTEM_VERSION_ID_MAJOR}" == 23 ]]; then target_version="9" fi fi if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_OPENEULER}" ]]; then if [ -s "${File_HuaweiCloudEulerOSRelease}" ]; then # Huawei Cloud EulerOS case "${SYSTEM_VERSION_ID_MAJOR}" in 1) target_version="8" # openEuler 20 ;; 2) target_version="9" # openEuler 22 ;; esac else # openEuler if [[ "${SYSTEM_VERSION_ID_MAJOR}" -ge 24 ]]; then target_version="10" elif [[ "${SYSTEM_VERSION_ID_MAJOR}" -gt 22 ]]; then target_version="9" fi fi fi # TencentOS Server if [ -s "${File_TencentOSServerRelease}" ]; then case "${SYSTEM_VERSION_ID_MAJOR}" in 4) target_version="9" ;; 3) target_version="8" ;; 2) target_version="7" ;; esac fi # Alibaba Cloud Linux if [ -s "${File_AnolisOSRelease}" ] && [ -s "${File_AlibabaCloudLinuxRelease}" ]; then case "${SYSTEM_VERSION_ID_MAJOR}" in 3) target_version="8" ;; 2) target_version="7" ;; esac fi if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_KYLIN_SERVER}" ]]; then case "${SYSTEM_VERSION_ID_MAJOR}" in "V10") target_version="8" ;; "V11") target_version="10" ;; *) target_version="10" ;; esac fi ;; esac sed -e "s|\$releasever|${target_version}|g" \ -i \ $File_DockerRepo commands+=("${package_manager} makecache") fi ;; esac if [[ "${PURE_MODE}" == "true" ]]; then local exec_cmd="" for cmd in "${commands[@]}"; do if [[ -z "${exec_cmd}" ]]; then exec_cmd="${cmd}" else exec_cmd="${exec_cmd} ; ${cmd}" fi done echo '' animate_exec "${exec_cmd}" "${SYNC_MIRROR_TEXT}" else for cmd in "${commands[@]}"; do eval "${cmd}" done fi } ## 安装 Docker Engine function install_docker_engine() { ## 导出可安装的版本列表 function export_version_list() { case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") apt-cache madison docker-ce | awk '{print $3}' | grep -Eo "[0-9][0-9].[0-9]{1,2}.[0-9]{1,2}" >$File_DockerCEVersionTmp apt-cache madison docker-ce-cli | awk '{print $3}' | grep -Eo "[0-9][0-9].[0-9]{1,2}.[0-9]{1,2}" >$File_DockerCECliVersionTmp grep -wf $File_DockerCEVersionTmp $File_DockerCECliVersionTmp >$File_DockerVersionTmp ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") local package_manager="$(get_package_manager)" $package_manager list docker-ce --showduplicates | sort -r | awk '{print $2}' | grep -Eo "[0-9][0-9].[0-9]{1,2}.[0-9]{1,2}" >$File_DockerCEVersionTmp $package_manager list docker-ce-cli --showduplicates | sort -r | awk '{print $2}' | grep -Eo "[0-9][0-9].[0-9]{1,2}.[0-9]{1,2}" >$File_DockerCECliVersionTmp grep -wf $File_DockerCEVersionTmp $File_DockerCECliVersionTmp >$File_DockerVersionTmp ;; esac rm -rf $File_DockerCEVersionTmp $File_DockerCECliVersionTmp } ## 卸载 Docker Engine 原有版本软件包 function uninstall_original_version() { if command_exists docker; then # 先停止并禁用 Docker 服务 systemctl disable --now docker >/dev/null 2>&1 sleep 2s fi # 确定需要卸载的软件包 local package_list case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") package_list='docker* podman podman-docker containerd runc' ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") package_list='docker* podman podman-docker runc' ;; esac # 卸载软件包并清理残留 case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") apt-get remove -y $package_list >/dev/null 2>&1 apt-get autoremove -y >/dev/null 2>&1 ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") local package_manager="$(get_package_manager)" $package_manager remove -y $package_list >/dev/null 2>&1 $package_manager autoremove -y >/dev/null 2>&1 ;; esac } ## 安装 function install_main() { local target_docker_version local pkgs="" local -a commands=() if [[ "${INSTALL_LATESTED_DOCKER}" == "true" ]]; then pkgs="docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin" else export_version_list if [ ! -s "${File_DockerVersionTmp}" ]; then rm -rf $File_DockerVersionTmp output_error "$(msg "error.queryVersionFailed")" fi if [[ "${DESIGNATED_DOCKER_VERSION}" ]]; then cat $File_DockerVersionTmp | grep -Eq "^${DESIGNATED_DOCKER_VERSION}$" if [ $? -ne 0 ]; then rm -rf $File_DockerVersionTmp output_error "$(msg "error.designatedVersion")" fi target_docker_version="${DESIGNATED_DOCKER_VERSION}" else if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then local -a version_list=( $(cat $File_DockerVersionTmp | sort -t '.' -k1,1nr -k2,2nr -k3,3nr | tr '\n' ' ' | sed 's/ $//') ) local mirror_list_name="version_list" interactive_select_list "${mirror_list_name}" "\n ${BOLD}$(msg "interaction.install.selectVersion")${PLAIN}\n" target_docker_version="${_SELECT_RESULT}" echo -e "\n${GREEN}➜${PLAIN} ${BOLD}$(msg "interaction.install.selectedVersion")${target_docker_version}${PLAIN}\n" else echo -e "\n${GREEN} --------- $(msg "interaction.install.selectedTitle" "28.3.0") ---------- ${PLAIN}\n" cat $File_DockerVersionTmp while true; do local CHOICE="$(echo -e "\n${BOLD}└─ $(msg "interaction.install.inputVersion")${PLAIN}\n")" read -rp "${CHOICE}" target_docker_version echo '' cat $File_DockerVersionTmp | grep -Eqw "${target_docker_version}" if [ $? -eq 0 ]; then echo "${target_docker_version}" | grep -Eqw '[0-9][0-9].[0-9]{1,2}.[0-9]{1,2}' if [ $? -eq 0 ]; then break else echo -e "$ERROR $(msg "error.invalidVersion")" fi else echo -e "$ERROR $(msg "error.reEnter")" fi done fi fi rm -rf $File_DockerVersionTmp local major_version="$(echo ${target_docker_version} | cut -d'.' -f1)" local minor_version="$(echo ${target_docker_version} | cut -d'.' -f2)" case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") if [[ $major_version -gt 18 ]] || [[ $major_version -eq 18 && $minor_version -ge 9 ]]; then local tmp_version="$(apt-cache madison docker-ce-cli | grep "${target_docker_version}" | head -1 | awk '{print $3}' | awk -F "${target_docker_version}" '{print$1}')" pkgs="docker-ce=${tmp_version}${target_docker_version}* docker-ce-cli=${tmp_version}${target_docker_version}*" else pkgs="docker-ce=${target_docker_version}* docker-ce-cli=${target_docker_version}*" fi ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") pkgs="docker-ce-${target_docker_version}" if [[ $major_version -gt 18 ]] || [[ $major_version -eq 18 && $minor_version -ge 9 ]]; then pkgs="${pkgs} docker-ce-cli-${target_docker_version}" fi ;; esac pkgs="${pkgs} containerd.io" if [[ $major_version -gt 20 ]] || [[ $major_version -eq 20 && $minor_version -ge 10 ]]; then pkgs="${pkgs} docker-compose-plugin" fi if [[ $major_version -ge 23 ]]; then pkgs="${pkgs} docker-buildx-plugin" fi fi case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") commands+=("apt-get install -y ${pkgs}") ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") commands+=("$(get_package_manager) install -y ${pkgs}") ;; esac echo '' if [[ "${PURE_MODE}" == "true" ]]; then local exec_cmd="" for cmd in "${commands[@]}"; do if [[ -z "${exec_cmd}" ]]; then exec_cmd="${cmd}" else exec_cmd="${exec_cmd} ; ${cmd}" fi done animate_exec "${exec_cmd}" "$(msg "work.installDockerEngine")" else for cmd in "${commands[@]}"; do eval "${cmd}" done fi [ $? -ne 0 ] && output_error "$(msg "error.installDockerEngineFailed")" } ## 判断是否手动选择安装版本 if [[ -z "${INSTALL_LATESTED_DOCKER}" ]]; then local ask_text="$(msg "interaction.install.latestVersion")?" if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then echo '' interactive_select_boolean "${BOLD}${ask_text}${PLAIN}" if [[ "${_SELECT_RESULT}" == "true" ]]; then INSTALL_LATESTED_DOCKER="true" else INSTALL_LATESTED_DOCKER="false" fi else local CHOICE_A="$(echo -e "\n${BOLD}└─ ${ask_text} [Y/n] ${PLAIN}")" read -rp "${CHOICE_A}" INPUT [[ -z "${INPUT}" ]] && INPUT=Y case $INPUT in [Yy] | [Yy][Ee][Ss]) INSTALL_LATESTED_DOCKER="true" ;; [Nn] | [Nn][Oo]) INSTALL_LATESTED_DOCKER="false" ;; *) INSTALL_LATESTED_DOCKER="true" input_error "$(msg "error.defaultBehavior.installLatest")" ;; esac fi fi ## 判定是否已安装 case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") dpkg -l | grep docker-ce-cli -q ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") rpm -qa | grep docker-ce-cli -q ;; esac if [ $? -eq 0 ]; then export_version_list local current_docker_version="$(docker -v | grep -Eo "[0-9][0-9]\.[0-9]{1,2}\.[0-9]{1,2}")" local latest_docker_version="$(cat $File_DockerVersionTmp | head -n 1)" rm -rf $File_DockerVersionTmp if [[ "${current_docker_version}" == "${latest_docker_version}" ]] && [[ "${INSTALL_LATESTED_DOCKER}" == "true" ]]; then echo -e "\n$TIP $(msg "tip.skipInstallDockerEngine")" else uninstall_original_version install_main fi else uninstall_original_version install_main fi } ## 修改 Docker Registry 镜像仓库源 function change_docker_registry_mirror() { if [[ -z "${SOURCE_REGISTRY}" ]]; then SOURCE_REGISTRY="registry.hub.docker.com" fi ## 使用官方 Docker Hub if [[ "${SOURCE_REGISTRY}" == "registry.hub.docker.com" ]]; then if [ -s "${File_DockerConfig}" ]; then ## 安装 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 systemctl restart docker fi else echo -e "\n${WARN} $(msg "warn.needManuallyDeleteConfig" "${File_DockerConfig}" "${BLUE}registry-mirrors${PLAIN}" "${BLUE}systemctl daemon-reload && systemctl restart docker${PLAIN}")\n" fi fi return fi ## 备份原有配置文件 if [ -d "${Dir_Docker}" ] && [ -e "${File_DockerConfig}" ]; then if [ -e "${File_DockerConfigBackup}" ]; then if [[ "${IGNORE_BACKUP_TIPS}" == "false" ]]; then local ask_text="$(msg "interaction.backup.skipOverwrite")?" if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then echo '' interactive_select_boolean "${BOLD}${ask_text}${PLAIN}" if [[ "${_SELECT_RESULT}" == "false" ]]; then echo '' cp -rvf $File_DockerConfig $File_DockerConfigBackup 2>&1 fi else local CHOICE_BACKUP="$(echo -e "\n${BOLD}└─ ${ask_text} [Y/n] ${PLAIN}")" read -rp "${CHOICE_BACKUP}" INPUT [[ -z "${INPUT}" ]] && INPUT=Y case $INPUT in [Yy] | [Yy][Ee][Ss]) ;; [Nn] | [Nn][Oo]) echo '' cp -rvf $File_DockerConfig $File_DockerConfigBackup 2>&1 ;; *) input_error "$(msg "error.defaultBehavior.noOverwrite")" ;; esac fi fi else echo '' cp -rvf $File_DockerConfig $File_DockerConfigBackup 2>&1 echo -e "\n$COMPLETE $(msg "info.backuped.dockerConfig")" fi sleep 2s else mkdir -p $Dir_Docker >/dev/null 2>&1 touch $File_DockerConfig fi echo -e '{\n "registry-mirrors": '"$(handleRegistryMirrorsValue ${SOURCE_REGISTRY})"'\n}' >$File_DockerConfig ## 重启服务 systemctl daemon-reload if [[ "$(systemctl is-active docker 2>/dev/null)" == "active" ]]; then systemctl restart docker fi } ## 仅修改 Docker Registry 镜像仓库源模式 function only_change_docker_registry_mirror() { ## 判定是否已安装 case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") dpkg -l | grep docker-ce-cli -q ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") rpm -qa | grep docker-ce-cli -q ;; esac if [ $? -ne 0 ]; then ## 仅镜像仓库换源模式 if [[ "${ONLY_REGISTRY}" == "true" ]]; then output_error "$(msg "result.registry.dockerEngineNotExsit" "${BLUE}--only-registry${PLAIN}")" fi fi [ -d "${Dir_Docker}" ] || mkdir -p "${Dir_Docker}" if [ -s "${File_DockerConfig}" ]; then ## 安装 jq if ! command_exists jq; then ## 更新软件源 local package_manager local -a commands=() case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") package_manager="apt-get" commands+=("${package_manager} update") ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") package_manager="$(get_package_manager)" commands+=("${package_manager} makecache") ;; esac if [[ "${PURE_MODE}" == "true" ]]; then local exec_cmd="" for cmd in "${commands[@]}"; do if [[ -z "${exec_cmd}" ]]; then exec_cmd="${cmd}" else exec_cmd="${exec_cmd} ; ${cmd}" fi done echo '' animate_exec "${exec_cmd}" "${SYNC_MIRROR_TEXT}" else echo '' for cmd in "${commands[@]}"; do eval "${cmd}" done fi if [ $? -ne 0 ]; then output_error "$(msg "error.sync" "${SYNC_MIRROR_TEXT}" "${BLUE}${package_manager}${PLAIN}")" fi $package_manager install -y jq if ! command_exists jq; then output_error "$(msg "error.installPackageFailed" "${BLUE}jq${PLAIN}")" fi fi [ -s "${File_DockerConfig}" ] || echo "{}" >$File_DockerConfig jq '.["registry-mirrors"] = '"$(handleRegistryMirrorsValue ${SOURCE_REGISTRY})"'' $File_DockerConfig >$File_DockerConfig.tmp && mv $File_DockerConfig.tmp $File_DockerConfig else echo -e '{\n "registry-mirrors": '"$(handleRegistryMirrorsValue ${SOURCE_REGISTRY})"'\n}' >$File_DockerConfig fi ## 重启服务 systemctl daemon-reload if [[ "$(systemctl is-active docker 2>/dev/null)" == "active" ]]; then systemctl restart docker fi echo -e "\n${BLUE}\$${PLAIN} docker info --format '{{json .RegistryConfig.Mirrors}}'" echo -e "\033[2m>${PLAIN} $(docker info --format '{{json .RegistryConfig.Mirrors}}')" if [[ "${PURE_MODE}" != "true" ]]; then echo -e "\n$COMPLETE $(msg "result.registry.success")" fi } function handleRegistryMirrorsValue() { local content="$1" local result="" content="$(echo "${content}" | sed 's| ||g')" local -a items=(${content//,/ }) for item in "${items[@]}"; do [[ -z "${item}" ]] && continue if [[ -z "${result}" ]]; then result='"https://'"${item}"'"' else result="${result},\"https://${item}\"" fi done if [[ "${result}" ]]; then echo "[${result}]" else echo "" fi } ## 查看版本并验证安装结果 function check_installed_result() { if command_exists docker; then systemctl enable --now docker >/dev/null 2>&1 echo -en "\n$COMPLETE " docker -v if [ $? -eq 0 ]; then echo -e " $(docker compose version 2>&1)" # echo -e "\n$COMPLETE 安装完成" else echo -e "\n$FAIL $(msg "result.install.failed")" local source_file package_manager case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") source_file="${File_DockerSourceList}" package_manager="apt-get" ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") source_file="${File_DockerRepo}" package_manager="$(get_package_manager)" ;; esac echo -e "\n$(msg "result.install.checkSourceFile" "cat ${source_file}")" echo -e "$(msg "result.install.manuallyExecCmd" "${package_manager} install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin")\n" exit 1 fi if [[ "$(systemctl is-active docker 2>/dev/null)" != "active" ]]; then sleep 2 systemctl disable --now docker >/dev/null 2>&1 sleep 2 systemctl enable --now docker >/dev/null 2>&1 sleep 2 if [[ "$(systemctl is-active docker)" != "active" ]]; then echo -e "\n$WARN $(msg "result.install.notRunning")" local start_cmd if command_exists systemctl; then start_cmd="systemctl start docker" else start_cmd="service docker start" fi echo -e "\n$TIP $(msg "result.install.manuallyRun" "${BLUE}${start_cmd}${PLAIN}")" fi fi else echo -e "\n$FAIL $(msg "result.install.failed")" fi } ## 选择系统包管理器 function get_package_manager() { local command="yum" case "${SYSTEM_JUDGMENT}" in "${SYSTEM_RHEL}" | "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ROCKY}" | "${SYSTEM_ALMALINUX}" | "${SYSTEM_ORACLE}") case "${SYSTEM_VERSION_ID_MAJOR}" in 9 | 10) command="dnf" ;; esac ;; "${SYSTEM_FEDORA}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") command="dnf" ;; esac echo "${command}" } function interactive_select_list() { _SELECT_RESULT="" eval "local -a __values=(\"\${${1}[@]}\")" local -a __labels=() local message="${2}" local selected=0 local start=0 local page_size=$(($(tput lines 2>/dev/null) - 3)) if [[ "${3}" ]]; then eval "__labels=(\"\${${3}[@]}\")" fi function clear_menu() { tput rc 2>/dev/null for ((i = 0; i < ${#__values[@]} + 1; i++)); do echo -e "\r\033[K" done tput rc 2>/dev/null } function cleanup() { clear_menu tput rc 2>/dev/null tput cnorm 2>/dev/null tput rmcup 2>/dev/null echo -e "\n\033[1;44m $(msg "interaction.common.tip") \033[0m \033[31m$(msg "interaction.common.operationCanceled")\033[0m\n" exit 130 } function draw_menu() { tput clear 2>/dev/null tput cup 0 0 2>/dev/null echo -e "${message}" local end=$((start + page_size - 1)) local label if [ $end -ge ${#__values[@]} ]; then end=${#__values[@]}-1 fi for ((i = start; i <= end; i++)); do if [[ "${__labels[$i]}" ]]; then label="${__labels[$i]}" else label="${__values[$i]}" fi if [ "$i" -eq "${selected}" ]; then echo -e "\e[34;4m➤ ${label}\e[0m" else echo -e " ${label}" fi done } function read_key() { IFS= read -rsn1 key if [[ $key == $'\x1b' ]]; then IFS= read -rsn2 key key="$key" fi echo "$key" } tput smcup 2>/dev/null tput sc 2>/dev/null tput civis 2>/dev/null trap "cleanup" INT TERM draw_menu while true; do key=$(read_key) case "$key" in "[A" | "w" | "W") if [ "${selected}" -gt 0 ]; then selected=$((selected - 1)) if [ "${selected}" -lt "$start" ]; then start=$((start - 1)) fi fi ;; "[B" | "s" | "S") if [ "${selected}" -lt $((${#__values[@]} - 1)) ]; then selected=$((selected + 1)) if [ "${selected}" -ge $((start + page_size)) ]; then start=$((start + 1)) fi fi ;; "") tput rmcup break ;; *) ;; esac draw_menu done tput cnorm 2>/dev/null tput rmcup 2>/dev/null _SELECT_RESULT="${__values[${selected}]}" if [ "${__labels[${selected}]}" ]; then _SELECT_RESULT="${_SELECT_RESULT}@@${__labels[${selected}]}" fi } function interactive_select_boolean() { _SELECT_RESULT="" local selected=0 local message="$1" local positive_title="${2:-"$(msg "interaction.common.yes")"}" local negative_title="${3:-"$(msg "interaction.common.no")"}" local menu_height=3 local original_line function store_position() { original_line=$(tput lines 2>/dev/null) } function clear_menu() { for ((i = 0; i < $menu_height; i++)); do tput cuu1 2>/dev/null tput el 2>/dev/null done } function cleanup() { clear_menu tput cnorm 2>/dev/null echo -e "\n\033[1;44m $(msg "interaction.common.tip") \033[0m \033[31m$(msg "interaction.common.operationCanceled")\033[0m\n" exit 130 } function draw_menu() { echo -e "╭─ ${message}" echo -e "│" if [ "${selected}" -eq 0 ]; then echo -e "╰─ \033[34m●\033[0m ${positive_title}\033[2m / ○ ${negative_title}\033[0m" else echo -e "╰─ \033[2m○ ${positive_title} / \033[0m\033[34m●\033[0m ${negative_title}" fi } function read_key() { IFS= read -rsn1 key if [[ $key == $'\x1b' ]]; then IFS= read -rsn2 key key="$key" fi echo "$key" } tput civis 2>/dev/null store_position trap "cleanup" INT TERM draw_menu while true; do key=$(read_key) case "$key" in "[D" | "a" | "A") if [ "${selected}" -gt 0 ]; then selected=$((selected - 1)) clear_menu draw_menu fi ;; "[C" | "d" | "D") if [ "${selected}" -lt 1 ]; then selected=$((selected + 1)) clear_menu draw_menu fi ;; "") clear_menu break ;; *) ;; esac done echo -e "╭─ ${message}" echo -e "│" if [ "${selected}" -eq 0 ]; then echo -e "╰─ \033[32m●\033[0m \033[1m${positive_title}\033[0m\033[2m / ○ ${negative_title}\033[0m" _SELECT_RESULT="true" else echo -e "╰─ \033[2m○ ${positive_title} / \033[0m\033[32m●\033[0m \033[1m${negative_title}\033[0m" _SELECT_RESULT="false" fi tput cnorm 2>/dev/null } function animate_exec() { local cmd="$1" local title="$2" local max_lines=${3:-5} local spinner_style="${4:-dots}" local refresh_rate="${5:-0.1}" local scroll_mode="${6:-1}" if [[ "${scroll_mode}" == "0" ]]; then echo -e "◉ ${title} \n" eval "${cmd}" return $? fi local -A spinners=([dots]="⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏" [circle]="◐ ◓ ◑ ◒" [classic]="-\\ |/") local -A recommended_rates=([dots]="0.08" [circle]="0.12" [classic]="0.12") [[ -z "${spinners[$spinner_style]}" ]] && spinner_style="dots" [[ "${refresh_rate}" == "0.1" ]] && refresh_rate="${recommended_rates[$spinner_style]}" local term_width=$(tput cols 2>/dev/null || echo 80) local display_width=$((term_width - 2)) function simple_truncate() { local line="$1" local truncate_marker="..." local max_length=$((display_width - 3)) if [[ "${line}" =~ ^[[:ascii:]]*$ && ${#line} -le $display_width ]]; then echo "${line}" return fi local non_ascii_count=$(echo "${line}" | sed "s|[0-9a-zA-Z -~]||g; s| ||g" | wc -m) local total_length=${#line} local display_length=$((total_length + non_ascii_count)) local quote_count=0 [[ $(echo "${line}" | grep -c "“") -gt 0 ]] && ((quote_count += "$(echo "${line}" | grep -c "“")")) [[ $(echo "${line}" | grep -c "”") -gt 0 ]] && ((quote_count += "$(echo "${line}" | grep -c "”")")) [[ $(echo "${line}" | grep -c "‘") -gt 0 ]] && ((quote_count += "$(echo "${line}" | grep -c "‘")")) [[ $(echo "${line}" | grep -c "’") -gt 0 ]] && ((quote_count += "$(echo "${line}" | grep -c "’")")) display_length=$((display_length - quote_count)) if [[ $display_length -le $display_width ]]; then echo "$line" return fi local result="" local current_width=0 local i=0 while [ $i -lt ${#line} ]; do local char="${line:$i:1}" local char_width=1 if ! [[ "$char" =~ [0-9a-zA-Z\.\=\:\_\(\)\'\"\-\/\!\·] ]]; then if [[ "$char" != "“" && "$char" != "”" && "$char" != "‘" && "$char" != "’" ]]; then char_width=2 fi fi if [[ $((current_width + char_width)) -gt $max_length ]]; then echo "${result}${truncate_marker}" return fi result+="${char}" current_width=$((current_width + char_width)) ((i++)) done echo "${line}" } function cleanup() { [ -f "${temp_file}" ] && rm -f "${temp_file}" tput cnorm 2>/dev/null echo -e "\n\033[1;44m $(msg "interaction.common.tip") \033[0m \033[31m$(msg "interaction.common.operationCanceled")\033[0m\n" exit 130 } function make_temp_file() { local -a temp_dirs=("." "/tmp") local tmp_file="" for dir in "${temp_dirs[@]}"; do [[ ! -d "${dir}" || ! -w "${dir}" ]] && continue tmp_file="${dir}/animate_exec_$$_$(date +%s)" touch "${tmp_file}" 2>/dev/null || continue if [[ -f "${tmp_file}" && -w "${tmp_file}" ]]; then echo "${tmp_file}" return fi done echo "${tmp_file}" } function update_display() { local current_size=$(wc -c <"${temp_file}" 2>/dev/null || echo 0) if [[ $current_size -le $last_size ]]; then return 1 fi local -a lines=() mapfile -t -n "${max_lines}" lines < <(tail -n "$max_lines" "${temp_file}") local -a processed_lines=() for ((i = 0; i < ${#lines[@]}; i++)); do processed_lines[i]=$(simple_truncate "${lines[i]}") done tput cud1 2>/dev/null echo -ne "\r\033[K" tput cud1 2>/dev/null for ((i = 0; i < $max_lines; i++)); do echo -ne "\r\033[K" [[ $i -lt ${#processed_lines[@]} ]] && echo -ne "\033[2m${processed_lines[$i]}\033[0m" [[ $i -lt $((max_lines - 1)) ]] && tput cud1 2>/dev/null done for ((i = 0; i < $max_lines + 1; i++)); do tput cuu1 2>/dev/null done last_size=$current_size return 0 } local spinner_frames=(${spinners[$spinner_style]}) local temp_file="$(make_temp_file)" trap "cleanup" INT TERM tput civis 2>/dev/null echo '' echo '' for ((i = 0; i < $max_lines; i++)); do echo '' done eval "${cmd}" >"${temp_file}" 2>&1 & local cmd_pid=$! local last_size=0 local spin_idx=0 tput cuu $((max_lines + 2)) 2>/dev/null sleep 0.05 echo -ne "\r\033[K◉ ${title} [\033[1m\033[34m${spinner_frames[$spin_idx]}\033[0m]" spin_idx=$(((spin_idx + 1) % ${#spinner_frames[@]})) update_display local update_count=0 local adaptive_rate=$refresh_rate while kill -0 $cmd_pid 2>/dev/null; do echo -ne "\r\033[K◉ ${title} [\033[1m\033[34m${spinner_frames[$spin_idx]}\033[0m]" spin_idx=$(((spin_idx + 1) % ${#spinner_frames[@]})) if update_display; then update_count=$((update_count + 1)) if [[ $update_count -gt 5 ]]; then adaptive_rate=$(awk "BEGIN {print $adaptive_rate * 1.5; exit}") [[ $(awk "BEGIN {print ($adaptive_rate > 0.5); exit}") -eq 1 ]] && adaptive_rate=0.5 update_count=0 fi else update_count=0 adaptive_rate=$refresh_rate fi sleep $adaptive_rate done wait $cmd_pid local exit_status=$? update_display if [ $exit_status -eq 0 ]; then echo -ne "\r\033[K◉ ${title} [\033[1m\033[32m✓\033[0m]\n" else echo -ne "\r\033[K◉ ${title} [\033[1m\033[31m✗\033[0m]\n" fi echo -ne "\r\033[K\n" local actual_lines=$(wc -l <"${temp_file}" 2>/dev/null || echo 0) [[ $actual_lines -gt $max_lines ]] && actual_lines=$max_lines if [[ $actual_lines -gt 0 ]]; then local -a final_lines=() mapfile -t -n "$actual_lines" final_lines < <(tail -n "$actual_lines" "${temp_file}") for ((i = 0; i < actual_lines; i++)); do local line=$(simple_truncate "${final_lines[$i]}") echo -ne "\r\033[K\033[2m${line}\033[0m\n" done fi tput cnorm 2>/dev/null rm -f "${temp_file}" return $exit_status } ############################################################################## MESSAGE_LANG_DEFAULT='zh-hans' MESSAGE_LANG_KEYS=( "zh-hans" "zh-hant" "en" ) declare -A MESSAGE_LANG_DISPLAY=( ['zh-hans']='简体中文' ['zh-hant']='繁體中文' ['en']='English' ) declare -A MESSAGE_CONTENTS function msg() { local key="$1" shift local text="${MESSAGE_CONTENTS[${key}]}" if [[ -z "${text}" ]]; then echo "${key}" return fi while [[ $# -gt 0 ]]; do if [[ "${text}" == *"{}"* ]]; then text="${text/\{\}/$1}" else break fi shift done echo "${text}" } function init_msg_pack() { function load_pack() { local func_name="${1}" if declare -f "${func_name}" >/dev/null 2>&1; then eval "${func_name}" fi } local current_lang="${1:-${MESSAGE_LANG_DEFAULT}}" current_lang="$(echo "${current_lang}" | sed 's/^-*//')" current_lang="${current_lang,,}" if [[ "${MESSAGE_LANG_DISPLAY[${current_lang}]}" ]]; then current_lang="${current_lang//-/_}" load_pack "msg_pack_${current_lang}" fi } function msg_pack_zh_hans() { MESSAGE_CONTENTS=( ['start.welcome']='欢迎使用 Docker Engine 安装与换源脚本' ['start.runtimeEnv']='运行环境' ['start.dateTime']='系统时间' ['end.moreInfo']='脚本运行完毕,更多使用教程详见官网' ['end.sponsorAds']='【赞助商广告】' ['error.cmd.options.needConfirm']='请确认后重新输入' ['error.cmd.options.needSpecify']='请在该选项后指定{}' ['error.cmd.options.invalid']='命令选项 {} 无效,{}!' ['error.cmd.options.validAddress']='有效的地址' ['error.cmd.options.sourceAddress']='软件源地址' ['error.cmd.options.registryAddress']='镜像仓库地址' ['error.cmd.options.sourceRepository']='软件源仓库' ['error.cmd.options.validVersion']='有效的版本号' ['error.cmd.options.ceRepositoryVersion']='Docker CE 软件源仓库的版本号' ['error.cmd.options.version']='版本号' ['error.cmd.options.codename']='版本代号' ['error.cmd.options.boolean']=' true 或 false ' ['error.cmd.options.protocol']=' http 或 https ' ['error.cmd.options.needProtocol']=' Web 协议(http/https)' ['error.cmd.options.validLangKey']='有效的语言 ID ' ['error.cmd.options.langKey']='语言 ' ['error.unsupportSystem1']='不支持当前操作系统({})' ['error.unsupportSystem2']='不支持当前操作系统({}),请参考如下命令自行安装:' ['error.unknownSystem']='未知系统' ['error.unsupportX86_32']='Docker Engine 不支持安装在 x86_32 架构的环境上!' ['error.unknownArch']='未知的系统架构:{}' ['error.unsupportS390x']='请查阅 RHEL 发行版声明以了解 s390x 支持' ['error.input']='输入错误,{}!' ['error.needRoot']='权限不足,请切换至 root 账户后运行本脚本,切换命令 {}' ['error.sync']='{}出错,请先解决系统原有软件源错误以确保 {} 软件包管理工具可用!' ['error.downloadGPG']='GPG 密钥下载失败,请检查网络或更换 Docker CE 软件源后重试!' ['error.queryVersionFailed']='查询 Docker Engine 版本列表失败!' ['error.designatedVersion']='指定的 Docker Engine 版本不存在或不支持安装!' ['error.invalidVersion']='请输入正确的版本号!' ['error.reEnter']='输入错误请重新输入!' ['error.installDockerEngineFailed']='安装 Docker Engine 失败!' ['error.installPackageFailed']='软件包 {} 安装失败,请自行安装后重新运行脚本!' ['error.defaultBehavior.https']='默认使用 HTTPS 协议' ['error.defaultBehavior.noClose']='默认不关闭' ['error.defaultBehavior.installLatest']='默认安装最新版本' ['error.defaultBehavior.noOverwrite']='默认不覆盖' ['error.defaultBehavior.noUseIntranetSource']='默认不使用内网地址' ['warn.usedIntranetSource']='已切换至内网专用地址,仅限在特定环境下使用!' ['warn.needValidNumberIndex']='请输入有效的数字序号!' ['warn.needInputNumberIndex']='请输入数字序号!' ['warn.needManuallyDeleteConfig']='请自行删除 {} 中的 {} 配置并重启服务 {}' ['tip.skipInstallDockerEngine']='检测到系统已安装 Docker Engine 且是最新版本,跳过安装' ['info.backuped.dockerConfig']='已备份原有 Docker 配置文件' ['interaction.source.type.public']='公网' ['interaction.source.type.intranet']='内网' ['interaction.source.type.select']='请选择 Docker CE 源的网络地址(访问方式):' ['interaction.source.type.usePublicAddress']='默认使用 Docker CE 源的公网地址,是否继续' ['interaction.source.dockerCE.select']='请选择你想使用的 Docker CE 源:' ['interaction.source.dockerCE.selectAndInput']='请选择并输入你想使用的 Docker CE 源' ['interaction.source.dockerRegistry.select']='请选择你想使用的 Docker Registry 源:' ['interaction.source.dockerRegistry.selectAndInput']='请选择并输入你想使用的 Docker Registry 源' ['interaction.protocol.select']='请选择 Docker CE 软件源的网络协议:' ['interaction.protocol.useHttp']='Docker CE 软件源是否使用 HTTP 协议' ['interaction.firewall.close']='是否关闭系统防火墙和 SELinux ' ['interaction.install.selectVersion']='请选择你想安装的版本:' ['interaction.install.selectedVersion']='指定安装版本:' ['interaction.install.selectedTitle']='请选择你要安装的版本,如:{}' ['interaction.install.inputVersion']='请根据上面的列表,选择并输入你想要安装的具体版本号:' ['interaction.install.latestVersion']='Docker Engine 是否安装最新版本' ['interaction.backup.skipOverwrite']='检测到已备份的 Docker 配置文件,是否跳过覆盖备份' ['interaction.common.tip']='提示' ['interaction.common.operationCanceled']='操作已取消' ['interaction.common.yes']='是' ['interaction.common.no']='否' ['work.installDependents']='安装环境软件包' ['work.installDockerEngine']='安装 Docker Engine' ['source.sync.text1']='更新软件源' ['source.sync.text2']='生成软件源缓存' ['result.install.failed']='安装失败' ['result.install.checkSourceFile']='检查源文件:' ['result.install.manuallyExecCmd']='请尝试手动执行安装命令:{}' ['result.install.notRunning']='检测到 Docker 服务启动异常,可尝试再次执行本脚本重试' ['result.install.manuallyRun']='请执行 {} 命令尝试启动或自行查询错误原因' ['result.registry.success']='已更换镜像仓库' ['result.registry.dockerEngineNotExsit']='当前尚未安装 Docker Engine,请取消设置 {} 命令选项后重新执行脚本!' ['commands.help']='命令选项(名称/含义/值): --source 指定 Docker CE 软件源地址(域名或IP) 地址 --source-registry 指定 Docker 镜像仓库地址(域名或IP) 地址 --branch 指定 Docker CE 软件源仓库(路径) 仓库名 --branch-version 指定 Docker CE 软件源仓库版本 版本号 --designated-version 指定 Docker Engine 安装版本 版本号 --codename 指定 Debian 系操作系统的版本代号 代号名称 --protocol 指定 Docker CE 软件源的 Web 协议 http 或 https --use-intranet-source 是否优先使用内网 Docker CE 软件源地址 true 或 false --install-latest 是否安装最新版本的 Docker Engine true 或 false --close-firewall 是否关闭防火墙 true 或 false --clean-screen 是否在运行前清除屏幕上的所有内容 true 或 false --lang 指定脚本使用的语言 ID 语言 --only-registry 仅更换镜像仓库模式 无 --ignore-backup-tips 忽略覆盖备份提示 无 --pure-mode 纯净模式,精简打印内容 无 --help 查看帮助菜单 无 问题报告 {}' ['mirrors.dockerCE.0']='阿里云' ['mirrors.dockerCE.1']='腾讯云' ['mirrors.dockerCE.2']='华为云' ['mirrors.dockerCE.3']='移动云' ['mirrors.dockerCE.4']='网易' ['mirrors.dockerCE.5']='火山引擎' ['mirrors.dockerCE.6']='微软 Azure 中国' ['mirrors.dockerCE.7']='清华大学' ['mirrors.dockerCE.8']='北京大学' ['mirrors.dockerCE.9']='浙江大学' ['mirrors.dockerCE.10']='南京大学' ['mirrors.dockerCE.11']='上海交通大学' ['mirrors.dockerCE.12']='重庆邮电大学' ['mirrors.dockerCE.13']='中国科学技术大学' ['mirrors.dockerCE.14']='中国科学院软件研究所' ['mirrors.dockerCE.15']='官方源' ['mirrors.registry.0']='毫秒镜像(推荐)' ['mirrors.registry.1']='Docker Proxy' ['mirrors.registry.2']='DaoCloud 道客' ['mirrors.registry.3']='1Panel 镜像' ['mirrors.registry.4']='阿里云(杭州)' ['mirrors.registry.5']='阿里云(上海)' ['mirrors.registry.6']='阿里云(青岛)' ['mirrors.registry.7']='阿里云(北京)' ['mirrors.registry.8']='阿里云(张家口)' ['mirrors.registry.9']='阿里云(呼和浩特)' ['mirrors.registry.10']='阿里云(乌兰察布)' ['mirrors.registry.11']='阿里云(深圳)' ['mirrors.registry.12']='阿里云(河源)' ['mirrors.registry.13']='阿里云(广州)' ['mirrors.registry.14']='阿里云(成都)' ['mirrors.registry.15']='阿里云(香港)' ['mirrors.registry.16']='阿里云(日本-东京)' ['mirrors.registry.17']='阿里云(新加坡)' ['mirrors.registry.18']='阿里云(马来西亚-吉隆坡)' ['mirrors.registry.19']='阿里云(印度尼西亚-雅加达)' ['mirrors.registry.20']='阿里云(德国-法兰克福)' ['mirrors.registry.21']='阿里云(英国-伦敦)' ['mirrors.registry.22']='阿里云(美国西部-硅谷)' ['mirrors.registry.23']='阿里云(美国东部-弗吉尼亚)' ['mirrors.registry.24']='阿里云(阿联酋-迪拜)' ['mirrors.registry.25']='腾讯云' ['mirrors.registry.26']='谷歌云(北美)' ['mirrors.registry.27']='谷歌云(亚洲)' ['mirrors.registry.28']='谷歌云(欧洲)' ['mirrors.registry.29']='官方 Docker Hub' ) } function msg_pack_zh_hant() { MESSAGE_CONTENTS=( ['start.welcome']='歡迎使用 Docker Engine 安裝與換源腳本' ['start.runtimeEnv']='執行環境' ['start.dateTime']='系統時間' ['end.moreInfo']='腳本執行完畢,更多使用教學詳見官網' ['end.sponsorAds']='【贊助商廣告】' ['error.cmd.options.needConfirm']='請確認後重新輸入' ['error.cmd.options.needSpecify']='請在該選項後指定{}' ['error.cmd.options.invalid']='命令選項 {} 無效,{}!' ['error.cmd.options.validAddress']='有效的位址' ['error.cmd.options.sourceAddress']='軟體源位址' ['error.cmd.options.registryAddress']='映象倉庫位址' ['error.cmd.options.sourceRepository']='軟體源倉庫' ['error.cmd.options.validVersion']='有效的版本號' ['error.cmd.options.ceRepositoryVersion']='Docker CE 軟體源倉庫的版本號' ['error.cmd.options.version']='版本號' ['error.cmd.options.codename']='版本代號' ['error.cmd.options.boolean']=' true 或 false ' ['error.cmd.options.protocol']=' http 或 https ' ['error.cmd.options.needProtocol']=' Web 協定(http/https)' ['error.cmd.options.validLangKey']='有效的語言 ID ' ['error.cmd.options.langKey']='語言 ID ' ['error.unsupportSystem1']='不支援當前作業系統({})' ['error.unsupportSystem2']='不支援當前作業系統({}),請參考如下命令自行安裝:\n\n{}' ['error.unknownSystem']='未知系統' ['error.unsupportX86_32']='Docker Engine 不支援安裝在 x86_32 架構的環境上!' ['error.unknownArch']='未知的系統架構:{}' ['error.unsupportS390x']='請查閱 RHEL 發行版宣告以瞭解 s390x 支援' ['error.input']='輸入錯誤,{}!' ['error.needRoot']='權限不足,請切換至 root 帳戶後執行本腳本,切換指令 {}' ['error.sync']='{}出錯,請先解決系統原有軟體源錯誤以確保 {} 軟體包管理工具可用!' ['error.downloadGPG']='GPG 金鑰下載失敗,請檢查網路或更換 Docker CE 軟體源後重試!' ['error.queryVersionFailed']='查詢 Docker Engine 版本清單失敗!' ['error.designatedVersion']='指定的 Docker Engine 版本不存在或不支援安裝!' ['error.invalidVersion']='請輸入正確的版本號!' ['error.reEnter']='輸入錯誤請重新輸入!' ['error.installDockerEngineFailed']='安裝 Docker Engine 失敗!' ['error.installPackageFailed']='軟體包 {} 安裝失敗,請自行安裝後重新執行腳本!' ['error.defaultBehavior.https']='預設使用 HTTPS 協定' ['error.defaultBehavior.noClose']='預設不關閉' ['error.defaultBehavior.installLatest']='預設安裝最新版本' ['error.defaultBehavior.noOverwrite']='預設不覆寫' ['error.defaultBehavior.noUseIntranetSource']='預設不使用內網位址' ['warn.usedIntranetSource']='已切換至內網專用位址,僅限在特定環境下使用!' ['warn.needValidNumberIndex']='請輸入有效的數字序號!' ['warn.needInputNumberIndex']='請輸入數字序號!' ['warn.needManuallyDeleteConfig']='請自行刪除 {} 中的 {} 設定並重新啟動服務 {}' ['tip.skipInstallDockerEngine']='偵測到系統已安裝 Docker Engine 且是最新版本,跳過安裝' ['info.backuped.dockerConfig']='已備份原有 Docker 設定檔' ['interaction.source.type.public']='公網' ['interaction.source.type.intranet']='內網' ['interaction.source.type.select']='請選擇 Docker CE 源的網路位址(存取方式):' ['interaction.source.type.usePublicAddress']='預設使用 Docker CE 源的公網位址,是否繼續' ['interaction.source.dockerCE.select']='請選擇你想使用的 Docker CE 源:' ['interaction.source.dockerCE.selectAndInput']='請選擇並輸入你想使用的 Docker CE 源' ['interaction.source.dockerRegistry.select']='請選擇你想使用的 Docker Registry 源:' ['interaction.source.dockerRegistry.selectAndInput']='請選擇並輸入你想使用的 Docker Registry 源' ['interaction.protocol.select']='請選擇 Docker CE 軟體源的網路協定:' ['interaction.protocol.useHttp']='Docker CE 軟體源是否使用 HTTP 協定' ['interaction.firewall.close']='是否關閉系統防火牆和 SELinux ' ['interaction.install.selectVersion']='請選擇你想安裝的版本:' ['interaction.install.selectedVersion']='指定安裝版本:' ['interaction.install.selectedTitle']='請選擇你要安裝的版本,如:{}' ['interaction.install.inputVersion']='請根據上面的清單,選擇並輸入你想要安裝的具體版本號:' ['interaction.install.latestVersion']='Docker Engine 是否安裝最新版本' ['interaction.backup.skipOverwrite']='偵測到已備份的 Docker 設定檔,是否跳過覆寫備份' ['interaction.common.tip']='提示' ['interaction.common.operationCanceled']='操作已取消' ['interaction.common.yes']='是' ['interaction.common.no']='否' ['work.installDependents']='安裝環境軟體包' ['work.installDockerEngine']='安裝 Docker Engine' ['source.sync.text1']='更新軟體源' ['source.sync.text2']='產生軟體源快取' ['result.install.failed']='安裝失敗' ['result.install.checkSourceFile']='檢查源檔案:' ['result.install.manuallyExecCmd']='請嘗試手動執行安裝命令:{}' ['result.install.notRunning']='偵測到 Docker 服務啟動異常,可嘗試再次執行本腳本重試' ['result.install.manuallyRun']='請執行 {} 命令嘗試啟動或自行查詢錯誤原因' ['result.registry.success']='已更換映象倉庫' ['result.registry.dockerEngineNotExsit']='目前尚未安裝 Docker Engine,請取消設定 {} 命令選項後重新執行腳本!' ['commands.help']='命令選項(名稱/含義/值): --source 指定 Docker CE 軟體源位址(網域名稱或IP) 位址 --source-registry 指定 Docker 映像倉庫位址 (網域名稱或IP) 位址 --branch 指定 Docker CE 軟體源倉庫 (路徑) 倉庫名稱 --branch-version 指定 Docker CE 軟體源倉庫版本 版本號 --designated-version 指定 Docker Engine 安裝版本 版本號 --codename 指定 Debian 係作業系統的版本代號 代號名稱 --protocol 指定 Docker CE 源的 Web 協定 http 或 https --use-intranet-source 是否優先使用內部網路 Docker CE 軟體源位址 true 或 false --install-latest 是否安裝最新版本的 Docker Engine true 或 false --close-firewall 是否關閉防火牆 true 或 false --clean-screen 是否在運行前清除螢幕上的所有內容 true 或 false --lang 指定腳本輸出的語言 语言 --only-registry 僅更換映像倉庫模式 無 --ignore-backup-tips 忽略覆蓋備份提示 無 --pure-mode 純淨模式,精簡列印內容 無 --help 查看幫助選單 無 問題報告 {}' ['mirrors.dockerCE.0']='阿里雲' ['mirrors.dockerCE.1']='騰訊雲' ['mirrors.dockerCE.2']='華為雲' ['mirrors.dockerCE.3']='移動雲' ['mirrors.dockerCE.4']='網易' ['mirrors.dockerCE.5']='火山引擎' ['mirrors.dockerCE.6']='微軟 Azure 中國' ['mirrors.dockerCE.7']='清華大學' ['mirrors.dockerCE.8']='北京大學' ['mirrors.dockerCE.9']='浙江大學' ['mirrors.dockerCE.10']='南京大學' ['mirrors.dockerCE.11']='上海交通大學' ['mirrors.dockerCE.12']='重慶郵電大學' ['mirrors.dockerCE.13']='中國科學技術大學' ['mirrors.dockerCE.14']='中國科學院軟體研究所' ['mirrors.dockerCE.15']='官方源' ['mirrors.registry.0']='毫秒鏡像(推薦)' ['mirrors.registry.1']='Docker Proxy' ['mirrors.registry.2']='DaoCloud 道客' ['mirrors.registry.3']='1Panel 鏡像' ['mirrors.registry.4']='阿里雲(杭州)' ['mirrors.registry.5']='阿里雲(上海)' ['mirrors.registry.6']='阿里雲(青島)' ['mirrors.registry.7']='阿里雲(北京)' ['mirrors.registry.8']='阿里雲(張家口)' ['mirrors.registry.9']='阿里雲(呼和浩特)' ['mirrors.registry.10']='阿里雲(烏蘭察布)' ['mirrors.registry.11']='阿里雲(深圳)' ['mirrors.registry.12']='阿里雲(河源)' ['mirrors.registry.13']='阿里雲(廣州)' ['mirrors.registry.14']='阿里雲(成都)' ['mirrors.registry.15']='阿里雲(香港)' ['mirrors.registry.16']='阿里雲(日本-東京)' ['mirrors.registry.17']='阿里雲(新加坡)' ['mirrors.registry.18']='阿里雲(馬來西亞-吉隆坡)' ['mirrors.registry.19']='阿里雲(印度尼西亞-雅加達)' ['mirrors.registry.20']='阿里雲(德國-法蘭克福)' ['mirrors.registry.21']='阿里雲(英國-倫敦)' ['mirrors.registry.22']='阿里雲(美國西部-矽谷)' ['mirrors.registry.23']='阿里雲(美國東部-弗吉尼亞)' ['mirrors.registry.24']='阿里雲(阿聯酋-迪拜)' ['mirrors.registry.25']='騰訊雲' ['mirrors.registry.26']='谷歌雲(北美)' ['mirrors.registry.27']='谷歌雲(亞洲)' ['mirrors.registry.28']='谷歌雲(歐洲)' ['mirrors.registry.29']='官方 Docker Hub' ) SPONSOR_ADS[0]="1Panel · 新一代的 Linux 伺服器維運管理面板 ➜ \033[3mhttps://1panel.cn\033[0m" } function msg_pack_en() { MESSAGE_CONTENTS=( ['start.welcome']='Docker installation & mirror switcher' ['start.runtimeEnv']='Runtime Env' ['start.dateTime']='System Time' ['end.moreInfo']='Script execution completed, visit our website for more tutorials' ['end.sponsorAds']='[Sponsor Ads]' ['error.cmd.options.needConfirm']='Please confirm and re-enter' ['error.cmd.options.needSpecify']='Please specify {} after this option' ['error.cmd.options.invalid']='Command option {} is invalid, {}!' ['error.cmd.options.validAddress']='a valid address' ['error.cmd.options.sourceAddress']='mirror address' ['error.cmd.options.registryAddress']='registry mirror address' ['error.cmd.options.sourceRepository']='mirror repository' ['error.cmd.options.validVersion']='a valid version number' ['error.cmd.options.ceRepositoryVersion']='Docker CE mirror repository version' ['error.cmd.options.version']='version number' ['error.cmd.options.codename']='version codename' ['error.cmd.options.boolean']=' true or false ' ['error.cmd.options.protocol']=' http or https ' ['error.cmd.options.needProtocol']=' Web protocol(http/https)' ['error.cmd.options.validLangKey']='A valid language ID ' ['error.cmd.options.langKey']='language ID ' ['error.unsupportSystem1']='Unsupported operating system ({})' ['error.unsupportSystem2']='Unsupported operating system ({}), please install manually with commands:' ['error.unknownSystem']='Unknown system' ['error.unsupportX86_32']='Docker Engine does not support installation on x86_32 architecture!' ['error.unknownArch']='Unknown system architecture: {}' ['error.unsupportS390x']='Please refer to RHEL distribution announcement for s390x support' ['error.input']='Input error, {}!' ['error.needRoot']='Insufficient privileges, please run this script as root. Switch command: {}' ['error.sync']='{} failed. Please fix system software sources (package repositories) so the {} package manager is available!' ['error.downloadGPG']='GPG key download failed, please check network or switch Docker CE mirror and retry!' ['error.queryVersionFailed']='Failed to query Docker Engine version list!' ['error.designatedVersion']='Specified Docker Engine version does not exist or is not supported for installation!' ['error.invalidVersion']='Please enter a valid version number!' ['error.reEnter']='Input error, please re-enter!' ['error.installDockerEngineFailed']='Docker Engine installation failed!' ['error.installPackageFailed']='Package {} installation failed, please install manually and rerun script!' ['error.defaultBehavior.https']='Using HTTPS protocol by default' ['error.defaultBehavior.noClose']='Not closing by default' ['error.defaultBehavior.installLatest']='Installing latest version by default' ['error.defaultBehavior.noOverwrite']='Not overwriting by default' ['error.defaultBehavior.noUseIntranetSource']='Not using intranet address by default' ['warn.usedIntranetSource']='Switched to intranet-only address, use only in specific environments!' ['warn.needValidNumberIndex']='Please enter a valid number index!' ['warn.needInputNumberIndex']='Please enter a number index!' ['warn.needManuallyDeleteConfig']='Please manually delete {} configuration in {} and restart service {}' ['tip.skipInstallDockerEngine']='Detected Docker Engine is already installed with latest version, skipping installation' ['info.backuped.dockerConfig']='Original Docker config file has been backed up' ['interaction.source.type.public']='Public' ['interaction.source.type.intranet']='Intranet' ['interaction.source.type.select']='Please select network address (access method) for Docker CE mirror:' ['interaction.source.type.usePublicAddress']='Use public network address for Docker CE mirror by default, continue' ['interaction.source.dockerCE.select']='Please select the Docker CE mirror you want to use:' ['interaction.source.dockerCE.selectAndInput']='Please select and enter the Docker CE mirror you want to use' ['interaction.source.dockerRegistry.select']='Please select the Docker Registry mirror you want to use:' ['interaction.source.dockerRegistry.selectAndInput']='Please select and enter the Docker Registry mirror you want to use' ['interaction.protocol.select']='Please select network protocol for Docker CE mirror:' ['interaction.protocol.useHttp']='Use HTTP protocol for Docker CE mirror' ['interaction.firewall.close']='Close system firewall and SELinux' ['interaction.install.selectVersion']='Please select the version you want to install:' ['interaction.install.selectedVersion']='Specified installation version:' ['interaction.install.selectedTitle']='Please select the version to install, e.g.: {}' ['interaction.install.inputVersion']='Based on the list above, please select and enter the specific version you want to install:' ['interaction.install.latestVersion']='Install latest version of Docker Engine' ['interaction.backup.skipOverwrite']='Detected existing backup of Docker config file, skip overwriting backup' ['interaction.common.tip']='Tip' ['interaction.common.operationCanceled']='Operation canceled' ['interaction.common.yes']='Yes' ['interaction.common.no']='No' ['work.installDependents']='Install environment packages' ['work.installDockerEngine']='Install Docker Engine' ['source.sync.text1']='Update APT package index' ['source.sync.text2']='Generate mirror cache' ['result.install.failed']='Installation failed' ['result.install.checkSourceFile']='Check source file:' ['result.install.manuallyExecCmd']='Please try manually executing installation command: {}' ['result.install.notRunning']='Detected Docker service startup error, try running this script again' ['result.install.manuallyRun']='Please execute {} command to try starting or investigate error cause' ['result.registry.success']='Registry mirror replaced successfully' ['result.registry.dockerEngineNotExsit']='Docker Engine is not installed yet, please remove {} command option and rerun script!' ['commands.help']='Command options(name/meaning/value): --source Specify Docker CE mirror address (domain or IP) address --source-registry Specify Docker Registry mirror address (domain or IP) address --branch Specify Docker CE mirror repository (path) repo name --branch-version Specify Docker CE mirror repository version version --designated-version Specify Docker Engine installation version version --codename Specify Debian-based OS codename codename --protocol Specify Web protocol for Docker CE mirror http or https --use-intranet-source Prefer intranet Docker CE mirror address true or false --install-latest Whether to install the latest Docker Engine true or false --close-firewall Whether to disable the firewall true or false --clean-screen Whether to clear the screen before running true or false --lang Specify the language of the script output language --only-registry Only switch registry mirror mode none --ignore-backup-tips Ignore backup overwrite prompt (do not backup) none --pure-mode Pure mode, minimal output none --help Show help menu none Issue Report {}' ['mirrors.dockerCE.0']='Alibaba Cloud' ['mirrors.dockerCE.1']='Tencent Cloud' ['mirrors.dockerCE.2']='Huawei Cloud' ['mirrors.dockerCE.3']='China Mobile Cloud' ['mirrors.dockerCE.4']='NetEase' ['mirrors.dockerCE.5']='Volcengine' ['mirrors.dockerCE.6']='Microsoft Azure China' ['mirrors.dockerCE.7']='Tsinghua University' ['mirrors.dockerCE.8']='Peking University' ['mirrors.dockerCE.9']='Zhejiang University' ['mirrors.dockerCE.10']='Nanjing University' ['mirrors.dockerCE.11']='Shanghai Jiao Tong University' ['mirrors.dockerCE.12']='Chongqing University of Posts and Telecommunications' ['mirrors.dockerCE.13']='University of Science and Technology of China' ['mirrors.dockerCE.14']='Institute of Software, Chinese Academy of Sciences' ['mirrors.dockerCE.15']='Official Source' ['mirrors.registry.0']='Millisecond Mirror (recommended)' ['mirrors.registry.1']='Docker Proxy' ['mirrors.registry.2']='DaoCloud' ['mirrors.registry.3']='1Panel Mirror' ['mirrors.registry.4']='Alibaba Cloud (Hangzhou)' ['mirrors.registry.5']='Alibaba Cloud (Shanghai)' ['mirrors.registry.6']='Alibaba Cloud (Qingdao)' ['mirrors.registry.7']='Alibaba Cloud (Beijing)' ['mirrors.registry.8']='Alibaba Cloud (Zhangjiakou)' ['mirrors.registry.9']='Alibaba Cloud (Hohhot)' ['mirrors.registry.10']='Alibaba Cloud (Ulanqab)' ['mirrors.registry.11']='Alibaba Cloud (Shenzhen)' ['mirrors.registry.12']='Alibaba Cloud (Heyuan)' ['mirrors.registry.13']='Alibaba Cloud (Guangzhou)' ['mirrors.registry.14']='Alibaba Cloud (Chengdu)' ['mirrors.registry.15']='Alibaba Cloud (Hong Kong)' ['mirrors.registry.16']='Alibaba Cloud (Japan - Tokyo)' ['mirrors.registry.17']='Alibaba Cloud (Singapore)' ['mirrors.registry.18']='Alibaba Cloud (Malaysia - Kuala Lumpur)' ['mirrors.registry.19']='Alibaba Cloud (Indonesia - Jakarta)' ['mirrors.registry.20']='Alibaba Cloud (Germany - Frankfurt)' ['mirrors.registry.21']='Alibaba Cloud (UK - London)' ['mirrors.registry.22']='Alibaba Cloud (US West - Silicon Valley)' ['mirrors.registry.23']='Alibaba Cloud (US East - Virginia)' ['mirrors.registry.24']='Alibaba Cloud (UAE - Dubai)' ['mirrors.registry.25']='Tencent Cloud' ['mirrors.registry.26']='Google Cloud (North America)' ['mirrors.registry.27']='Google Cloud (Asia)' ['mirrors.registry.28']='Google Cloud (Europe)' ['mirrors.registry.29']='Official Docker Hub' ) SPONSOR_ADS=( "1Panel · Top-Rated Web-based Linux Server Management Tool ➜ \033[3mhttps://1panel.cn\033[0m" ) } init_msg_pack handle_command_options "$@" main ================================================ FILE: DockerInstallationLite.sh ================================================ #!/bin/bash ## Author: SuperManito ## Modified: 2026-01-19 ## License: MIT ## GitHub: https://github.com/SuperManito/LinuxMirrors ## Website: https://linuxmirrors.cn WEB_PROTOCOL="https" INSTALL_LATESTED_DOCKER="true" IGNORE_BACKUP_TIPS="true" CLOSE_FIREWALL="true" ############################################################################## ## 定义系统判定变量 SYSTEM_DEBIAN="Debian" SYSTEM_UBUNTU="Ubuntu" SYSTEM_KALI="Kali" SYSTEM_DEEPIN="Deepin" SYSTEM_LINUX_MINT="Linuxmint" SYSTEM_ZORIN="Zorin" SYSTEM_RASPBERRY_PI_OS="Raspberry Pi OS" SYSTEM_REDHAT="RedHat" SYSTEM_RHEL="Red Hat Enterprise Linux" SYSTEM_CENTOS="CentOS" SYSTEM_CENTOS_STREAM="CentOS Stream" SYSTEM_ROCKY="Rocky" SYSTEM_ALMALINUX="AlmaLinux" SYSTEM_FEDORA="Fedora" SYSTEM_ORACLE="Oracle Linux" SYSTEM_OPENCLOUDOS="OpenCloudOS" SYSTEM_OPENCLOUDOS_STREAM="OpenCloudOS Stream" SYSTEM_TENCENTOS="TencentOS" SYSTEM_OPENEULER="openEuler" SYSTEM_ANOLISOS="Anolis" SYSTEM_KYLIN_DESKTOP="Kylin Desktop" SYSTEM_KYLIN_SERVER="Kylin Server" SYSTEM_OPENKYLIN="openKylin" SYSTEM_OPENSUSE="openSUSE" SYSTEM_ARCH="Arch" SYSTEM_MANJARO="Manjaro" SYSTEM_ALPINE="Alpine" SYSTEM_GENTOO="Gentoo" SYSTEM_NIXOS="NixOS" ## 定义系统版本文件 File_LinuxRelease=/etc/os-release File_RedHatRelease=/etc/redhat-release File_DebianVersion=/etc/debian_version File_ArmbianRelease=/etc/armbian-release File_RaspberryPiOSRelease=/etc/rpi-issue File_openEulerRelease=/etc/openEuler-release File_HuaweiCloudEulerOSRelease=/etc/hce-release File_OpenCloudOSRelease=/etc/opencloudos-release File_TencentOSServerRelease=/etc/tlinux-release File_AnolisOSRelease=/etc/anolis-release File_AlibabaCloudLinuxRelease=/etc/alinux-release File_OracleLinuxRelease=/etc/oracle-release File_ArchLinuxRelease=/etc/arch-release File_ManjaroRelease=/etc/manjaro-release File_AlpineRelease=/etc/alpine-release File_GentooRelease=/etc/gentoo-release File_KylinRelease=/etc/kylin-release File_kylinVersion=/etc/kylin-version/kylin-system-version.conf File_ProxmoxVersion=/etc/pve/.version ## 定义软件源相关文件或目录 File_AptSourceList=/etc/apt/sources.list Dir_AptAdditionalSources=/etc/apt/sources.list.d Dir_YumRepos=/etc/yum.repos.d ## 定义 Docker 相关变量 Dir_Docker=/etc/docker File_DockerConfig=$Dir_Docker/daemon.json File_DockerConfigBackup=$Dir_Docker/daemon.json.bak File_DockerVersionTmp=docker-version.txt File_DockerCEVersionTmp=docker-ce-version.txt File_DockerCECliVersionTmp=docker-ce-cli-version.txt File_DockerSourceList=$Dir_AptAdditionalSources/docker.list File_DockerRepo=$Dir_YumRepos/docker-ce.repo ## 定义颜色和样式变量 RED='\033[31m' GREEN='\033[32m' YELLOW='\033[33m' BLUE='\033[34m' PURPLE='\033[35m' AZURE='\033[36m' PLAIN='\033[0m' BOLD='\033[1m' SUCCESS="\033[1;32m✔${PLAIN}" COMPLETE="\033[1;32m✔${PLAIN}" WARN="\033[1;43m WARN ${PLAIN}" ERROR="\033[1;31m✘${PLAIN}" FAIL="\033[1;31m✘${PLAIN}" TIP="\033[1;44m TIP ${PLAIN}" WORKING="\033[1;36m◉${PLAIN}" function main() { permission_judgment collect_system_info run_start choose_mirrors if [[ "${ONLY_REGISTRY}" == "true" ]]; then only_change_docker_registry_mirror else choose_protocol close_firewall_service install_dependency_packages configure_docker_ce_mirror install_docker_engine change_docker_registry_mirror check_installed_result fi run_end } function handle_command_options() { ## 判断参数 while [ $# -gt 0 ]; do case "$1" in ## 指定 Docker CE 软件源地址 --source) if [ "$2" ]; then echo "$2" | grep -Eq "\(|\)|\[|\]|\{|\}" if [ $? -eq 0 ]; then command_error "$2" "$(msg "error.cmd.options.validAddress")" else SOURCE="$(echo "$2" | sed -e 's,^http[s]\?://,,g' -e 's,/$,,')" shift fi else command_error "$1" "$(msg "error.cmd.options.sourceAddress")" fi ;; ## 指定 Docker Registry 仓库地址 --source-registry) if [ "$2" ]; then echo "$2" | grep -Eq "\(|\)|\[|\]|\{|\}" if [ $? -eq 0 ]; then command_error "$2" "$(msg "error.cmd.options.validAddress")" else SOURCE_REGISTRY="$(echo "$2" | sed -e 's,^http[s]\?://,,g' -e 's,/$,,')" shift fi else command_error "$1" "$(msg "error.cmd.options.registryAddress")" fi ;; ## 指定 Docker CE 软件源仓库 --branch) if [ "$2" ]; then SOURCE_BRANCH="$2" shift else command_error "$1" "$(msg "error.cmd.options.sourceRepository")" fi ;; ## 指定 Docker CE 软件源仓库版本 --branch-version) if [ "$2" ]; then echo "$2" | grep -Eq "^[0-9]{1,2}$" if [ $? -eq 0 ]; then SOURCE_BRANCH_VERSION="$2" shift else command_error "$2" "$(msg "error.cmd.options.validVersion")" fi else command_error "$1" "$(msg "error.cmd.options.ceRepositoryVersion")" fi ;; ## 指定 Docker Engine 安装版本 --designated-version) if [ "$2" ]; then echo "$2" | grep -Eq "^[0-9][0-9].[0-9]{1,2}.[0-9]{1,2}$" if [ $? -eq 0 ]; then DESIGNATED_DOCKER_VERSION="$2" shift else command_error "$2" "$(msg "error.cmd.options.validVersion")" fi else command_error "$1" "$(msg "error.cmd.options.version")" fi ;; ## 指定 Debian 版本代号 --codename) if [ "$2" ]; then DEBIAN_CODENAME="$2" shift else command_error "$1" "$(msg "error.cmd.options.codename")" fi ;; ## Web 协议(HTTP/HTTPS) --protocol) if [ "$2" ]; then case "$2" in http | https | HTTP | HTTPS) WEB_PROTOCOL="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.protocol")" ;; esac else command_error "$1" "$(msg "error.cmd.options.needProtocol")" fi ;; ## 安装最新版本 --install-latest | --install-latested) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) INSTALL_LATESTED_DOCKER="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.needIntranetSource")" ;; esac else command_error "$1" "$(msg "error.cmd.options.needIntranetSource")" fi ;; ## 关闭防火墙 --close-firewall) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) CLOSE_FIREWALL="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.needIntranetSource")" ;; esac else command_error "$1" "$(msg "error.cmd.options.needIntranetSource")" fi ;; ## 清除屏幕上的所有内容 --clean-screen) if [ "$2" ]; then case "$2" in [Tt]rue | [Ff]alse) CLEAN_SCREEN="${2,,}" shift ;; *) command_error "$2" "$(msg "error.cmd.options.needIntranetSource")" ;; esac else command_error "$1" "$(msg "error.cmd.options.needIntranetSource")" fi ;; ## 仅更换镜像仓库模式 --only-registry) ONLY_REGISTRY="true" ;; ## 纯净模式 --pure-mode) PURE_MODE="true" ;; ## 命令帮助 --help) echo -e "\n$(msg "commands.help" "https://github.com/SuperManito/LinuxMirrors/issues")\n" exit ;; *) command_error "$1" ;; esac shift done ## 设置部分功能的默认值 IGNORE_BACKUP_TIPS="${IGNORE_BACKUP_TIPS:-"false"}" if [[ "${DESIGNATED_DOCKER_VERSION}" ]]; then INSTALL_LATESTED_DOCKER="false" fi PURE_MODE="${PURE_MODE:-"false"}" } function run_start() { :; } function run_end() { if [[ "${PURE_MODE}" == "true" ]]; then echo '' return fi echo -e "\n\033[3;1mPowered by \033[34mLinuxMirrors\033[0m - \033[3mhttps://linuxmirrors.cn\033[0m\n" } function output_error() { [ "$1" ] && echo -e "\n$ERROR $1\n" exit 1 } function command_error() { local tmp_text="$(msg "error.cmd.options.needConfirm")" if [[ "${2}" ]]; then tmp_text="$(msg "error.cmd.options.needSpecify" "${2}")" fi output_error "$(msg "error.cmd.options.invalid" "${BLUE}$1${PLAIN}" "${tmp_text}")" } function unsupport_system_error() { if [[ "${2}" ]]; then output_error "$(msg "error.unsupportSystem2" "${1}")\n\n${BLUE}$2${PLAIN}" else output_error "$(msg "error.unsupportSystem1" "${1}")" fi } function input_error() { echo -e "\n$WARN $(msg "error.input" "${1}")" } function command_exists() { command -v "$@" &>/dev/null } function permission_judgment() { if [ $UID -ne 0 ]; then local change_cmd="su root" if command_exists sudo; then change_cmd="sudo -i" fi output_error "$(msg "error.needRoot" "${BLUE}${change_cmd}${PLAIN}")" fi } function get_os_release_value() { grep -E "^${1}=" $File_LinuxRelease | cut -d= -f2- | sed "s/[\'\"]//g" } function collect_system_info() { if [ ! -s "${File_LinuxRelease}" ]; then unsupport_system_error "$(msg "error.unknownSystem")" fi ## 定义系统名称 SYSTEM_NAME="$(get_os_release_value NAME)" SYSTEM_PRETTY_NAME="$(get_os_release_value PRETTY_NAME)" ## 定义系统版本号 SYSTEM_VERSION_ID="$(get_os_release_value VERSION_ID)" SYSTEM_VERSION_ID_MAJOR="${SYSTEM_VERSION_ID%%.*}" SYSTEM_VERSION_ID_MINOR="${SYSTEM_VERSION_ID#*.}" ## 定义系统ID SYSTEM_ID="$(get_os_release_value ID)" ## 判定当前系统派系 if [ -s "${File_DebianVersion}" ]; then SYSTEM_FACTIONS="${SYSTEM_DEBIAN}" if [ -s "${File_kylinVersion}" ]; then [[ "${ONLY_REGISTRY}" != "true" ]] && unsupport_system_error "Kylin Desktop" "apt-get install -y docker\nsystemctl enable --now docker.io" fi elif [ -s "${File_RedHatRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_REDHAT}" elif [ -s "${File_openEulerRelease}" ] || [ -s "${File_HuaweiCloudEulerOSRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_OPENEULER}" elif [ -s "${File_OpenCloudOSRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_OPENCLOUDOS}" # 自 9.0 版本起不再基于红帽 elif [ -s "${File_AnolisOSRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_ANOLISOS}" # 自 8.8 版本起不再基于红帽 elif [ -s "${File_TencentOSServerRelease}" ]; then SYSTEM_FACTIONS="${SYSTEM_TENCENTOS}" # 自 4 版本起不再基于红帽 elif [ -s "${File_kylinVersion}" ] || [ -s "${File_KylinRelease}" ]; then if [[ "${SYSTEM_ID}" == *"openkylin"* ]]; then SYSTEM_FACTIONS="${SYSTEM_OPENKYLIN}" else SYSTEM_FACTIONS="${SYSTEM_KYLIN_SERVER}" fi elif [ -f "${File_ArchLinuxRelease}" ]; then [[ "${ONLY_REGISTRY}" != "true" ]] && unsupport_system_error "Arch Linux" "pacman -S docker\nsystemctl enable --now docker" elif [ -f "${File_GentooRelease}" ]; then [[ "${ONLY_REGISTRY}" != "true" ]] && unsupport_system_error "Gentoo" elif [[ "${SYSTEM_NAME}" == *"openSUSE"* ]]; then [[ "${ONLY_REGISTRY}" != "true" ]] && unsupport_system_error "openSUSE" "zypper install docker\nsystemctl enable --now docker" elif [[ "${SYSTEM_NAME}" == *"NixOS"* ]]; then [[ "${ONLY_REGISTRY}" != "true" ]] && unsupport_system_error "NixOS" else unsupport_system_error "$(msg "error.unknownSystem")" fi ## 判定系统类型、版本、版本号 case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") if command_exists lsb_release; then SYSTEM_JUDGMENT="$(lsb_release -is)" SYSTEM_VERSION_CODENAME="${DEBIAN_CODENAME:-"$(lsb_release -cs)"}" else ## https://codeberg.org/gioele/lsb-release-minimal SYSTEM_JUDGMENT="${SYSTEM_ID^}" if [ "${SYSTEM_NAME}" ]; then if [[ "${SYSTEM_ID,,}" == "${SYSTEM_NAME,,}" ]]; then SYSTEM_JUDGMENT="${SYSTEM_NAME}" fi fi SYSTEM_VERSION_CODENAME="${DEBIAN_CODENAME:-"$(get_os_release_value VERSION_CODENAME)"}" fi # Raspberry Pi OS if [ -s "${File_RaspberryPiOSRelease}" ]; then SYSTEM_JUDGMENT="${SYSTEM_RASPBERRY_PI_OS}" SYSTEM_PRETTY_NAME="${SYSTEM_RASPBERRY_PI_OS}" fi ;; "${SYSTEM_REDHAT}") SYSTEM_JUDGMENT="$(awk '{printf $1}' $File_RedHatRelease)" ## 特殊系统判断 # Red Hat Enterprise Linux grep -q "${SYSTEM_RHEL}" $File_RedHatRelease && SYSTEM_JUDGMENT="${SYSTEM_RHEL}" # CentOS Stream grep -q "${SYSTEM_CENTOS_STREAM}" $File_RedHatRelease && SYSTEM_JUDGMENT="${SYSTEM_CENTOS_STREAM}" # Oracle Linux [ -s "${File_OracleLinuxRelease}" ] && SYSTEM_JUDGMENT="${SYSTEM_ORACLE}" ;; *) SYSTEM_JUDGMENT="${SYSTEM_FACTIONS}" ;; esac ## 判定系统处理器架构 DEVICE_ARCH_RAW="$(uname -m)" case "${DEVICE_ARCH_RAW}" in x86_64) DEVICE_ARCH="x86_64" ;; aarch64) DEVICE_ARCH="ARM64" ;; armv8l) DEVICE_ARCH="ARMv8_32" ;; armv7l) DEVICE_ARCH="ARMv7" ;; armv6l) DEVICE_ARCH="ARMv6" ;; armv5tel) DEVICE_ARCH="ARMv5" ;; ppc64le) DEVICE_ARCH="ppc64le" ;; s390x) DEVICE_ARCH="s390x" ;; i386 | i686) output_error "$(msg "error.unsupportX86_32")" ;; *) output_error "$(msg "error.unknownArch" "${DEVICE_ARCH_RAW}")" ;; esac ## 定义软件源仓库名称 if [[ -z "${SOURCE_BRANCH}" ]]; then case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") local debian_codename_latest="trixie" case "${SYSTEM_JUDGMENT}" in "${SYSTEM_DEBIAN}") SOURCE_BRANCH="debian" ;; "${SYSTEM_UBUNTU}" | "${SYSTEM_ZORIN}") SOURCE_BRANCH="ubuntu" ;; "${SYSTEM_KALI}") SOURCE_BRANCH="debian" SOURCE_BRANCH_CODENAME="${debian_codename_latest}" ;; "${SYSTEM_LINUX_MINT}") if [[ "${SYSTEM_NAME}" == *"LMDE"* ]]; then SOURCE_BRANCH="debian" SOURCE_BRANCH_CODENAME="$(get_os_release_value DEBIAN_CODENAME)" else SOURCE_BRANCH="ubuntu" SOURCE_BRANCH_CODENAME="$(get_os_release_value UBUNTU_CODENAME)" fi if [[ -z "${SOURCE_BRANCH_CODENAME}" ]]; then SOURCE_BRANCH="debian" SOURCE_BRANCH_CODENAME="bookworm" fi ;; "${SYSTEM_RASPBERRY_PI_OS}") case "${DEVICE_ARCH_RAW}" in x86_64 | aarch64) SOURCE_BRANCH="debian" ;; *) # 注:自 Docker 29 版本起将不再提供此分支仓库 SOURCE_BRANCH="raspbian" ;; esac ;; # "${SYSTEM_KYLIN_DESKTOP}") # SOURCE_BRANCH="ubuntu" # case "${SYSTEM_VERSION_ID_MAJOR}" in # "v10") # SOURCE_BRANCH_CODENAME="focal" # ;; # "v11") # SOURCE_BRANCH_CODENAME="noble" # ;; # *) # SOURCE_BRANCH_CODENAME="noble" # ;; # esac # ;; "${SYSTEM_OPENKYLIN}") SOURCE_BRANCH="debian" SOURCE_BRANCH_CODENAME="${debian_codename_latest}" ;; *) # 其余 Debian 系衍生操作系统 SOURCE_BRANCH="debian" SOURCE_BRANCH_CODENAME="bookworm" ;; esac ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") case "${SYSTEM_JUDGMENT}" in "${SYSTEM_FEDORA}") SOURCE_BRANCH="fedora" ;; "${SYSTEM_RHEL}") SOURCE_BRANCH="rhel" ;; *) SOURCE_BRANCH="centos" ;; esac if [[ "${DEVICE_ARCH_RAW}" == "s390x" ]]; then output_error "$(msg "error.unsupportS390x")" fi ;; esac fi ## 定义软件源更新文字 case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") SYNC_MIRROR_TEXT="$(msg "source.sync.text1")" ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") SYNC_MIRROR_TEXT="$(msg "source.sync.text2")" ;; esac ## 判断是否可以使用高级交互式选择器 CAN_USE_ADVANCED_INTERACTIVE_SELECTION="false" if command_exists tput; then CAN_USE_ADVANCED_INTERACTIVE_SELECTION="true" fi } function choose_display_language() { :; } function choose_mirrors() { :; } function choose_protocol() { :; } ## 关闭防火墙和SELinux function close_firewall_service() { if ! command_exists systemctl; then return fi if [[ "$(systemctl is-active firewalld)" == "active" ]]; then if [[ -z "${CLOSE_FIREWALL}" ]]; then local ask_text="$(msg "interaction.firewall.close")?" if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then echo '' interactive_select_boolean "${BOLD}${ask_text}${PLAIN}" if [[ "${_SELECT_RESULT}" == "true" ]]; then CLOSE_FIREWALL="true" fi else local CHOICE="$(echo -e "\n${BOLD}└─ ${ask_text} [Y/n] ${PLAIN}")" read -rp "${CHOICE}" INPUT [[ -z "${INPUT}" ]] && INPUT=Y case "${INPUT}" in [Yy] | [Yy][Ee][Ss]) CLOSE_FIREWALL="true" ;; [Nn] | [Nn][Oo]) ;; *) input_error "$(msg "error.defaultBehavior.noClose")" ;; esac fi fi if [[ "${CLOSE_FIREWALL}" == "true" ]]; then local SelinuxConfig=/etc/selinux/config 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 fi fi } ## 安装环境包 function install_dependency_packages() { local commands package_manager ## 删除原有源 case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") sed -i '/docker-ce/d' $File_AptSourceList rm -rf $File_DockerSourceList ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") rm -rf $Dir_YumRepos/*docker*.repo ;; esac ## 更新软件源 commands=() case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") package_manager="apt-get" commands+=("${package_manager} update") ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") package_manager="$(get_package_manager)" commands+=("${package_manager} makecache") ;; esac if [[ "${PURE_MODE}" == "true" ]]; then local exec_cmd="" for cmd in "${commands[@]}"; do if [[ -z "${exec_cmd}" ]]; then exec_cmd="${cmd}" else exec_cmd="${exec_cmd} ; ${cmd}" fi done echo '' animate_exec "${exec_cmd}" "${SYNC_MIRROR_TEXT}" else echo '' for cmd in "${commands[@]}"; do eval "${cmd}" done fi if [ $? -ne 0 ]; then output_error "$(msg "error.sync" "${SYNC_MIRROR_TEXT}" "${BLUE}${package_manager}${PLAIN}")" fi commands=() case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") commands+=("${package_manager} install -y ca-certificates curl") ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") case "${SYSTEM_VERSION_ID_MAJOR}" in 7) commands+=("${package_manager} install -y yum-utils device-mapper-persistent-data lvm2") ;; *) if [[ "${package_manager}" == "dnf" ]]; then commands+=("${package_manager} install -y dnf-plugins-core") else commands+=("${package_manager} install -y yum-utils device-mapper-persistent-data lvm2") fi ;; esac ;; esac if [[ "${PURE_MODE}" == "true" ]]; then local exec_cmd="" for cmd in "${commands[@]}"; do if [[ -z "${exec_cmd}" ]]; then exec_cmd="${cmd}" else exec_cmd="${exec_cmd} ; ${cmd}" fi done echo '' animate_exec "${exec_cmd}" "$(msg "work.installDependents")" else for cmd in "${commands[@]}"; do eval "${cmd}" done fi } ## 配置 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}") ## 处理 GPG 密钥 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 # 删除旧的密钥 [ -f "${file_keyring}" ] && rm -rf $file_keyring install -m 0755 -d /etc/apt/keyrings curl -fsSL "${WEB_PROTOCOL}://${SOURCE}/linux/${SOURCE_BRANCH}/gpg" -o $file_keyring >/dev/null if [ $? -ne 0 ]; then output_error "$(msg "error.downloadGPG")" fi chmod a+r $file_keyring ## 添加源 [ -d "${Dir_AptAdditionalSources}" ] || mkdir -p $Dir_AptAdditionalSources local apt_source_content="deb [arch=$(dpkg --print-architecture) signed-by=${file_keyring}] ${WEB_PROTOCOL}://${SOURCE}/linux/${SOURCE_BRANCH} ${DEBIAN_CODENAME:-${SOURCE_BRANCH_CODENAME:-${SYSTEM_VERSION_CODENAME}}} stable" echo "${apt_source_content}" | tee $File_DockerSourceList >/dev/null 2>&1 commands+=("apt-get update") ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") local repo_file_url="${WEB_PROTOCOL}://${SOURCE}/linux/${SOURCE_BRANCH}/docker-ce.repo" local package_manager="$(get_package_manager)" case "${SYSTEM_VERSION_ID_MAJOR}" in 7) yum-config-manager -y --add-repo "${repo_file_url}" ;; *) if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_FEDORA}" ]]; then dnf-3 config-manager -y --add-repo "${repo_file_url}" else if [[ "${package_manager}" == "dnf" ]]; then dnf config-manager -y --add-repo "${repo_file_url}" else yum-config-manager -y --add-repo "${repo_file_url}" fi fi ;; esac sed -e "s|https://download.docker.com|${WEB_PROTOCOL}://${SOURCE}|g" \ -e "s|http[s]\?://.*/linux/${SOURCE_BRANCH}/|${WEB_PROTOCOL}://${SOURCE}/linux/${SOURCE_BRANCH}/|g" \ -i \ $File_DockerRepo ## 处理版本号 if [[ "${SOURCE_BRANCH_VERSION}" ]]; then # 指定版本 sed -e "s|\$releasever|${SOURCE_BRANCH_VERSION}|g" \ -i \ $File_DockerRepo commands+=("${package_manager} makecache") elif [[ "${SYSTEM_JUDGMENT}" != "${SYSTEM_FEDORA}" ]]; then # 兼容处理 local target_version case "${SYSTEM_VERSION_ID_MAJOR}" in 7 | 8 | 9 | 10) target_version="${SYSTEM_VERSION_ID_MAJOR}" ;; *) target_version="8" # 注:部分系统使用9版本分支会有兼容性问题 ## 适配国产操作系统 # OpenCloudOS、Anolis OS 的 23 版本 if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_OPENCLOUDOS}" || "${SYSTEM_JUDGMENT}" == "${SYSTEM_ANOLISOS}" ]]; then if [[ "${SYSTEM_VERSION_ID_MAJOR}" == 23 ]]; then target_version="9" fi fi if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_OPENEULER}" ]]; then if [ -s "${File_HuaweiCloudEulerOSRelease}" ]; then # Huawei Cloud EulerOS case "${SYSTEM_VERSION_ID_MAJOR}" in 1) target_version="8" # openEuler 20 ;; 2) target_version="9" # openEuler 22 ;; esac else # openEuler if [[ "${SYSTEM_VERSION_ID_MAJOR}" -ge 24 ]]; then target_version="10" elif [[ "${SYSTEM_VERSION_ID_MAJOR}" -gt 22 ]]; then target_version="9" fi fi fi # TencentOS Server if [ -s "${File_TencentOSServerRelease}" ]; then case "${SYSTEM_VERSION_ID_MAJOR}" in 4) target_version="9" ;; 3) target_version="8" ;; 2) target_version="7" ;; esac fi # Alibaba Cloud Linux if [ -s "${File_AnolisOSRelease}" ] && [ -s "${File_AlibabaCloudLinuxRelease}" ]; then case "${SYSTEM_VERSION_ID_MAJOR}" in 3) target_version="8" ;; 2) target_version="7" ;; esac fi if [[ "${SYSTEM_JUDGMENT}" == "${SYSTEM_KYLIN_SERVER}" ]]; then case "${SYSTEM_VERSION_ID_MAJOR}" in "V10") target_version="8" ;; "V11") target_version="10" ;; *) target_version="10" ;; esac fi ;; esac sed -e "s|\$releasever|${target_version}|g" \ -i \ $File_DockerRepo commands+=("${package_manager} makecache") fi ;; esac if [[ "${PURE_MODE}" == "true" ]]; then local exec_cmd="" for cmd in "${commands[@]}"; do if [[ -z "${exec_cmd}" ]]; then exec_cmd="${cmd}" else exec_cmd="${exec_cmd} ; ${cmd}" fi done echo '' animate_exec "${exec_cmd}" "${SYNC_MIRROR_TEXT}" else for cmd in "${commands[@]}"; do eval "${cmd}" done fi } ## 安装 Docker Engine function install_docker_engine() { ## 导出可安装的版本列表 function export_version_list() { case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") apt-cache madison docker-ce | awk '{print $3}' | grep -Eo "[0-9][0-9].[0-9]{1,2}.[0-9]{1,2}" >$File_DockerCEVersionTmp apt-cache madison docker-ce-cli | awk '{print $3}' | grep -Eo "[0-9][0-9].[0-9]{1,2}.[0-9]{1,2}" >$File_DockerCECliVersionTmp grep -wf $File_DockerCEVersionTmp $File_DockerCECliVersionTmp >$File_DockerVersionTmp ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") local package_manager="$(get_package_manager)" $package_manager list docker-ce --showduplicates | sort -r | awk '{print $2}' | grep -Eo "[0-9][0-9].[0-9]{1,2}.[0-9]{1,2}" >$File_DockerCEVersionTmp $package_manager list docker-ce-cli --showduplicates | sort -r | awk '{print $2}' | grep -Eo "[0-9][0-9].[0-9]{1,2}.[0-9]{1,2}" >$File_DockerCECliVersionTmp grep -wf $File_DockerCEVersionTmp $File_DockerCECliVersionTmp >$File_DockerVersionTmp ;; esac rm -rf $File_DockerCEVersionTmp $File_DockerCECliVersionTmp } ## 卸载 Docker Engine 原有版本软件包 function uninstall_original_version() { if command_exists docker; then # 先停止并禁用 Docker 服务 systemctl disable --now docker >/dev/null 2>&1 sleep 2s fi # 确定需要卸载的软件包 local package_list case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") package_list='docker* podman podman-docker containerd runc' ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") package_list='docker* podman podman-docker runc' ;; esac # 卸载软件包并清理残留 case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") apt-get remove -y $package_list >/dev/null 2>&1 apt-get autoremove -y >/dev/null 2>&1 ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") local package_manager="$(get_package_manager)" $package_manager remove -y $package_list >/dev/null 2>&1 $package_manager autoremove -y >/dev/null 2>&1 ;; esac } ## 安装 function install_main() { local target_docker_version local pkgs="" local -a commands=() if [[ "${INSTALL_LATESTED_DOCKER}" == "true" ]]; then pkgs="docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin" else export_version_list if [ ! -s "${File_DockerVersionTmp}" ]; then rm -rf $File_DockerVersionTmp output_error "$(msg "error.queryVersionFailed")" fi if [[ "${DESIGNATED_DOCKER_VERSION}" ]]; then cat $File_DockerVersionTmp | grep -Eq "^${DESIGNATED_DOCKER_VERSION}$" if [ $? -ne 0 ]; then rm -rf $File_DockerVersionTmp output_error "$(msg "error.designatedVersion")" fi target_docker_version="${DESIGNATED_DOCKER_VERSION}" else if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then local -a version_list=( $(cat $File_DockerVersionTmp | sort -t '.' -k1,1nr -k2,2nr -k3,3nr | tr '\n' ' ' | sed 's/ $//') ) local mirror_list_name="version_list" interactive_select_list "${mirror_list_name}" "\n ${BOLD}$(msg "interaction.install.selectVersion")${PLAIN}\n" target_docker_version="${_SELECT_RESULT}" echo -e "\n${GREEN}➜${PLAIN} ${BOLD}$(msg "interaction.install.selectedVersion")${target_docker_version}${PLAIN}\n" else echo -e "\n${GREEN} --------- $(msg "interaction.install.selectedTitle" "28.3.0") ---------- ${PLAIN}\n" cat $File_DockerVersionTmp while true; do local CHOICE="$(echo -e "\n${BOLD}└─ $(msg "interaction.install.inputVersion")${PLAIN}\n")" read -rp "${CHOICE}" target_docker_version echo '' cat $File_DockerVersionTmp | grep -Eqw "${target_docker_version}" if [ $? -eq 0 ]; then echo "${target_docker_version}" | grep -Eqw '[0-9][0-9].[0-9]{1,2}.[0-9]{1,2}' if [ $? -eq 0 ]; then break else echo -e "$ERROR $(msg "error.invalidVersion")" fi else echo -e "$ERROR $(msg "error.reEnter")" fi done fi fi rm -rf $File_DockerVersionTmp local major_version="$(echo ${target_docker_version} | cut -d'.' -f1)" local minor_version="$(echo ${target_docker_version} | cut -d'.' -f2)" case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") if [[ $major_version -gt 18 ]] || [[ $major_version -eq 18 && $minor_version -ge 9 ]]; then local tmp_version="$(apt-cache madison docker-ce-cli | grep "${target_docker_version}" | head -1 | awk '{print $3}' | awk -F "${target_docker_version}" '{print$1}')" pkgs="docker-ce=${tmp_version}${target_docker_version}* docker-ce-cli=${tmp_version}${target_docker_version}*" else pkgs="docker-ce=${target_docker_version}* docker-ce-cli=${target_docker_version}*" fi ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") pkgs="docker-ce-${target_docker_version}" if [[ $major_version -gt 18 ]] || [[ $major_version -eq 18 && $minor_version -ge 9 ]]; then pkgs="${pkgs} docker-ce-cli-${target_docker_version}" fi ;; esac pkgs="${pkgs} containerd.io" if [[ $major_version -gt 20 ]] || [[ $major_version -eq 20 && $minor_version -ge 10 ]]; then pkgs="${pkgs} docker-compose-plugin" fi if [[ $major_version -ge 23 ]]; then pkgs="${pkgs} docker-buildx-plugin" fi fi case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") commands+=("apt-get install -y ${pkgs}") ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") commands+=("$(get_package_manager) install -y ${pkgs}") ;; esac echo '' if [[ "${PURE_MODE}" == "true" ]]; then local exec_cmd="" for cmd in "${commands[@]}"; do if [[ -z "${exec_cmd}" ]]; then exec_cmd="${cmd}" else exec_cmd="${exec_cmd} ; ${cmd}" fi done animate_exec "${exec_cmd}" "$(msg "work.installDockerEngine")" else for cmd in "${commands[@]}"; do eval "${cmd}" done fi [ $? -ne 0 ] && output_error "$(msg "error.installDockerEngineFailed")" } ## 判断是否手动选择安装版本 if [[ -z "${INSTALL_LATESTED_DOCKER}" ]]; then local ask_text="$(msg "interaction.install.latestVersion")?" if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then echo '' interactive_select_boolean "${BOLD}${ask_text}${PLAIN}" if [[ "${_SELECT_RESULT}" == "true" ]]; then INSTALL_LATESTED_DOCKER="true" else INSTALL_LATESTED_DOCKER="false" fi else local CHOICE_A="$(echo -e "\n${BOLD}└─ ${ask_text} [Y/n] ${PLAIN}")" read -rp "${CHOICE_A}" INPUT [[ -z "${INPUT}" ]] && INPUT=Y case $INPUT in [Yy] | [Yy][Ee][Ss]) INSTALL_LATESTED_DOCKER="true" ;; [Nn] | [Nn][Oo]) INSTALL_LATESTED_DOCKER="false" ;; *) INSTALL_LATESTED_DOCKER="true" input_error "$(msg "error.defaultBehavior.installLatest")" ;; esac fi fi ## 判定是否已安装 case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") dpkg -l | grep docker-ce-cli -q ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") rpm -qa | grep docker-ce-cli -q ;; esac if [ $? -eq 0 ]; then export_version_list local current_docker_version="$(docker -v | grep -Eo "[0-9][0-9]\.[0-9]{1,2}\.[0-9]{1,2}")" local latest_docker_version="$(cat $File_DockerVersionTmp | head -n 1)" rm -rf $File_DockerVersionTmp if [[ "${current_docker_version}" == "${latest_docker_version}" ]] && [[ "${INSTALL_LATESTED_DOCKER}" == "true" ]]; then echo -e "\n$TIP $(msg "tip.skipInstallDockerEngine")" else uninstall_original_version install_main fi else uninstall_original_version install_main fi } ## 修改 Docker Registry 镜像仓库源 function change_docker_registry_mirror() { if [[ -z "${SOURCE_REGISTRY}" ]]; then SOURCE_REGISTRY="registry.hub.docker.com" fi ## 使用官方 Docker Hub if [[ "${SOURCE_REGISTRY}" == "registry.hub.docker.com" ]]; then if [ -s "${File_DockerConfig}" ]; then ## 安装 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 systemctl restart docker fi else echo -e "\n${WARN} $(msg "warn.needManuallyDeleteConfig" "${File_DockerConfig}" "${BLUE}registry-mirrors${PLAIN}" "${BLUE}systemctl daemon-reload && systemctl restart docker${PLAIN}")\n" fi fi return fi ## 备份原有配置文件 if [ -d "${Dir_Docker}" ] && [ -e "${File_DockerConfig}" ]; then if [ -e "${File_DockerConfigBackup}" ]; then if [[ "${IGNORE_BACKUP_TIPS}" == "false" ]]; then local ask_text="$(msg "interaction.backup.skipOverwrite")?" if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then echo '' interactive_select_boolean "${BOLD}${ask_text}${PLAIN}" if [[ "${_SELECT_RESULT}" == "false" ]]; then echo '' cp -rvf $File_DockerConfig $File_DockerConfigBackup 2>&1 fi else local CHOICE_BACKUP="$(echo -e "\n${BOLD}└─ ${ask_text} [Y/n] ${PLAIN}")" read -rp "${CHOICE_BACKUP}" INPUT [[ -z "${INPUT}" ]] && INPUT=Y case $INPUT in [Yy] | [Yy][Ee][Ss]) ;; [Nn] | [Nn][Oo]) echo '' cp -rvf $File_DockerConfig $File_DockerConfigBackup 2>&1 ;; *) input_error "$(msg "error.defaultBehavior.noOverwrite")" ;; esac fi fi else echo '' cp -rvf $File_DockerConfig $File_DockerConfigBackup 2>&1 echo -e "\n$COMPLETE $(msg "info.backuped.dockerConfig")" fi sleep 2s else mkdir -p $Dir_Docker >/dev/null 2>&1 touch $File_DockerConfig fi echo -e '{\n "registry-mirrors": '"$(handleRegistryMirrorsValue ${SOURCE_REGISTRY})"'\n}' >$File_DockerConfig ## 重启服务 systemctl daemon-reload if [[ "$(systemctl is-active docker 2>/dev/null)" == "active" ]]; then systemctl restart docker fi } ## 仅修改 Docker Registry 镜像仓库源模式 function only_change_docker_registry_mirror() { ## 判定是否已安装 case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") dpkg -l | grep docker-ce-cli -q ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") rpm -qa | grep docker-ce-cli -q ;; esac if [ $? -ne 0 ]; then ## 仅镜像仓库换源模式 if [[ "${ONLY_REGISTRY}" == "true" ]]; then output_error "$(msg "result.registry.dockerEngineNotExsit" "${BLUE}--only-registry${PLAIN}")" fi fi [ -d "${Dir_Docker}" ] || mkdir -p "${Dir_Docker}" if [ -s "${File_DockerConfig}" ]; then ## 安装 jq if ! command_exists jq; then ## 更新软件源 local package_manager local -a commands=() case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") package_manager="apt-get" commands+=("${package_manager} update") ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") package_manager="$(get_package_manager)" commands+=("${package_manager} makecache") ;; esac if [[ "${PURE_MODE}" == "true" ]]; then local exec_cmd="" for cmd in "${commands[@]}"; do if [[ -z "${exec_cmd}" ]]; then exec_cmd="${cmd}" else exec_cmd="${exec_cmd} ; ${cmd}" fi done echo '' animate_exec "${exec_cmd}" "${SYNC_MIRROR_TEXT}" else echo '' for cmd in "${commands[@]}"; do eval "${cmd}" done fi if [ $? -ne 0 ]; then output_error "$(msg "error.sync" "${SYNC_MIRROR_TEXT}" "${BLUE}${package_manager}${PLAIN}")" fi $package_manager install -y jq if ! command_exists jq; then output_error "$(msg "error.installPackageFailed" "${BLUE}jq${PLAIN}")" fi fi [ -s "${File_DockerConfig}" ] || echo "{}" >$File_DockerConfig jq '.["registry-mirrors"] = '"$(handleRegistryMirrorsValue ${SOURCE_REGISTRY})"'' $File_DockerConfig >$File_DockerConfig.tmp && mv $File_DockerConfig.tmp $File_DockerConfig else echo -e '{\n "registry-mirrors": '"$(handleRegistryMirrorsValue ${SOURCE_REGISTRY})"'\n}' >$File_DockerConfig fi ## 重启服务 systemctl daemon-reload if [[ "$(systemctl is-active docker 2>/dev/null)" == "active" ]]; then systemctl restart docker fi echo -e "\n${BLUE}\$${PLAIN} docker info --format '{{json .RegistryConfig.Mirrors}}'" echo -e "\033[2m>${PLAIN} $(docker info --format '{{json .RegistryConfig.Mirrors}}')" if [[ "${PURE_MODE}" != "true" ]]; then echo -e "\n$COMPLETE $(msg "result.registry.success")" fi } function handleRegistryMirrorsValue() { local content="$1" local result="" content="$(echo "${content}" | sed 's| ||g')" local -a items=(${content//,/ }) for item in "${items[@]}"; do [[ -z "${item}" ]] && continue if [[ -z "${result}" ]]; then result='"https://'"${item}"'"' else result="${result},\"https://${item}\"" fi done if [[ "${result}" ]]; then echo "[${result}]" else echo "" fi } ## 查看版本并验证安装结果 function check_installed_result() { if command_exists docker; then systemctl enable --now docker >/dev/null 2>&1 echo -en "\n$COMPLETE " docker -v if [ $? -eq 0 ]; then echo -e " $(docker compose version 2>&1)" # echo -e "\n$COMPLETE 安装完成" else echo -e "\n$FAIL $(msg "result.install.failed")" local source_file package_manager case "${SYSTEM_FACTIONS}" in "${SYSTEM_DEBIAN}" | "${SYSTEM_OPENKYLIN}") source_file="${File_DockerSourceList}" package_manager="apt-get" ;; "${SYSTEM_REDHAT}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") source_file="${File_DockerRepo}" package_manager="$(get_package_manager)" ;; esac echo -e "\n$(msg "result.install.checkSourceFile" "cat ${source_file}")" echo -e "$(msg "result.install.manuallyExecCmd" "${package_manager} install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin")\n" exit 1 fi if [[ "$(systemctl is-active docker 2>/dev/null)" != "active" ]]; then sleep 2 systemctl disable --now docker >/dev/null 2>&1 sleep 2 systemctl enable --now docker >/dev/null 2>&1 sleep 2 if [[ "$(systemctl is-active docker)" != "active" ]]; then echo -e "\n$WARN $(msg "result.install.notRunning")" local start_cmd if command_exists systemctl; then start_cmd="systemctl start docker" else start_cmd="service docker start" fi echo -e "\n$TIP $(msg "result.install.manuallyRun" "${BLUE}${start_cmd}${PLAIN}")" fi fi else echo -e "\n$FAIL $(msg "result.install.failed")" fi } ## 选择系统包管理器 function get_package_manager() { local command="yum" case "${SYSTEM_JUDGMENT}" in "${SYSTEM_RHEL}" | "${SYSTEM_CENTOS_STREAM}" | "${SYSTEM_ROCKY}" | "${SYSTEM_ALMALINUX}" | "${SYSTEM_ORACLE}") case "${SYSTEM_VERSION_ID_MAJOR}" in 9 | 10) command="dnf" ;; esac ;; "${SYSTEM_FEDORA}" | "${SYSTEM_OPENEULER}" | "${SYSTEM_OPENCLOUDOS}" | "${SYSTEM_ANOLISOS}" | "${SYSTEM_TENCENTOS}" | "${SYSTEM_KYLIN_SERVER}") command="dnf" ;; esac echo "${command}" } function interactive_select_list() { _SELECT_RESULT="" eval "local -a __values=(\"\${${1}[@]}\")" local -a __labels=() local message="${2}" local selected=0 local start=0 local page_size=$(($(tput lines 2>/dev/null) - 3)) if [[ "${3}" ]]; then eval "__labels=(\"\${${3}[@]}\")" fi function clear_menu() { tput rc 2>/dev/null for ((i = 0; i < ${#__values[@]} + 1; i++)); do echo -e "\r\033[K" done tput rc 2>/dev/null } function cleanup() { clear_menu tput rc 2>/dev/null tput cnorm 2>/dev/null tput rmcup 2>/dev/null echo -e "\n\033[1;44m $(msg "interaction.common.tip") \033[0m \033[31m$(msg "interaction.common.operationCanceled")\033[0m\n" exit 130 } function draw_menu() { tput clear 2>/dev/null tput cup 0 0 2>/dev/null echo -e "${message}" local end=$((start + page_size - 1)) local label if [ $end -ge ${#__values[@]} ]; then end=${#__values[@]}-1 fi for ((i = start; i <= end; i++)); do if [[ "${__labels[$i]}" ]]; then label="${__labels[$i]}" else label="${__values[$i]}" fi if [ "$i" -eq "${selected}" ]; then echo -e "\e[34;4m➤ ${label}\e[0m" else echo -e " ${label}" fi done } function read_key() { IFS= read -rsn1 key if [[ $key == $'\x1b' ]]; then IFS= read -rsn2 key key="$key" fi echo "$key" } tput smcup 2>/dev/null tput sc 2>/dev/null tput civis 2>/dev/null trap "cleanup" INT TERM draw_menu while true; do key=$(read_key) case "$key" in "[A" | "w" | "W") if [ "${selected}" -gt 0 ]; then selected=$((selected - 1)) if [ "${selected}" -lt "$start" ]; then start=$((start - 1)) fi fi ;; "[B" | "s" | "S") if [ "${selected}" -lt $((${#__values[@]} - 1)) ]; then selected=$((selected + 1)) if [ "${selected}" -ge $((start + page_size)) ]; then start=$((start + 1)) fi fi ;; "") tput rmcup break ;; *) ;; esac draw_menu done tput cnorm 2>/dev/null tput rmcup 2>/dev/null _SELECT_RESULT="${__values[${selected}]}" if [ "${__labels[${selected}]}" ]; then _SELECT_RESULT="${_SELECT_RESULT}@@${__labels[${selected}]}" fi } function interactive_select_boolean() { _SELECT_RESULT="" local selected=0 local message="$1" local positive_title="${2:-"$(msg "interaction.common.yes")"}" local negative_title="${3:-"$(msg "interaction.common.no")"}" local menu_height=3 local original_line function store_position() { original_line=$(tput lines 2>/dev/null) } function clear_menu() { for ((i = 0; i < $menu_height; i++)); do tput cuu1 2>/dev/null tput el 2>/dev/null done } function cleanup() { clear_menu tput cnorm 2>/dev/null echo -e "\n\033[1;44m $(msg "interaction.common.tip") \033[0m \033[31m$(msg "interaction.common.operationCanceled")\033[0m\n" exit 130 } function draw_menu() { echo -e "╭─ ${message}" echo -e "│" if [ "${selected}" -eq 0 ]; then echo -e "╰─ \033[34m●\033[0m ${positive_title}\033[2m / ○ ${negative_title}\033[0m" else echo -e "╰─ \033[2m○ ${positive_title} / \033[0m\033[34m●\033[0m ${negative_title}" fi } function read_key() { IFS= read -rsn1 key if [[ $key == $'\x1b' ]]; then IFS= read -rsn2 key key="$key" fi echo "$key" } tput civis 2>/dev/null store_position trap "cleanup" INT TERM draw_menu while true; do key=$(read_key) case "$key" in "[D" | "a" | "A") if [ "${selected}" -gt 0 ]; then selected=$((selected - 1)) clear_menu draw_menu fi ;; "[C" | "d" | "D") if [ "${selected}" -lt 1 ]; then selected=$((selected + 1)) clear_menu draw_menu fi ;; "") clear_menu break ;; *) ;; esac done echo -e "╭─ ${message}" echo -e "│" if [ "${selected}" -eq 0 ]; then echo -e "╰─ \033[32m●\033[0m \033[1m${positive_title}\033[0m\033[2m / ○ ${negative_title}\033[0m" _SELECT_RESULT="true" else echo -e "╰─ \033[2m○ ${positive_title} / \033[0m\033[32m●\033[0m \033[1m${negative_title}\033[0m" _SELECT_RESULT="false" fi tput cnorm 2>/dev/null } function animate_exec() { local cmd="$1" local title="$2" local max_lines=${3:-5} local spinner_style="${4:-dots}" local refresh_rate="${5:-0.1}" local scroll_mode="${6:-1}" if [[ "${scroll_mode}" == "0" ]]; then echo -e "◉ ${title} \n" eval "${cmd}" return $? fi local -A spinners=([dots]="⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏" [circle]="◐ ◓ ◑ ◒" [classic]="-\\ |/") local -A recommended_rates=([dots]="0.08" [circle]="0.12" [classic]="0.12") [[ -z "${spinners[$spinner_style]}" ]] && spinner_style="dots" [[ "${refresh_rate}" == "0.1" ]] && refresh_rate="${recommended_rates[$spinner_style]}" local term_width=$(tput cols 2>/dev/null || echo 80) local display_width=$((term_width - 2)) function simple_truncate() { local line="$1" local truncate_marker="..." local max_length=$((display_width - 3)) if [[ "${line}" =~ ^[[:ascii:]]*$ && ${#line} -le $display_width ]]; then echo "${line}" return fi local non_ascii_count=$(echo "${line}" | sed "s|[0-9a-zA-Z -~]||g; s| ||g" | wc -m) local total_length=${#line} local display_length=$((total_length + non_ascii_count)) local quote_count=0 [[ $(echo "${line}" | grep -c "“") -gt 0 ]] && ((quote_count += "$(echo "${line}" | grep -c "“")")) [[ $(echo "${line}" | grep -c "”") -gt 0 ]] && ((quote_count += "$(echo "${line}" | grep -c "”")")) [[ $(echo "${line}" | grep -c "‘") -gt 0 ]] && ((quote_count += "$(echo "${line}" | grep -c "‘")")) [[ $(echo "${line}" | grep -c "’") -gt 0 ]] && ((quote_count += "$(echo "${line}" | grep -c "’")")) display_length=$((display_length - quote_count)) if [[ $display_length -le $display_width ]]; then echo "$line" return fi local result="" local current_width=0 local i=0 while [ $i -lt ${#line} ]; do local char="${line:$i:1}" local char_width=1 if ! [[ "$char" =~ [0-9a-zA-Z\.\=\:\_\(\)\'\"\-\/\!\·] ]]; then if [[ "$char" != "“" && "$char" != "”" && "$char" != "‘" && "$char" != "’" ]]; then char_width=2 fi fi if [[ $((current_width + char_width)) -gt $max_length ]]; then echo "${result}${truncate_marker}" return fi result+="${char}" current_width=$((current_width + char_width)) ((i++)) done echo "${line}" } function cleanup() { [ -f "${temp_file}" ] && rm -f "${temp_file}" tput cnorm 2>/dev/null echo -e "\n\033[1;44m $(msg "interaction.common.tip") \033[0m \033[31m$(msg "interaction.common.operationCanceled")\033[0m\n" exit 130 } function make_temp_file() { local -a temp_dirs=("." "/tmp") local tmp_file="" for dir in "${temp_dirs[@]}"; do [[ ! -d "${dir}" || ! -w "${dir}" ]] && continue tmp_file="${dir}/animate_exec_$$_$(date +%s)" touch "${tmp_file}" 2>/dev/null || continue if [[ -f "${tmp_file}" && -w "${tmp_file}" ]]; then echo "${tmp_file}" return fi done echo "${tmp_file}" } function update_display() { local current_size=$(wc -c <"${temp_file}" 2>/dev/null || echo 0) if [[ $current_size -le $last_size ]]; then return 1 fi local -a lines=() mapfile -t -n "${max_lines}" lines < <(tail -n "$max_lines" "${temp_file}") local -a processed_lines=() for ((i = 0; i < ${#lines[@]}; i++)); do processed_lines[i]=$(simple_truncate "${lines[i]}") done tput cud1 2>/dev/null echo -ne "\r\033[K" tput cud1 2>/dev/null for ((i = 0; i < $max_lines; i++)); do echo -ne "\r\033[K" [[ $i -lt ${#processed_lines[@]} ]] && echo -ne "\033[2m${processed_lines[$i]}\033[0m" [[ $i -lt $((max_lines - 1)) ]] && tput cud1 2>/dev/null done for ((i = 0; i < $max_lines + 1; i++)); do tput cuu1 2>/dev/null done last_size=$current_size return 0 } local spinner_frames=(${spinners[$spinner_style]}) local temp_file="$(make_temp_file)" trap "cleanup" INT TERM tput civis 2>/dev/null echo '' echo '' for ((i = 0; i < $max_lines; i++)); do echo '' done eval "${cmd}" >"${temp_file}" 2>&1 & local cmd_pid=$! local last_size=0 local spin_idx=0 tput cuu $((max_lines + 2)) 2>/dev/null sleep 0.05 echo -ne "\r\033[K◉ ${title} [\033[1m\033[34m${spinner_frames[$spin_idx]}\033[0m]" spin_idx=$(((spin_idx + 1) % ${#spinner_frames[@]})) update_display local update_count=0 local adaptive_rate=$refresh_rate while kill -0 $cmd_pid 2>/dev/null; do echo -ne "\r\033[K◉ ${title} [\033[1m\033[34m${spinner_frames[$spin_idx]}\033[0m]" spin_idx=$(((spin_idx + 1) % ${#spinner_frames[@]})) if update_display; then update_count=$((update_count + 1)) if [[ $update_count -gt 5 ]]; then adaptive_rate=$(awk "BEGIN {print $adaptive_rate * 1.5; exit}") [[ $(awk "BEGIN {print ($adaptive_rate > 0.5); exit}") -eq 1 ]] && adaptive_rate=0.5 update_count=0 fi else update_count=0 adaptive_rate=$refresh_rate fi sleep $adaptive_rate done wait $cmd_pid local exit_status=$? update_display if [ $exit_status -eq 0 ]; then echo -ne "\r\033[K◉ ${title} [\033[1m\033[32m✓\033[0m]\n" else echo -ne "\r\033[K◉ ${title} [\033[1m\033[31m✗\033[0m]\n" fi echo -ne "\r\033[K\n" local actual_lines=$(wc -l <"${temp_file}" 2>/dev/null || echo 0) [[ $actual_lines -gt $max_lines ]] && actual_lines=$max_lines if [[ $actual_lines -gt 0 ]]; then local -a final_lines=() mapfile -t -n "$actual_lines" final_lines < <(tail -n "$actual_lines" "${temp_file}") for ((i = 0; i < actual_lines; i++)); do local line=$(simple_truncate "${final_lines[$i]}") echo -ne "\r\033[K\033[2m${line}\033[0m\n" done fi tput cnorm 2>/dev/null rm -f "${temp_file}" return $exit_status } ############################################################################## MESSAGE_LANG_DEFAULT='en' MESSAGE_LANG_KEYS=( "en" ) declare -A MESSAGE_LANG_DISPLAY=( ['en']='English' ) declare -A MESSAGE_CONTENTS function msg() { local key="$1" shift local text="${MESSAGE_CONTENTS[${key}]}" if [[ -z "${text}" ]]; then echo "${key}" return fi while [[ $# -gt 0 ]]; do if [[ "${text}" == *"{}"* ]]; then text="${text/\{\}/$1}" else break fi shift done echo "${text}" } function init_msg_pack() { function load_pack() { local func_name="${1}" if declare -f "${func_name}" >/dev/null 2>&1; then eval "${func_name}" fi } local current_lang="${1:-${MESSAGE_LANG_DEFAULT}}" current_lang="$(echo "${current_lang}" | sed 's/^-*//')" current_lang="${current_lang,,}" if [[ "${MESSAGE_LANG_DISPLAY[${current_lang}]}" ]]; then current_lang="${current_lang//-/_}" load_pack "msg_pack_${current_lang}" fi } function msg_pack_en() { MESSAGE_CONTENTS=( ['start.welcome']='Docker installation & mirror switcher' ['start.runtimeEnv']='Runtime Env' ['start.dateTime']='System Time' ['end.moreInfo']='Script execution completed, visit our website for more tutorials' ['end.sponsorAds']='[Sponsor Ads]' ['error.cmd.options.needConfirm']='Please confirm and re-enter' ['error.cmd.options.needSpecify']='Please specify {} after this option' ['error.cmd.options.invalid']='Command option {} is invalid, {}!' ['error.cmd.options.validAddress']='a valid address' ['error.cmd.options.sourceAddress']='mirror address' ['error.cmd.options.registryAddress']='registry mirror address' ['error.cmd.options.sourceRepository']='mirror repository' ['error.cmd.options.validVersion']='a valid version number' ['error.cmd.options.ceRepositoryVersion']='Docker CE mirror repository version' ['error.cmd.options.version']='version number' ['error.cmd.options.codename']='version codename' ['error.cmd.options.boolean']=' true or false ' ['error.cmd.options.protocol']=' http or https ' ['error.cmd.options.needProtocol']=' Web protocol(http/https)' ['error.cmd.options.validLangKey']='A valid language ID ' ['error.cmd.options.langKey']='language ID ' ['error.unsupportSystem1']='Unsupported operating system ({})' ['error.unsupportSystem2']='Unsupported operating system ({}), please install manually with commands:' ['error.unknownSystem']='Unknown system' ['error.unsupportX86_32']='Docker Engine does not support installation on x86_32 architecture!' ['error.unknownArch']='Unknown system architecture: {}' ['error.unsupportS390x']='Please refer to RHEL distribution announcement for s390x support' ['error.input']='Input error, {}!' ['error.needRoot']='Insufficient privileges, please run this script as root. Switch command: {}' ['error.sync']='{} failed. Please fix system software sources (package repositories) so the {} package manager is available!' ['error.downloadGPG']='GPG key download failed, please check network or switch Docker CE mirror and retry!' ['error.queryVersionFailed']='Failed to query Docker Engine version list!' ['error.designatedVersion']='Specified Docker Engine version does not exist or is not supported for installation!' ['error.invalidVersion']='Please enter a valid version number!' ['error.reEnter']='Input error, please re-enter!' ['error.installDockerEngineFailed']='Docker Engine installation failed!' ['error.installPackageFailed']='Package {} installation failed, please install manually and rerun script!' ['error.defaultBehavior.https']='Using HTTPS protocol by default' ['error.defaultBehavior.noClose']='Not closing by default' ['error.defaultBehavior.installLatest']='Installing latest version by default' ['error.defaultBehavior.noOverwrite']='Not overwriting by default' ['error.defaultBehavior.noUseIntranetSource']='Not using intranet address by default' ['warn.usedIntranetSource']='Switched to intranet-only address, use only in specific environments!' ['warn.needValidNumberIndex']='Please enter a valid number index!' ['warn.needInputNumberIndex']='Please enter a number index!' ['warn.needManuallyDeleteConfig']='Please manually delete {} configuration in {} and restart service {}' ['tip.skipInstallDockerEngine']='Detected Docker Engine is already installed with latest version, skipping installation' ['info.backuped.dockerConfig']='Original Docker config file has been backed up' ['interaction.source.type.public']='Public' ['interaction.source.type.intranet']='Intranet' ['interaction.source.type.select']='Please select network address (access method) for Docker CE mirror:' ['interaction.source.type.usePublicAddress']='Use public network address for Docker CE mirror by default, continue' ['interaction.source.dockerCE.select']='Please select the Docker CE mirror you want to use:' ['interaction.source.dockerCE.selectAndInput']='Please select and enter the Docker CE mirror you want to use' ['interaction.source.dockerRegistry.select']='Please select the Docker Registry mirror you want to use:' ['interaction.source.dockerRegistry.selectAndInput']='Please select and enter the Docker Registry mirror you want to use' ['interaction.protocol.select']='Please select network protocol for Docker CE mirror:' ['interaction.protocol.useHttp']='Use HTTP protocol for Docker CE mirror' ['interaction.firewall.close']='Close system firewall and SELinux' ['interaction.install.selectVersion']='Please select the version you want to install:' ['interaction.install.selectedVersion']='Specified installation version:' ['interaction.install.selectedTitle']='Please select the version to install, e.g.: {}' ['interaction.install.inputVersion']='Based on the list above, please select and enter the specific version you want to install:' ['interaction.install.latestVersion']='Install latest version of Docker Engine' ['interaction.backup.skipOverwrite']='Detected existing backup of Docker config file, skip overwriting backup' ['interaction.common.tip']='Tip' ['interaction.common.operationCanceled']='Operation canceled' ['interaction.common.yes']='Yes' ['interaction.common.no']='No' ['work.installDependents']='Install environment packages' ['work.installDockerEngine']='Install Docker Engine' ['source.sync.text1']='Update APT package index' ['source.sync.text2']='Generate mirror cache' ['result.install.failed']='Installation failed' ['result.install.checkSourceFile']='Check source file:' ['result.install.manuallyExecCmd']='Please try manually executing installation command: {}' ['result.install.notRunning']='Detected Docker service startup error, try running this script again' ['result.install.manuallyRun']='Please execute {} command to try starting or investigate error cause' ['result.registry.success']='Registry mirror replaced successfully' ['result.registry.dockerEngineNotExsit']='Docker Engine is not installed yet, please remove {} command option and rerun script!' ['commands.help']='Command options(name/meaning/value): --source Specify Docker CE mirror address (domain or IP) address --source-registry Specify Docker Registry mirror address (domain or IP) address --branch Specify Docker CE mirror repository (path) repo name --branch-version Specify Docker CE mirror repository version version --designated-version Specify Docker Engine installation version version --codename Specify Debian-based OS codename codename --protocol Specify Web protocol for Docker CE mirror http or https --install-latest Whether to install the latest Docker Engine true or false --close-firewall Whether to disable the firewall true or false --clean-screen Whether to clear the screen before running true or false --only-registry Only switch registry mirror mode none --pure-mode Pure mode, minimal output none --help Show help menu none Issue Report {}' ) } init_msg_pack handle_command_options "$@" main ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) 2026 SuperManito Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.en-US.md ================================================
LinuxMirrors

LinuxMirrors

GNU/Linux mirror switching script & Docker installation and registry mirror switching script

简体中文 | 繁體中文 | English

License: MIT Stars Ask DeepWiki

Featured|HelloGitHub

Operating System Supported Versions
Debian Debian 8 ~ 13
Ubuntu Ubuntu 14 ~ 25
Kali Linux Kali Linux all
Linux Mint Linux Mint 17 ~ 22 / LMDE 2 ~ 7
Deepin Deepin all
Zorin OS Zorin OS all
Armbian Armbian all
Proxmox VE Proxmox VE all
Raspberry Pi OS Raspberry Pi OS all
Red Hat Enterprise Linux Red Hat Enterprise Linux 7 ~ 10
Fedora Fedora 30 ~ 43
CentOS CentOS 7 ~ 8 / Stream 8 ~ 10
Rocky Linux Rocky Linux 8 ~ 10
AlmaLinux AlmaLinux 8 ~ 10
Oracle Linux Oracle Linux 8 ~ 10
openEuler openEuler 20 ~ 25
OpenCloudOS OpenCloudOS 8.6 ~ 9 / Stream 23
openKylin openKylin all
Anolis OS Anolis OS 8 / 23
openSUSE openSUSE Leap 15 ~ 16 / Tumbleweed
Arch Linux Arch Linux all
Manjaro Manjaro all
EndeavourOS EndeavourOS all
Alpine Linux Alpine Linux v3 / edge
Gentoo Gentoo all
NixOS NixOS 19 ~ 25

Official Website    Usage    Mirror List    Docker Install (Extra Script)    Community    Sponsor

Sponsors

Sponsors

*** ## Quick Start > The official project website integrates AI chat and search. For more usage, see [**linuxmirrors.cn**](https://linuxmirrors.cn/en/use/) - ### GNU/Linux System Software Mirror Switching ```bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --en ``` - ### Docker Installation & Mirror Switching ```bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --en ``` - ### Docker Switch Registry Mirror ```bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --en --only-registry ``` ## Special Thanks jetbrains     netlify This project has joined the JetBrains & Netlify Open Source Program. ## LICENSE Copyright © 2026, [SuperManito](https://github.com/SuperManito). Released under the [MIT](https://github.com/SuperManito/LinuxMirrors/blob/main/LICENSE). This is a fully open source project, aiming to provide convenience for friends in the computer-related industry and make mirror switching easier. Star History Chart __If you find this project helpful, please click the ⭐ in the upper right corner of the repository and share it with more friends.__ ================================================ FILE: README.md ================================================
LinuxMirrors

LinuxMirrors

GNU/Linux 更换系统软件源脚本及 Docker 安装与换源脚本

简体中文 | 繁體中文 | English

License: MIT Stars Ask DeepWiki

Featured|HelloGitHub

操作系统 适配版本
Debian Debian 8 ~ 13
Ubuntu Ubuntu 14 ~ 25
Kali Linux Kali Linux all
Linux Mint Linux Mint 17 ~ 22 / LMDE 2 ~ 7
Deepin Deepin(深度) all
Zorin OS Zorin OS all
Armbian Armbian all
Proxmox VE Proxmox VE all
Raspberry Pi OS Raspberry Pi OS all
Red Hat Enterprise Linux Red Hat Enterprise Linux 7 ~ 10
Fedora Fedora 30 ~ 43
CentOS CentOS 7 ~ 8 / Stream 8 ~ 10
Rocky Linux Rocky Linux 8 ~ 10
AlmaLinux AlmaLinux 8 ~ 10
Oracle Linux Oracle Linux 8 ~ 10
openEuler openEuler(开源欧拉) 20 ~ 25
OpenCloudOS OpenCloudOS(鸥栖) 8.6 ~ 9 / Stream 23
openKylin openKylin(开放麒麟) all
Anolis OS Anolis OS(龙蜥) 8 / 23
openSUSE openSUSE Leap 15 ~ 16 / Tumbleweed
Arch Linux Arch Linux all
Manjaro Manjaro all
EndeavourOS EndeavourOS all
Alpine Linux Alpine Linux v3 / edge
Gentoo Gentoo all
NixOS NixOS 19 ~ 25

官方网站    使用方法    软件源列表    Docker 安装(额外脚本)    社区    赞助

赞助商

Sponsors

*** ## 快速开始 > 项目官方网站集成了 AI 聊天与搜索,更多使用方法详见 [**linuxmirrors.cn**](https://linuxmirrors.cn/use/) - ### GNU/Linux 更换系统软件源 ```bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) ``` - ### Docker 安装与换源 ```bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) ``` - ### Docker 更换镜像加速器 ```bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --only-registry ``` ## 特别感谢 jetbrains     netlify 本项目已加入 JetBrains & Netlify 开源项目计划 ## LICENSE Copyright © 2026, [SuperManito](https://github.com/SuperManito). Released under the [MIT](https://github.com/SuperManito/LinuxMirrors/blob/main/LICENSE). 这是一个完全开源的项目,旨在为从事计算机相关行业的朋友们提供便利,使换源更简单 Star History Chart __如果觉得这个项目不错对您有所帮助的话,请点击仓库右上角的 ⭐ 并分享给更多的朋友。__ ================================================ FILE: README.zh-Hant.md ================================================
LinuxMirrors

LinuxMirrors

GNU/Linux 更換系統軟體源腳本及 Docker 安裝與換源腳本

简体中文 | 繁體中文 | English

License: MIT Stars Ask DeepWiki

Featured|HelloGitHub

作業系統 適配版本
Debian Debian 8 ~ 13
Ubuntu Ubuntu 14 ~ 25
Kali Linux Kali Linux all
Linux Mint Linux Mint 17 ~ 22 / LMDE 2 ~ 7
Deepin Deepin all
Zorin OS Zorin OS all
Armbian Armbian all
Proxmox VE Proxmox VE all
Raspberry Pi OS Raspberry Pi OS all
Red Hat Enterprise Linux Red Hat Enterprise Linux 7 ~ 10
Fedora Fedora 30 ~ 43
CentOS CentOS 7 ~ 8 / Stream 8 ~ 10
Rocky Linux Rocky Linux 8 ~ 10
AlmaLinux AlmaLinux 8 ~ 10
Oracle Linux Oracle Linux 8 ~ 10
openEuler openEuler 20 ~ 25
OpenCloudOS OpenCloudOS 8.6 ~ 9 / Stream 23
openKylin openKylin all
Anolis OS Anolis OS 8 / 23
openSUSE openSUSE Leap 15 ~ 16 / Tumbleweed
Arch Linux Arch Linux all
Manjaro Manjaro all
EndeavourOS EndeavourOS all
Alpine Linux Alpine Linux v3 / edge
Gentoo Gentoo all
NixOS NixOS 19 ~ 25

官方網站    使用方法    軟體源列表    Docker 安裝(額外腳本)    社群    贊助

贊助商

Sponsors

*** ## 快速開始 > 專案官方網站整合了 AI 聊天與搜索,更多使用方法詳見 [**linuxmirrors.cn**](https://linuxmirrors.cn/zh-Hant/use/) - ### GNU/Linux 更換系統軟體源 ```bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --zh-hant ``` - ### Docker 安裝與換源 ```bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --zh-hant ``` - ### Docker 更換鏡像加速器 ```bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --zh-hant --only-registry ``` ## 特別感謝 jetbrains     netlify 本專案已加入 JetBrains & Netlify 開源專案計劃 ## LICENSE Copyright © 2026, [SuperManito](https://github.com/SuperManito). Released under the [MIT](https://github.com/SuperManito/LinuxMirrors/blob/main/LICENSE). 這是一個完全開源的專案,旨在為從事電腦相關行業的朋友提供便利,使換源更簡單 Star History Chart __如果您覺得這個專案不錯對您有幫助的話,請點擊倉庫右上角的 ⭐ 並分享給更多的朋友。__ ================================================ FILE: SECURITY.md ================================================ # Security Policy ## Supported Versions Use this section to tell people about which versions of your project are currently being supported with security updates. | Version | Supported | | ------- | ------------------ | | all | :white_check_mark: | ## Reporting a Vulnerability Use this section to tell people how to report a vulnerability. Tell them where to go, how often they can expect to get an update on a reported vulnerability, what to expect if the vulnerability is accepted or declined, etc. ================================================ FILE: docs/assets/css/orama-ui.css ================================================ .orama-ui { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-family: var(--md-text-font); font-weight: 400; text-rendering: optimizeLegibility; vertical-align: baseline; -webkit-text-size-adjust: none; -moz-text-size-adjust: none; text-size-adjust: none; --orama-base-font-size: 18; --font-size-xxs: calc(10rem/var(--orama-base-font-size, 16)); --font-size-xs: calc(12rem/var(--orama-base-font-size, 16)); --font-size-sm: calc(14rem/var(--orama-base-font-size, 16)); --font-size-md: calc(16rem/var(--orama-base-font-size, 16)); --font-size-lg: calc(20rem/var(--orama-base-font-size, 16)); --font-weight-normal: 400; --font-weight-semibold: 600; --font-line-height-s: 1.25; --font-line-height-m: 1.5; --radius-xs: calc(6rem/var(--orama-base-font-size, 16)); --radius-s: calc(8rem/var(--orama-base-font-size, 16)); --radius-m: calc(12rem/var(--orama-base-font-size, 16)); --radius-l: calc(16rem/var(--orama-base-font-size, 16)); --radius-3xl: calc(40rem/var(--orama-base-font-size, 16)); --textarea-radius: calc(16rem/var(--orama-base-font-size, 16)); --spacing-2xs: calc(2rem/var(--orama-base-font-size, 16)); --spacing-xs: calc(4rem/var(--orama-base-font-size, 16)); --spacing-s: calc(8rem/var(--orama-base-font-size, 16)); --spacing-m: calc(12rem/var(--orama-base-font-size, 16)); --spacing-l: calc(16rem/var(--orama-base-font-size, 16)); --spacing-xl: calc(24rem/var(--orama-base-font-size, 16)); --spacing-2xl: calc(32rem/var(--orama-base-font-size, 16)); --spacing-3xl: calc(40rem/var(--orama-base-font-size, 16)); --textarea-shadow: var(--md-shadow-z1); --text-color-primary: #151515; --text-color-secondary: #838289; --text-color-tertiary: #99989d; --text-color-accent: var(--md-accent-fg-color); --text-color-inactive: #99989d; --text-color-reverse: #fff; --background-color-primary: #fbfbfb; --background-color-secondary: #fff; --background-color-tertiary: var(--md-accent-fg-color--transparent); --background-color-fourth: #efefef; --background-color-reverse: #000; --background-color-accent: var(--md-accent-fg-color); --border-color-primary: #dadada; --border-color-secondary: #efefef; --border-color-tertiary: #151515; --border-color-accent: var(--md-accent-fg-color); --icon-color-primary: #151515; --icon-color-secondary: #dadada; --icon-color-tertiary: #838289; --icon-color-inactive: #99989d; --icon-color-reverse: #fbfbfb; --shadow-color-primary: #fff; --button-text-color-primary: #fbfbfb; --button-text-color-secondary: #838289; --button-background-color-primary: var(--md-accent-fg-color); --button-background-color-secondary: hsla(240, 9%, 75%, 0.33); --button-background-color-secondary-hover: var(--md-accent-fg-color--transparent); --button-border-color-secondary: #dadada; --backdrop-background-color-primary: hsla(0, 0%, 98%, .7); --chat-button-border-color-gradientOne: transparent; --chat-button-border-color-gradientTwo: transparent; --chat-button-border-color-gradientThree: var(--md-accent-fg-color); --chat-button-border-color-gradientFour: var(--md-accent-fg-color); --chat-button-border-color-gradientFive: transparent; --chat-button-border-color-gradientSix: transparent; --chat-button-background-color-gradientOne: var(--md-accent-fg-color); --chat-button-background-color-gradientTwo: transparent; } .orama-ui *, .orama-ui:after, .orama-ui:before { box-sizing: border-box } [data-md-color-scheme="slate"] .orama-ui { --text-color-primary: #fbfbfb; --text-color-secondary: #dadada; --text-color-tertiary: #838289; --text-color-accent: var(--md-accent-fg-color); --text-color-inactive: #99989d; --text-color-reverse: #000; --background-color-primary: var(--md-default-bg-color); --background-color-secondary: #101010; --background-color-tertiary: var(--md-accent-fg-color--transparent); --background-color-fourth: #2e2e2e; --background-color-reverse: #fff; --background-color-accent: var(--md-accent-fg-color); --border-color-primary: #2e2e2e; --border-color-secondary: #151515; --border-color-tertiary: #afafb1; --border-color-accent: var(--md-accent-fg-color); --icon-color-primary: #fbfbfb; --icon-color-secondary: #dadada; --icon-color-tertiary: #838289; --icon-color-inactive: #99989d; --icon-color-reverse: var(--md-default-bg-color); --shadow-color-primary: #000; --button-text-color-primary: #fbfbfb; --button-text-color-secondary: #99989d; --button-background-color-primary: var(--md-accent-fg-color); --button-background-color-secondary: hsla(var(--md-hue), 15%, 9%, 0.33); --button-background-color-secondary-hover: var(--md-accent-fg-color--transparent); --button-border-color-secondary: #2e2e2e; --backdrop-background-color-primary: rgba(5, 5, 5, .7); --chat-button-border-color-gradientOne: transparent; --chat-button-border-color-gradientTwo: transparent; --chat-button-border-color-gradientThree: var(--md-accent-fg-color); --chat-button-border-color-gradientFour: var(--md-accent-fg-color); --chat-button-border-color-gradientFive: transparent; --chat-button-border-color-gradientSix: transparent; --chat-button-background-color-gradientOne: var(--md-accent-fg-color); --chat-button-background-color-gradientTwo: transparent; } ================================================ FILE: docs/assets/js/common.js ================================================ const __p = typeof window !== 'undefined' && window.location && window.location.pathname ? window.location.pathname : '' const __isZhHant = __p.includes('/zh-Hant') const __isEn = __p.includes('/en') // 防抖 function debounce(func, wait) { let timeout return function () { const context = this const args = arguments clearTimeout(timeout) timeout = setTimeout(() => func.apply(context, args), wait) } } // 组件管理系统(每个组件都是一个 Vue 实例) const ComponentSystem = { // 组件状态数据 components: {}, // 注册组件 register: function (componentId, componentDef) { // 为每个组件创建自己的状态 this.components[componentId] = { id: componentId, instance: null, isInitializing: false, lastInitTime: 0, def: componentDef, debouncedInit: null, app: null, } // 创建组件初始化函数 const initFunc = function () { const component = ComponentSystem.components[componentId] // 如果正在初始化或者距离上次初始化时间太短,则跳过 const now = Date.now() if (component.isInitializing || now - component.lastInitTime < 1000) { return } // 使用缓存,如果没有则查询 if (!component.instance) { component.instance = document.getElementById(componentId) } // 如果找不到容器,不执行后续操作 if (!component.instance) { return } // 如果组件已经初始化过,且DOM没有变化,则跳过 if (component.instance.hasAttribute('data-initialized')) { return } // console.log(`找到组件 ${componentId} 容器,开始初始化`) component.isInitializing = true component.lastInitTime = now try { if (component.app && typeof component.app.unmount === 'function') { try { component.app.unmount() } catch (err) { console.error('组件卸载失败', err) } component.app = null } // 清空容器内容,防止重复初始化 while (component.instance.firstChild) { component.instance.removeChild(component.instance.firstChild) } // 确保容器有适当的尺寸 if (!component.instance.style.width) { component.instance.style.width = '100%' } // 确保 Vue 和 TDesign 已加载 if (typeof Vue !== 'undefined' && typeof TDesign !== 'undefined') { // 创建 Vue 应用 const App = Vue.createApp(component.def) // 注册 TDesign 组件 App.use(TDesign.default) // 挂载应用 App.mount(component.instance) // 保存 app 引用以便后续卸载 component.app = App // console.log(`组件 ${componentId} 初始化成功`) // 标记组件已初始化 component.instance.setAttribute('data-initialized', 'true') // 立即更新主题 updateTDesignGlobalTheme() } else if (typeof Vue !== 'undefined') { console.error('Vue 未找到') const errorDiv = document.createElement('div') errorDiv.innerHTML = `

组件 ${componentId} 加载失败,请检查 Vue 是否存在!

` component.instance.appendChild(errorDiv) } else if (typeof TDesign !== 'undefined') { console.error('TDesign UI 未找到') const errorDiv = document.createElement('div') errorDiv.innerHTML = `

组件 ${componentId} 加载失败,请检查 TDesign UI 是否存在!

` component.instance.appendChild(errorDiv) } } catch (error) { console.error(`组件 ${componentId} 初始化时发生错误:${error}`) } finally { component.isInitializing = false } } // 为每个组件创建防抖初始化函数 this.components[componentId].debouncedInit = debounce(initFunc, 300) return this.components[componentId].debouncedInit }, // 初始化所有组件 initAll: function () { Object.values(this.components).forEach((component) => { if (component.debouncedInit) { component.debouncedInit() } }) }, // 重新初始化组件 reinitialize: function (componentId) { const component = this.components[componentId] if (component) { component.instance = document.getElementById(componentId) if (component.instance) { if (component.app && typeof component.app.unmount === 'function') { try { component.app.unmount() } catch (err) { console.error('组件初始化失败', err) } component.app = null } component.instance.removeAttribute('data-initialized') setTimeout(component.debouncedInit, 300) } } }, // 重新初始化所有组件 reinitializeAll: function () { Object.keys(this.components).forEach((id) => { this.reinitialize(id) }) }, } ================================================ FILE: docs/assets/js/component.js ================================================ // 使用 mkdocs-material 与第三方 JavaScript 库集成的方法 document$.subscribe(function () { ComponentSystem.reinitializeAll() // Orama AI Search loadOramaWebComponent() }) ================================================ FILE: docs/assets/js/components/mirrors-table/data.js ================================================ // 表格数据 const mirrorsTableData = [ { name: __isZhHant ? '阿里雲' : __isEn ? 'Alibaba Cloud' : '阿里云', officialName: __isZhHant ? '阿里巴巴開源鏡像站' : __isEn ? 'Alibaba Cloud Open Source Mirror' : '阿里巴巴开源镜像站', icon: 'alibabacloud.svg', iconStyle: { verticalAlign: '-0.2em' }, url: 'https://mirrors.aliyun.com', domain: 'mirrors.aliyun.com', ipv6: false, debian: true, ubuntu: true, centos: true, centos_stream: true, opensuse: true, archlinux: true, kali: true, deepin: true, rocky: 'incompatible', almalinux: true, epel: true, fedora: true, opencloudos: false, openeuler: true, anolis: true, openkylin: true, alpine: true, armbian: true, proxmox: false, linuxmint: true, gentoo: true, nix_channels: false, raspberrypi: true, manjaro: true, endeavouros: false, }, { name: __isZhHant ? '騰訊雲' : __isEn ? 'Tencent Cloud' : '腾讯云', officialName: __isZhHant ? '騰訊軟體源' : __isEn ? 'Tencent Software Repository' : '腾讯软件源', icon: 'tencentcloud.ico', iconStyle: { verticalAlign: '-0.25em' }, url: 'https://mirrors.tencent.com', domain: 'mirrors.tencent.com', ipv6: false, debian: true, ubuntu: true, centos: true, centos_stream: true, opensuse: true, archlinux: true, kali: true, deepin: false, rocky: true, almalinux: true, epel: true, fedora: true, opencloudos: true, openeuler: true, anolis: false, openkylin: false, alpine: true, armbian: false, proxmox: false, linuxmint: true, gentoo: true, nix_channels: false, raspberrypi: false, manjaro: false, endeavouros: false, }, { name: __isZhHant ? '華為雲' : __isEn ? 'Huawei Cloud' : '华为云', officialName: __isZhHant ? '華為開源鏡像站' : __isEn ? 'Huawei Open Source Mirror' : '华为开源镜像站', icon: 'huaweicloud.ico', iconStyle: { verticalAlign: '-0.15em' }, url: 'https://mirrors.huaweicloud.com', domain: 'mirrors.huaweicloud.com', ipv6: false, debian: true, ubuntu: true, centos: true, centos_stream: true, opensuse: true, archlinux: true, kali: true, deepin: true, rocky: 'incompatible', almalinux: true, epel: true, fedora: true, opencloudos: false, openeuler: true, anolis: false, openkylin: false, alpine: true, armbian: false, proxmox: false, linuxmint: true, gentoo: true, nix_channels: false, raspberrypi: false, manjaro: true, endeavouros: false, }, { name: __isZhHant ? '移動雲' : __isEn ? 'China Mobile Cloud' : '移动云 ', officialName: __isZhHant ? '移動雲開源鏡像站' : __isEn ? 'China Mobile Cloud Open Source Mirror' : '移动云开源镜像站', icon: 'cmecloud.svg', iconStyle: { verticalAlign: '-0.2em' }, url: 'https://mirrors.cmecloud.cn', domain: 'mirrors.cmecloud.cn', ipv6: true, debian: true, ubuntu: true, centos: true, centos_stream: false, opensuse: true, archlinux: false, kali: false, deepin: false, rocky: true, almalinux: false, epel: true, fedora: true, opencloudos: false, openeuler: true, anolis: true, openkylin: false, alpine: false, armbian: false, proxmox: false, linuxmint: false, gentoo: false, nix_channels: false, raspberrypi: false, manjaro: false, endeavouros: false, }, { name: __isZhHant ? '天翼雲' : __isEn ? 'China Telecom Cloud' : '天翼云', officialName: __isZhHant ? '天翼雲開源鏡像站' : __isEn ? 'China Telecom Cloud Open Source Mirror' : '天翼云开源镜像站', icon: 'ctyun.ico', iconStyle: { verticalAlign: '-0.2em' }, url: 'https://mirrors.ctyun.cn', domain: 'mirrors.ctyun.cn', ipv6: false, debian: true, ubuntu: true, centos: true, centos_stream: true, opensuse: false, archlinux: false, kali: false, deepin: false, rocky: true, almalinux: false, epel: true, fedora: false, opencloudos: false, openeuler: true, anolis: false, openkylin: false, alpine: false, armbian: false, proxmox: false, linuxmint: false, gentoo: false, nix_channels: false, raspberrypi: false, manjaro: false, endeavouros: false, }, { name: __isZhHant ? '網易' : __isEn ? 'NetEase' : '网易', officialName: __isZhHant ? '網易開源鏡像站' : __isEn ? 'NetEase Open Source Mirror' : '网易开源镜像站', icon: '163.ico', iconStyle: { verticalAlign: '-0.15em' }, url: 'https://mirrors.163.com', domain: 'mirrors.163.com', ipv6: false, debian: true, ubuntu: true, centos: true, centos_stream: true, opensuse: true, archlinux: true, kali: false, deepin: true, rocky: true, almalinux: false, epel: false, fedora: true, opencloudos: false, openeuler: true, anolis: false, openkylin: true, alpine: false, armbian: false, proxmox: false, linuxmint: true, gentoo: true, nix_channels: false, raspberrypi: false, manjaro: false, endeavouros: false, }, { name: __isZhHant ? '火山引擎' : __isEn ? 'Volcengine' : '火山引擎', officialName: __isZhHant ? '火山引擎開源軟體鏡像站' : __isEn ? 'Volcengine Open Source Software Mirror' : '火山引擎开源软件镜像站', icon: 'volcengine.svg', iconStyle: { verticalAlign: '-0.25em' }, url: 'https://developer.volcengine.com/mirror', domain: 'mirrors.volces.com', ipv6: false, debian: true, ubuntu: true, centos: true, centos_stream: true, opensuse: true, archlinux: false, kali: true, deepin: true, rocky: 'incompatible', almalinux: true, epel: true, fedora: true, opencloudos: false, openeuler: true, anolis: false, openkylin: false, alpine: true, armbian: false, proxmox: false, linuxmint: false, gentoo: false, nix_channels: false, raspberrypi: false, manjaro: false, endeavouros: false, }, { name: __isZhHant ? '清華大學' : __isEn ? 'Tsinghua University' : '清华大学', officialName: __isZhHant ? '清華大學開源軟體鏡像站' : __isEn ? 'Tsinghua University Open Source Mirror' : '清华大学开源软件镜像站', icon: 'tsinghua.png', iconStyle: { verticalAlign: '-0.3em' }, url: 'https://mirrors.tuna.tsinghua.edu.cn', domain: 'mirrors.tuna.tsinghua.edu.cn', ipv6: true, debian: true, ubuntu: true, centos: true, centos_stream: true, opensuse: true, archlinux: true, kali: true, deepin: true, rocky: false, almalinux: false, epel: true, fedora: true, opencloudos: false, openeuler: true, anolis: false, openkylin: false, alpine: true, armbian: true, proxmox: true, linuxmint: true, gentoo: true, nix_channels: true, raspberrypi: true, manjaro: true, endeavouros: true, }, { name: __isZhHant ? '北京大學' : __isEn ? 'Peking University' : '北京大学', officialName: __isZhHant ? '北京大學開源鏡像站' : __isEn ? 'Peking University Open Source Mirror' : '北京大学开源镜像站', icon: 'pku.ico', iconStyle: { verticalAlign: '-0.2em' }, url: 'https://mirrors.pku.edu.cn/Mirrors', domain: 'mirrors.pku.edu.cn', ipv6: true, debian: true, ubuntu: true, centos: true, centos_stream: true, opensuse: true, archlinux: true, kali: false, deepin: false, rocky: true, almalinux: true, epel: true, fedora: false, opencloudos: false, openeuler: true, anolis: false, openkylin: false, alpine: false, armbian: false, proxmox: false, linuxmint: false, gentoo: false, nix_channels: false, raspberrypi: false, manjaro: true, endeavouros: false, }, { name: __isZhHant ? '浙江大學' : __isEn ? 'Zhejiang University' : '浙江大学', officialName: __isZhHant ? '浙江大學鏡像站' : __isEn ? 'Zhejiang University Mirror Site' : '浙江大学镜像站', icon: 'zju.ico', iconStyle: { verticalAlign: '-0.15em' }, url: 'https://mirrors.zju.edu.cn', domain: 'mirrors.zju.edu.cn', ipv6: true, debian: true, ubuntu: true, centos: true, centos_stream: true, opensuse: true, archlinux: true, kali: true, deepin: true, rocky: true, almalinux: true, epel: true, fedora: true, opencloudos: false, openeuler: true, anolis: true, openkylin: false, alpine: true, armbian: false, proxmox: false, linuxmint: true, gentoo: true, nix_channels: false, raspberrypi: false, manjaro: true, endeavouros: false, }, { name: __isZhHant ? '南京大學' : __isEn ? 'Nanjing University' : '南京大学', officialName: __isZhHant ? '南京大學開源鏡像站' : __isEn ? 'Nanjing University Open Source Mirror' : '南京大学开源镜像站', icon: 'nju.ico', iconStyle: { verticalAlign: '-0.3em' }, url: 'https://mirrors.nju.edu.cn', domain: 'mirrors.nju.edu.cn', ipv6: true, debian: true, ubuntu: true, centos: true, centos_stream: true, opensuse: true, archlinux: true, kali: true, deepin: true, rocky: true, almalinux: true, epel: true, fedora: true, opencloudos: true, openeuler: true, anolis: true, openkylin: true, alpine: true, armbian: true, proxmox: true, linuxmint: true, gentoo: true, nix_channels: true, raspberrypi: true, manjaro: true, endeavouros: true, }, { name: __isZhHant ? '蘭州大學' : __isEn ? 'Lanzhou University' : '兰州大学', officialName: __isZhHant ? '蘭州大學開源軟體鏡像站' : __isEn ? 'Lanzhou University Open Source Software Mirror' : '兰州大学开源软件镜像站', icon: 'lzu.png', iconStyle: { verticalAlign: '-0.25em' }, url: 'https://mirror.lzu.edu.cn', domain: 'mirror.lzu.edu.cn', ipv6: true, debian: true, ubuntu: true, centos: true, centos_stream: true, opensuse: true, archlinux: true, kali: true, deepin: true, rocky: true, almalinux: true, epel: true, fedora: true, opencloudos: false, openeuler: true, anolis: false, openkylin: true, alpine: true, armbian: false, proxmox: false, linuxmint: true, gentoo: true, nix_channels: false, raspberrypi: false, manjaro: true, endeavouros: false, }, { name: __isZhHant ? '上海交通大學' : __isEn ? 'Shanghai Jiao Tong University' : '上海交通大学', officialName: __isZhHant ? '上海交通大學思源鏡像站' : __isEn ? 'Shanghai Jiao Tong University Siyuan Mirror' : '上海交通大学思源镜像站', icon: 'sjtu.ico', iconStyle: { verticalAlign: '-0.15em' }, url: 'https://mirror.sjtu.edu.cn', domain: 'mirror.sjtu.edu.cn', ipv6: true, debian: true, ubuntu: true, centos: true, centos_stream: true, opensuse: true, archlinux: true, kali: true, deepin: true, rocky: true, almalinux: true, epel: 'incompatible', fedora: 'incompatible', opencloudos: true, openeuler: true, anolis: false, openkylin: true, alpine: true, armbian: true, proxmox: false, linuxmint: true, gentoo: true, nix_channels: false, raspberrypi: true, manjaro: true, endeavouros: true, }, { name: __isZhHant ? '重慶郵電大學' : __isEn ? 'Chongqing University of Posts and Telecommunications' : '重庆邮电大学', officialName: __isZhHant ? '重慶郵電大學開源鏡像站' : __isEn ? 'Chongqing University of Posts and Telecommunications Open Source Mirror' : '重庆邮电大学开源镜像站', icon: 'cqupt.ico', iconStyle: {}, url: 'https://mirrors.cqupt.edu.cn', domain: 'mirrors.cqupt.edu.cn', ipv6: true, debian: true, ubuntu: true, centos: true, centos_stream: true, opensuse: true, archlinux: true, kali: true, deepin: true, rocky: false, almalinux: true, epel: true, fedora: true, opencloudos: false, openeuler: true, anolis: false, openkylin: false, alpine: true, armbian: true, proxmox: true, linuxmint: false, gentoo: false, nix_channels: true, raspberrypi: true, manjaro: true, endeavouros: true, }, { name: __isZhHant ? '中國科學技術大學' : __isEn ? 'University of Science and Technology of China' : '中国科学技术大学', officialName: __isZhHant ? '中國科學技術大學開源軟體鏡像站' : __isEn ? 'University of Science and Technology of China Open Source Software Mirror' : '中国科学技术大学开源软件镜像站', icon: 'ustc.png', iconStyle: { verticalAlign: '-0.2em' }, url: 'https://mirrors.ustc.edu.cn', domain: 'mirrors.ustc.edu.cn', ipv6: true, debian: true, ubuntu: true, centos: true, centos_stream: true, opensuse: true, archlinux: true, kali: true, deepin: true, rocky: true, almalinux: false, epel: true, fedora: true, opencloudos: false, openeuler: true, anolis: false, openkylin: false, alpine: true, armbian: true, proxmox: true, linuxmint: true, gentoo: true, nix_channels: true, raspberrypi: true, manjaro: true, endeavouros: false, }, { name: __isZhHant ? '中國科學院軟體研究所' : __isEn ? 'Institute of Software, Chinese Academy of Sciences (ISCAS)' : '中国科学院软件研究所', officialName: __isZhHant ? 'ISCAS 開源鏡像站' : __isEn ? 'ISCAS Open Source Mirror' : 'ISCAS 开源镜像站', icon: 'iscas.png', iconStyle: { verticalAlign: '-0.25em' }, url: 'https://mirror.iscas.ac.cn', domain: 'mirror.iscas.ac.cn', ipv6: false, debian: true, ubuntu: true, centos: true, centos_stream: true, opensuse: true, archlinux: true, kali: true, deepin: true, rocky: true, almalinux: true, epel: true, fedora: true, opencloudos: true, openeuler: true, anolis: false, openkylin: true, alpine: true, armbian: true, proxmox: true, linuxmint: true, gentoo: true, nix_channels: true, raspberrypi: true, manjaro: true, endeavouros: true, }, ] // 表格列配置 const mirrorsTableColumns = [ { colKey: 'name', title: __isZhHant ? '鏡像站' : __isEn ? 'Mirror Site' : '镜像站', align: 'left', width: '180', fixed: 'left', }, { colKey: 'ipv6', title: 'IPv6', align: 'center', width: '70', tooltip: 'IPv6 ' + (__isZhHant ? '(網際協定第6版)' : __isEn ? '(Internet Protocol version 6)' : '(网际协议第6版)'), }, { colKey: 'epel', title: 'EPEL', align: 'center', width: '90', tooltip: 'EPEL (Extra Packages for Enterprise Linux) ' + (__isZhHant ? '是由 Fedora 組織維護的一個附加軟體包倉庫,它主要適用於除 Fedora 作業系統以外的紅帽系 Linux 發行版' : __isEn ? 'is an additional package repository maintained by the Fedora organization. It is mainly applicable to Red Hat Linux distributions other than the Fedora operating system.' : '是由 Fedora 组织维护的一个附加软件包仓库,它主要适用于除 Fedora 操作系统以外的红帽系 Linux 发行版'), }, { colKey: 'debian', title: 'Debian', align: 'center', width: '80', }, { colKey: 'ubuntu', title: 'Ubuntu', align: 'center', width: '80', }, { colKey: 'centos', title: 'CentOS', align: 'center', width: '80', }, { colKey: 'centos_stream', title: 'CentOS Stream', align: 'center', width: '150', }, { colKey: 'opensuse', title: 'openSUSE', align: 'center', width: '110', }, { colKey: 'archlinux', title: 'Arch Linux', align: 'center', width: '120', }, { colKey: 'manjaro', title: 'Manjaro', align: 'center', width: '100', }, { colKey: 'kali', title: 'Kali Linux', align: 'center', width: '110', }, { colKey: 'armbian', title: 'Armbian', align: 'center', width: '100', }, { colKey: 'deepin', title: 'Deepin', align: 'center', width: '90', }, { colKey: 'raspberrypi', title: 'Raspberry Pi OS', align: 'center', width: '150', }, { colKey: 'linuxmint', title: 'Linux Mint', align: 'center', width: '120', }, { colKey: 'proxmox', title: 'Proxmox VE', align: 'center', width: '120', }, { colKey: 'fedora', title: 'Fedora', align: 'center', width: '90', }, { colKey: 'rocky', title: 'Rocky Linux', align: 'center', width: '120', }, { colKey: 'almalinux', title: 'AlmaLinux', align: 'center', width: '110', }, { colKey: 'opencloudos', title: 'OpenCloudOS', align: 'center', width: '140', }, { colKey: 'openeuler', title: 'openEuler', align: 'center', width: '110', }, { colKey: 'anolis', title: 'Anolis OS', align: 'center', width: '110', }, { colKey: 'openkylin', title: 'openKylin', align: 'center', width: '110', }, { colKey: 'alpine', title: 'Alpine Linux', align: 'center', width: '130', }, { colKey: 'gentoo', title: 'Gentoo', align: 'center', width: '90', }, { colKey: 'nix_channels', title: 'NixOS', align: 'center', width: '80', }, { colKey: 'endeavouros', title: 'EndeavourOS', align: 'center', width: '140', }, ].map((item) => { if (item.colKey !== 'name') { const labelSupported = __isZhHant ? '支持' : __isEn ? 'Supported' : '支持' const labelUnsupported = __isZhHant ? '不支持' : __isEn ? 'Unsupported' : '不支持' const labelIncompatible = __isZhHant ? '不兼容' : __isEn ? 'Incompatible' : '不兼容' item.filter = { label: item.title || item.colKey, type: 'single', list: [ { label: labelSupported, value: 'supported' }, { label: labelUnsupported, value: 'unsupported' }, { label: labelIncompatible, value: 'incompatible' }, ], confirmEvents: ['onChange'], filterMethod(value, row) { try { const key = item.colKey const cell = row && Object.prototype.hasOwnProperty.call(row, key) ? row[key] : undefined if (value === 'supported') return cell === true if (value === 'unsupported') return cell === false if (value === 'incompatible') return cell === 'incompatible' return false } catch (e) { return false } }, } item.filterMethod = function (value, row) { try { const key = item.colKey const cell = row && Object.prototype.hasOwnProperty.call(row, key) ? row[key] : undefined if (value === 'supported') return cell === true if (value === 'unsupported') return cell === false if (value === 'incompatible') return cell === 'incompatible' return false } catch (e) { return false } } } return item }) const mirrorsTableFilterSelectOptions = [ { label: __isZhHant ? '全選' : __isEn ? 'Select All' : '全选', checkAll: true }, { value: 'ipv6', label: 'IPv6', }, { group: 'Debian', children: [ { value: 'debian', label: 'Debian', iconName: 'debian.svg', }, { value: 'ubuntu', label: 'Ubuntu', iconName: 'ubuntu.svg', }, { value: 'kali', label: 'Kali Linux', iconName: 'kali-linux.png', }, { value: 'armbian', label: 'Armbian', iconName: 'armbian.png', }, { value: 'raspberrypi', label: 'Raspberry Pi OS', iconName: 'raspberry-pi.png', }, { value: 'openkylin', label: 'openKylin', iconName: 'openkylin.ico', }, { value: 'linuxmint', label: 'Linux Mint', iconName: 'linux-mint.svg', }, { value: 'deepin', label: 'Deepin', iconName: 'deepin.png', }, { value: 'proxmox', label: 'Proxmox VE', iconName: 'proxmox.svg', }, ], }, { group: 'RedHat', children: [ { value: 'fedora', label: 'Fedora', iconName: 'fedora.ico', }, { value: 'centos', label: 'CentOS', iconName: 'centos.svg', }, { value: 'centos_stream', label: 'CentOS Stream', iconName: 'centos.svg', }, { value: 'rocky', label: 'Rocky Linux', iconName: 'rocky-linux.svg', }, { value: 'almalinux', label: 'AlmaLinux', iconName: 'almalinux.svg', }, { value: 'openeuler', label: 'openEuler', iconName: 'openeuler.ico', }, { value: 'opencloudos', label: 'OpenCloudOS', iconName: 'opencloudos.png', }, { value: 'anolis', label: 'Anolis OS', iconName: 'anolis.png', }, { value: 'epel', label: 'EPEL', }, ], }, { group: 'Arch Linux', children: [ { value: 'archlinux', label: 'Arch Linux', iconName: 'arch-linux.ico', }, { value: 'manjaro', label: 'Manjaro', iconName: 'manjaro.svg', }, { value: 'endeavouros', label: 'EndeavourOS', iconName: 'endeavouros.png', }, ], }, { group: 'Other', children: [ { value: 'opensuse', label: 'openSUSE', iconName: 'opensuse.svg', }, { value: 'alpine', label: 'Alpine Linux', iconName: 'alpine.png', }, { value: 'gentoo', label: 'Gentoo', iconName: 'gentoo.svg', }, { value: 'nix_channels', label: 'NixOS', iconName: 'nixos.svg', }, ], }, ] ================================================ FILE: docs/assets/js/components/mirrors-table/index.js ================================================ ComponentSystem.register('mirrors-table', { template: `

{{ startTitle[0] }} DebianUbuntuCentOSopenEuler {{ startTitle[1] }}

{{ startTitle[0] }} DebianUbuntuCentOSopenEuler {{ startTitle[1] }}

`, data() { return { allColumns: mirrorsTableColumns, columns: mirrorsTableColumns, originalData: mirrorsTableData, data: mirrorsTableData.slice(), rawFilterOptions: mirrorsTableFilterSelectOptions, selectedColumnFilters: [], selectedRowFilters: [], selectedCellStatuses: ['supported', 'unsupported', 'incompatible'], activeTableFilters: {}, } }, created() { const allKeys = this._flattenFilterKeys(this.filterOptions) const defaultHidden = new Set(['debian', 'ubuntu', 'centos', 'openeuler']) this.selectedColumnFilters = allKeys.filter((k) => !defaultHidden.has(k)) this.selectedRowFilters = Array.isArray(this.originalData) ? this.originalData.map((r) => r.name) : [] this._debouncedUpdateColumns = debounce(this._updateColumns.bind(this), 120) this._debouncedUpdateRows = debounce(this._updateRows.bind(this), 120) this._updateColumns() this._updateRows() }, computed: { isMobile() { return window.matchMedia('(max-width: 768px)').matches }, localeFlags() { const p = (window && window.location && window.location.pathname) || '' return { isZhHant: p.includes('/zh-Hant'), isEn: p.includes('/en'), } }, startTitle() { const f = this.localeFlags return f.isZhHant ? ['下方列表中的鏡像站均同步了', '軟體倉庫,列表根據單位性質、地理位置、名稱長度排序,與實際下載速度無關。'] : f.isEn ? ['All mirror sites in the list below synchronize the', 'software repositories. The list is sorted by institution type, geographic location, and name length, and is not related to actual download speed.'] : ['下方列表中的镜像站均同步了', '软件仓库,列表根据单位性质、地理位置、名称长度进行排序,与实际速度无关。'] }, globalConfig() { const f = this.localeFlags return { animation: { include: ['expand', 'fade'], exclude: [] }, table: f.isZhHant ? { empty: '\u66AB\u7121\u6578\u64DA', loadingText: '\u6B63\u5728\u8F09\u5165\u4E2D\uFF0C\u8ACB\u7A0D\u5F8C', loadingMoreText: '\u9EDE\u64CA\u8F09\u5165\u66F4\u591A', filterInputPlaceholder: '\u8ACB\u8F38\u5165\u5185\u5BB9\uFF08\u7121\u9ED8\u8A8D\u503C\uFF09', sortAscendingOperationText: '\u9EDE\u64CA\u5347\u5E8F', sortCancelOperationText: '\u9EDE\u64CA\u53D6\u6D88\u6392\u5E8F', sortDescendingOperationText: '\u9EDE\u64CA\u964D\u5E8F', clearFilterResultButtonText: '\u6E05\u7A7A\u7BE9\u9078', columnConfigButtonText: '\u884C\u914D\u7F6E', columnConfigTitleText: '\u8868\u683C\u884C\u914D\u7F6E', columnConfigDescriptionText: '\u8ACB\u9078\u64C7\u9700\u8981\u5728\u8868\u683C\u4E2D\u986F\u793A\u7684\u6578\u64DA\u884C', confirmText: '\u78BA\u8A8D', cancelText: '\u53D6\u6D88', resetText: '\u91CD\u7F6E', selectAllText: '\u5168\u9078', searchResultText: '\u641C\u5C0B"{result}"\uFF0C\u627E\u5230{count}\u9805\u7D50\u679C', } : f.isEn ? { empty: 'Empty Data', loadingText: 'loading...', loadingMoreText: 'loading more', filterInputPlaceholder: '', sortAscendingOperationText: 'click to sort ascending', sortCancelOperationText: 'click to cancel sorting', sortDescendingOperationText: 'click to sort descending', clearFilterResultButtonText: 'Clear', columnConfigButtonText: 'Column Config', columnConfigTitleText: 'Table Column Config', columnConfigDescriptionText: 'Please select columns to show them in the table', confirmText: 'Confirm', cancelText: 'Cancel', resetText: 'Reset', selectAllText: 'Select All', searchResultText: 'Search "{result}". Found no items. | Search "{result}". Found 1 item. | Search "{result}". Found {count} items.', } : undefined, select: f.isZhHant ? { empty: '\u66AB\u7121\u6578\u64DA', loadingText: '\u8F09\u5165\u4E2D', placeholder: '\u8ACB\u9078\u64C7', } : f.isEn ? { empty: 'Empty Data', loadingText: 'loading...', placeholder: 'please select', } : undefined, } }, selectPlaceholder() { const f = this.localeFlags return f.isZhHant ? '选择要显示的列' : f.isEn ? 'Select columns to show' : '选择要显示的列' }, rowSelectPlaceholder() { const f = this.localeFlags return f.isZhHant ? '筛选显示的镜像' : f.isEn ? 'Filter mirrors to show' : '筛选显示的镜像' }, rowFilterOptions() { const f = this.localeFlags const arr = Array.isArray(this.originalData) ? this.originalData.map((r) => ({ value: r.name, label: r.name, iconName: r.icon })) : [] const head = { value: '__all__', label: f.isZhHant ? '全選' : f.isEn ? 'Select All' : '全选', checkAll: true } return [head].concat(arr) }, rowFilterOptionsRendered() { return Array.isArray(this.rowFilterOptions) ? this.rowFilterOptions.map((o) => this._mapOptionForRow(o)) : [] }, statusLabels() { const f = this.localeFlags return { supported: f.isZhHant ? '支援' : f.isEn ? 'Supported' : '支持', unsupported: f.isZhHant ? '不支援' : f.isEn ? 'Unsupported' : '不支持', incompatible: f.isZhHant ? '不相容' : f.isEn ? 'Incompatible' : '不兼容', } }, showSupported() { return Array.isArray(this.selectedCellStatuses) && this.selectedCellStatuses.includes('supported') }, showUnsupported() { return Array.isArray(this.selectedCellStatuses) && this.selectedCellStatuses.includes('unsupported') }, showIncompatible() { return Array.isArray(this.selectedCellStatuses) && this.selectedCellStatuses.includes('incompatible') }, filterOptions() { return Array.isArray(this.rawFilterOptions) ? this.rawFilterOptions.map((o) => this._mapOptionForFilter(o)) : [] }, }, methods: { dataChange(data) { try { const hasColumnFilters = this.activeTableFilters && Object.keys(this.activeTableFilters).length > 0 const hasRowFilters = Array.isArray(this.selectedRowFilters) && this.selectedRowFilters.length > 0 if (hasColumnFilters || hasRowFilters) { return } this.data = data } catch {} }, onFilterChange() { if (this._debouncedUpdateColumns) this._debouncedUpdateColumns() else this._updateColumns() }, onRowFilterChange() { try { if (Array.isArray(this.selectedRowFilters) && this.selectedRowFilters.includes('__all__')) { this.selectedRowFilters = Array.isArray(this.originalData) ? this.originalData.map((r) => r.name) : [] } } catch {} if (this._debouncedUpdateRows) this._debouncedUpdateRows() else this._updateRows() }, getMirrorSiteBranchUrl(domain, branchName) { return `https://${domain}/${branchName.replace(/_/, '-')}/` }, _mapOptionForRow(opt) { const prefix = '/assets/images/icon/mirrors/' const copy = Object.assign({}, opt) if (copy.iconName) copy.prefixIcon = prefix + copy.iconName copy.content = function (h, ctx) { const option = (ctx && ctx.option) || copy const children = [] if (option.iconName) { children.push(h('img', { src: prefix + option.iconName, width: 16, height: 16, style: 'vertical-align: middle' })) } children.push(h('span', { style: option.iconName ? 'margin-left: 8px' : '' }, option.label || option.value || '')) return h('div', { style: 'display: flex; align-items: center' }, children) } return copy }, _mapOptionForFilter(opt) { const prefix = '/assets/images/icon/' const copy = Object.assign({}, opt) if (copy.iconName) copy.prefixIcon = prefix + copy.iconName copy.content = function (h, ctx) { const option = (ctx && ctx.option) || copy const children = [] if (option.iconName) { children.push(h('img', { src: prefix + option.iconName, width: 16, height: 16, style: 'vertical-align: middle' })) } children.push(h('span', { style: option.iconName ? 'margin-left: 8px' : '' }, option.label || option.value || '')) return h('div', { style: 'display: flex; align-items: center' }, children) } if (Array.isArray(copy.children)) { copy.children = copy.children.map((c) => this._mapOptionForFilter(c)) } return copy }, onCellStatusChange() { if (this._debouncedUpdateRows) this._debouncedUpdateRows() else this._updateRows() }, onTableFilterChange(filters) { try { this.activeTableFilters = filters || {} if (this._debouncedUpdateRows) this._debouncedUpdateRows() else this._updateRows() } catch {} }, _updateColumns() { try { const keys = new Set(this.selectedColumnFilters || []) this.columns = this.allColumns.filter((col) => col.colKey === 'name' || keys.has(col.colKey)) } catch (e) { this.columns = this.allColumns } }, _updateRows() { try { this._computeFilteredData() } catch {} }, _computeFilteredData() { try { let rows = Array.isArray(this.originalData) ? this.originalData.slice() : [] if (Array.isArray(this.selectedRowFilters) && this.selectedRowFilters.length) { const names = new Set(this.selectedRowFilters || []) rows = rows.filter((r) => names.has(r.name)) } const filters = this.activeTableFilters || {} const filterKeys = Object.keys(filters) if (filterKeys.length) { rows = rows.filter((row) => { for (let i = 0; i < filterKeys.length; i++) { const key = filterKeys[i] let value = filters[key] if (Array.isArray(value)) value = value.length ? value[0] : undefined if (!value) continue const cell = Object.prototype.hasOwnProperty.call(row, key) ? row[key] : undefined if (value === 'supported') { if (cell !== true) return false } else if (value === 'unsupported') { if (cell !== false) return false } else if (value === 'incompatible') { if (cell !== 'incompatible') return false } else { continue } } return true }) } this.data = rows } catch {} }, _flattenFilterKeys(options) { const set = new Set() options.forEach((opt) => { if (opt.group && Array.isArray(opt.children)) { opt.children.forEach((child) => { if (child && child.value) set.add(child.value) }) } else if (Array.isArray(opt.children)) { opt.children.forEach((child) => { if (child && child.value) set.add(child.value) }) } else if (opt.value) { set.add(opt.value) } }) return Array.from(set) }, }, }) ================================================ FILE: docs/assets/js/components/orama-ui/config.js ================================================ const OramaI18nData = { 'zh-Hans': { suggestions: ['如何使用', '支持哪些系统'], askAiText: '询问 AI', searchText: '搜索', toSelectText: '选择', toNavigateText: '导航', toCloseText: '关闭', dictionary: { searchPlaceholder: '请输入要搜索的内容...', chatPlaceholder: '有什么可以帮你的吗?', noResultsFound: '未找到结果', noResultsFoundFor: '未找到与该内容相关的结果', suggestionsTitle: '建议', seeAll: '查看全部', addMore: '添加更多', clearChat: '清空聊天', errorMessage: '尝试搜索时发生错误。请重试。', disclaimer: 'AI 可能会出错,请核实信息。', startYourSearch: '开始搜索', initErrorSearch: '无法初始化搜索服务', initErrorChat: '无法初始化聊天服务', chatButtonLabel: '询问 AI', searchButtonLabel: '搜索', }, }, 'zh-Hant': { suggestions: ['如何使用', '支援哪些系統'], askAiText: '詢問 AI', searchText: '搜尋', toSelectText: '選擇', toNavigateText: '導航', toCloseText: '關閉', dictionary: { searchPlaceholder: '請輸入要搜尋的內容...', chatPlaceholder: '有什麼可以幫你的嗎?', noResultsFound: '未找到結果', noResultsFoundFor: '未找到與該內容相關的結果', suggestionsTitle: '建議', seeAll: '看全部', addMore: '添加更多', clearChat: '清空聊天', errorMessage: '嘗試搜尋時發生錯誤。請重試。', disclaimer: 'AI 可能會出錯,請核實資訊。', startYourSearch: '開始搜尋', initErrorSearch: '無法初始化搜尋服務', initErrorChat: '無法初始化聊天服務', chatButtonLabel: '詢問 AI', searchButtonLabel: '搜尋', }, }, en: { suggestions: ['How to use', 'What systems are supported'], askAiText: 'Ask AI', searchText: 'Search', toSelectText: 'Select', toNavigateText: 'Navigate', toCloseText: 'Close', dictionary: { searchPlaceholder: 'Please enter the content to search...', chatPlaceholder: 'How can I help you?', noResultsFound: 'No results found', noResultsFoundFor: 'No results found for', suggestionsTitle: 'Suggestions', seeAll: 'See all', addMore: 'Add more', clearChat: 'Clear chat', errorMessage: 'An error occurred while trying to search. Please try again.', disclaimer: 'AI can make mistakes. Please verify the information.', startYourSearch: 'Start your search', initErrorSearch: 'Unable to initialize search service', initErrorChat: 'Unable to initialize chat service', chatButtonLabel: 'Ask AI', searchButtonLabel: 'Search', }, }, } // get search box config function getOramaSearchBoxConfig() { const currentLang = __isZhHant ? 'zh-Hant' : __isEn ? 'en' : 'zh-Hans' return { themeConfig: { // colors: { // light: { // '--text-color-accent': 'var(--md-accent-fg-color)', // '--background-color-tertiary': 'var(--md-accent-fg-color--transparent)', // '--background-color-accent': 'var(--md-accent-fg-color)', // '--border-color-accent': 'var(--md-accent-fg-color)', // '--button-background-color-primary': 'var(--md-accent-fg-color)', // '--button-background-color-secondary': 'hsla(240, 9%, 75%, 0.33)', // '--button-background-color-secondary-hover': 'var(--md-accent-fg-color--transparent)', // '--chat-button-border-color-gradientThree': 'var(--md-accent-fg-color)', // '--chat-button-border-color-gradientFour': 'var(--md-accent-fg-color)', // '--chat-button-background-color-gradientOne': 'var(--md-accent-fg-color)', // }, // dark: { // '--text-color-accent': 'var(--md-accent-fg-color)', // '--background-color-primary': 'var(--md-default-bg-color--dark)', // '--background-color-secondary': '#1a1b20', // '--background-color-tertiary': 'var(--md-accent-fg-color--transparent)', // '--background-color-accent': 'var(--md-accent-fg-color)', // '--border-color-accent': 'var(--md-accent-fg-color)', // '--icon-color-reverse': 'var(--md-default-bg-color--dark)', // '--button-background-color-primary': 'var(--md-accent-fg-color)', // '--button-background-color-secondary': 'hsla(var(--md-hue), 15%, 9%, 0.33)', // '--button-background-color-secondary-hover': 'var(--md-accent-fg-color--transparent)', // '--chat-button-border-color-gradientThree': 'var(--md-accent-fg-color)', // '--chat-button-border-color-gradientFour': 'var(--md-accent-fg-color)', // '--chat-button-background-color-gradientOne': 'var(--md-accent-fg-color)', // }, // }, // shadow: { // '--textarea-shadow': 'var(--md-shadow-z1)', // }, // typography: { // '--font-primary': 'var(--md-font-family)', // }, }, index: { endpoint: 'https://cloud.orama.run/v1/indexes/linuxmirrors-cn-imxypv', api_key: 'mBJ0b68dZIk79DqCkdUSJI6yQMo4L4o3', }, facetProperty: 'category', sourceBaseUrl: 'https://linuxmirrors.cn', sourcesMap: { title: 'title', }, resultMap: { title: 'title', description: 'content', section: 'category', }, suggestions: OramaI18nData[currentLang].suggestions, dictionary: OramaI18nData[currentLang].dictionary, } } // localization search box component function localizationOramaSearchBox(searchBox) { if (!searchBox) return const currentLang = __isZhHant ? 'zh-Hant' : __isEn ? 'en' : 'zh-Hans' const askAiText = OramaI18nData[currentLang].askAiText const searchText = OramaI18nData[currentLang].searchText const observer = new MutationObserver((mutations, obs) => { const shadowRoot = searchBox.shadowRoot if (shadowRoot) { // Get a summary (Only PC) // const chatButton = shadowRoot.querySelector('.chat-button') // if (chatButton) { // const element = chatButton.querySelector('.button-label') // if (element && element.textContent !== askAiText) { // element.textContent = askAiText // } // } const footer = shadowRoot.querySelector('orama-footer') if (footer) { // Keyboard shortcuts localization (Only PC) const toSelectText = OramaI18nData[currentLang].toSelectText const toNavigateText = OramaI18nData[currentLang].toNavigateText const toCloseText = OramaI18nData[currentLang].toCloseText const shortcutDescriptions = footer.querySelectorAll('.shortcut-description') shortcutDescriptions.forEach((element) => { if (element.textContent === 'to select' && element.textContent !== toSelectText) { element.textContent = toSelectText } else if (element.textContent === 'to navigate' && element.textContent !== toNavigateText) { element.textContent = toNavigateText } else if (element.textContent === 'to close' && element.textContent !== toCloseText) { element.textContent = toCloseText } }) // Change logo image const logoImg = footer.querySelector('.logo-link .logo') if (logoImg) { let theme = 'light' try { const palette = __md_get('__palette') if (palette && typeof palette.color === 'object') { theme = palette.color.scheme === 'slate' ? 'dark' : 'light' } } catch {} logoImg.src = `/assets/images/icon/orama/orama-when-${theme}.svg` } } // Hide "Orama can make mistakes. Please verify the information." // const chatFormWrapper = shadowRoot.querySelector('.chat-form-wrapper') // if (chatFormWrapper) { // const element = chatFormWrapper.querySelector('p.small.text-center') // if (element) { // element.style = 'display: none;' // } // } // Navigation bar (Only Mobile) const navigationBar = shadowRoot.querySelector('orama-navigation-bar') if (navigationBar) { const toggler = navigationBar.querySelector('orama-toggler') if (toggler) { const searchSpan = toggler.querySelector('span:nth-child(1)') if (searchSpan && searchSpan.textContent !== searchText) { searchSpan.textContent = searchText searchSpan.style = 'max-height: fit-content;' } const askAISpan = toggler.querySelector('span:nth-child(2)') if (askAISpan && askAISpan.textContent !== askAiText) { askAISpan.textContent = askAiText askAISpan.style = 'max-height: fit-content;' } } } } }) observer.observe(searchBox, { childList: true, subtree: true, attributes: true }) setTimeout(() => observer.disconnect(), 2000) } ================================================ FILE: docs/assets/js/components/orama-ui/index-native.js ================================================ function loadOramaWebComponent() { const searchBox = document.querySelector('orama-search-box') if (searchBox) { Object.assign(searchBox, getOramaSearchBoxConfig()) } // custom entrance button style const searchButton = document.querySelector('orama-search-button') if (searchButton) { searchButton.textContent = '搜索' const observer = new MutationObserver((_mutations, obs) => { if (searchButton.shadowRoot) { const button = searchButton.shadowRoot.querySelector('button') if (button) { button.style = 'border-radius: 8px !important;' button.querySelector('.button__label').style = 'height: 22px; padding: 2px 8px; font-size: 0.75rem;' button.querySelector('span[slot="adorment-end"], .kyb-shortcut').style = 'display: none;' // search icon style const magnifyingGlassShadowRoot = button.querySelector('ph-magnifying-glass').shadowRoot const styleElement = document.createElement('style') styleElement.textContent = ` svg { font-size: 24px; }` if (!magnifyingGlassShadowRoot.querySelector('style[data-custom="icon-style"]')) { styleElement.setAttribute('data-custom', 'icon-style') magnifyingGlassShadowRoot.appendChild(styleElement) } obs.disconnect() } } }) observer.observe(searchButton, { childList: true, subtree: true, attributes: true, characterData: true, }) setTimeout(() => observer.disconnect(), 2000) } searchButton.addEventListener('click', function () { const searchBox = document.querySelector('orama-search-box') // localization chat box component localizationOramaSearchBox(searchBox) }) } ================================================ FILE: docs/assets/js/components/orama-ui/index.js ================================================ function loadOramaWebComponent() { const searchBox = document.querySelector('orama-search-box') if (searchBox) { Object.assign(searchBox, getOramaSearchBoxConfig()) } // define global function window.openOramaSearch = function (event) { const element = document.querySelector('orama-search-box') if (element) { element.open = true localizationOramaSearchBox(element) } return false } // localization chat box component if (searchBox) { const openObserver = new MutationObserver((mutations) => { mutations.forEach((mutation) => { if (mutation.type === 'attributes' && mutation.attributeName === 'open' && searchBox.hasAttribute('open')) { localizationOramaSearchBox(searchBox) } }) }) openObserver.observe(searchBox, { attributes: true }) if (searchBox.hasAttribute('open')) { localizationOramaSearchBox(searchBox) } } } ================================================ FILE: docs/assets/js/modules/tdesign-theme.js ================================================ // 更新 TDesign 主题 function updateTDesignGlobalTheme() { const scheme = document.querySelector('[data-md-color-scheme]')?.getAttribute('data-md-color-scheme') const isDarkMode = scheme === 'slate' || scheme === 'dark' if (isDarkMode) { document.documentElement.setAttribute('theme-mode', 'dark') } else { document.documentElement.removeAttribute('theme-mode') } } // 主题监听器 function setupThemeObserver() { // 监听主题变化 const observer = new MutationObserver(() => { updateTDesignGlobalTheme() }) const element = document.querySelector('[data-md-color-scheme]') if (element) { observer.observe(element, { attributes: true, attributeFilter: ['data-md-color-scheme'], }) } else { // 如果元素不存在,等待页面加载完成后重试 setTimeout(setupThemeObserver, 1000) } } document.addEventListener('DOMContentLoaded', function () { setupThemeObserver() }) ================================================ FILE: docs/assets/js/useThemeTransition.js ================================================ function useThemeTransition() { // 更新过渡样式变量 function updateViewTransitionVariables(isDarkTheme) { document.documentElement.style.setProperty('--view-transition-z-index-foreground', isDarkTheme ? '999' : '1') document.documentElement.style.setProperty('--view-transition-z-index-background', isDarkTheme ? '1' : '999') } // 切换主题按钮点击事件 function handleThemeToggle(e) { // 阻止默认点击事件 e.preventDefault() e.stopPropagation() // 获取目标输入元素 const targetId = this.getAttribute('for') const targetInput = document.getElementById(targetId) if (!targetInput) return // 获取主题状态 const targetTheme = targetInput.getAttribute('data-md-color-scheme') // 目标主题(system、default、slate) const systemTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'slate' : 'default' // 系统主题(default、slate) const currentScheme = document.body.getAttribute('data-md-color-scheme') // 当前主题(default、slate) // 当目标主题与当前主题相同时不触发动画 if (targetTheme === 'system') { if (systemTheme === currentScheme) { targetInput.click() return } } else if (targetTheme === currentScheme) { targetInput.click() return } // 当前主题状态 const isSystemDarkTheme = systemTheme === 'slate' // 系统是否为深色主题 const isCurrentDarkTheme = currentScheme.includes('slate') // 当前是否为深色主题 const isSwitchToDarkTheme = !isCurrentDarkTheme // 是否将切换到深色主题 // 根据系统主题设置动画样式 updateViewTransitionVariables(isSystemDarkTheme) // 判断切换方向是否与系统主题一致 // 如果系统是深色,切换到深色是"靠近系统";如果系统是浅色,切换到浅色是"靠近系统" const isMovingTowardsSystemTheme = (isSwitchToDarkTheme && isSystemDarkTheme) || (!isSwitchToDarkTheme && !isSystemDarkTheme) // 动画参数 const x = e.clientX const y = e.clientY const endRadius = Math.hypot(Math.max(x, window.innerWidth - x), Math.max(y, window.innerHeight - y)) const clipPath = [`circle(0px at ${x}px ${y}px)`, `circle(${endRadius}px at ${x}px ${y}px)`] // 启动视图过渡 document .startViewTransition(async () => { // 切换主题 targetInput.click() // 添加CSS类用于动画控制 document.documentElement.classList.remove(isSwitchToDarkTheme ? 'light' : 'dark') document.documentElement.classList.add(isSwitchToDarkTheme ? 'dark' : 'light') // 等待主题变化完成 await new Promise((resolve) => setTimeout(resolve, 100)) }) .ready.then(() => { // 当朝向系统主题方向变化时使用使用缩小效果(reversed clipPath),反之放大效果(clipPath) document.documentElement.animate( { clipPath: isMovingTowardsSystemTheme ? [...clipPath].reverse() : clipPath, transform: 'translateZ(0)', }, { duration: 500, easing: 'ease-in', pseudoElement: isMovingTowardsSystemTheme ? '::view-transition-old(root)' : '::view-transition-new(root)', } ) }) } // 不支持此特性 if (typeof document.startViewTransition !== 'function') { return } // 获取主题切换按钮Dom const themeToggles = document.querySelectorAll('form[data-md-component="palette"] .md-header__button.md-icon') themeToggles.forEach((toggle) => { toggle.addEventListener('click', handleThemeToggle, { capture: true }) }) // 初始化主题状态类 const currentScheme = document.body.getAttribute('data-md-color-scheme') const isDark = currentScheme.includes('slate') document.documentElement.classList.add(isDark ? 'dark' : 'light') // 初始化过渡样式变量 updateViewTransitionVariables(isDark) } document.addEventListener('DOMContentLoaded', function () { useThemeTransition() }) ================================================ FILE: docs/changelog/index.en.md ================================================ --- hide: - navigation - footer search: exclude: true --- ### `2026-01-04` * Added support for EndeavourOS [#30310f5](https://github.com/SuperManito/LinuxMirrors/commit/30310f5508b1943b647b54834dd60c206d9fb366) ### `2025-11-02` * Adapted for Kylin Server to docker script [#1ddf1fb](https://github.com/SuperManito/LinuxMirrors/commit/1ddf1fb708987cf59c4ef56b0a0410caf1b8e726) ### `2025-10-12` * Added support for I18n [#bf2adc1](https://github.com/SuperManito/LinuxMirrors/commit/bf2adc1adf4f2de4820f617a23aabf247a47281c) ### `2025-09-28` * Adapted for openSUSE 16 [#a934676](https://github.com/SuperManito/LinuxMirrors/commit/a934676aeb4dfc1d008b2b46ecea5811d7382317) ### `2025-09-26` * Added `Specify Docker CE source repository version` command option to docker script [#4c7860d](https://github.com/SuperManito/LinuxMirrors/commit/4c7860d48cfefded15c32f1baa0f544fde18e8ce) ### `2025-08-07` * Adapted for TencentOS Server & Alibaba Cloud Linux to docker script [#00f3b19](https://github.com/SuperManito/LinuxMirrors/commit/00f3b19edfcb152f22337306e7fc25e135e75c14) ### `2025-08-03` * Adapted for Huawei Cloud EulerOS to docker script [#b19f748](https://github.com/SuperManito/LinuxMirrors/commit/b19f748154d66fa6a385726ae899db5740499a7e) ### `2025-07-18` * Added support for Oracle Linux OS [#76b8b08](https://github.com/SuperManito/LinuxMirrors/commit/76b8b0834ae493ed8731c83440c4a8f4dcad17dc) ### `2025-06-15` * Adapted for Rocky Linux 10 [#dafaa13](https://github.com/SuperManito/LinuxMirrors/commit/dafaa13e44209d719b5b6f06f4cc3c4f2ef24d3b) ### `2025-06-03` * Added support for Manjaro OS [#a93f23e](https://github.com/SuperManito/LinuxMirrors/commit/a93f23e48d4ffbffb0e04efcf33138fc7218b560) ### `2025-05-29` * Adapted for Red Hat Enterprise Linux 10 & AlmaLinux 10 [#26f493a](https://github.com/SuperManito/LinuxMirrors/commit/26f493a762221569404d45a6556afd7945ac75f8) ### `2025-05-13` * Enabled DEB822 format for new versions of Debian and Ubuntu repositories [#c3d0d5f](https://github.com/SuperManito/LinuxMirrors/commit/c3d0d5fa2c0993e104711f55e37fa8ada1031b5e) ### `2025-05-12` * Added `Only Replace Mirror Accelerator` command option to docker script [#3f13f40](https://github.com/SuperManito/LinuxMirrors/commit/3f13f40111fa3631555ca7104cea21b4bb5adefa) ### `2025-05-11` * Adapted for Anolis OS 8.10 [#582b1d1](https://github.com/SuperManito/LinuxMirrors/commit/582b1d1fbcc3cab4899d4d400cf9a51023773aad) ### `2025-04-05` * Added "Clean Mode" command option [#e63dea7](https://github.com/SuperManito/LinuxMirrors/commit/e63dea7e64fa6c31ecee3c02b143924ab12917b4) ### `2025-03-16` * Adapted for EPEL 10 [#b71c0b9](https://github.com/SuperManito/LinuxMirrors/commit/b71c0b9790cc1dfb431729b817e726d6dd19a555) ### `2025-03-15` * Added support for Raspberry Pi OS [#c08000c](https://github.com/SuperManito/LinuxMirrors/commit/c08000cb645994d669e5ca2678d429a9d9eb3c90) ### `2025-03-14` * Adapted for CentOS Stream 10 [#12eb98c](https://github.com/SuperManito/LinuxMirrors/commit/12eb98ce2945294873bfaa7b422fda175d9f8c10) ### `2025-02-20` * Added support for NixOS [#4d91f7d](https://github.com/SuperManito/LinuxMirrors/commit/4d91f7d1b2ddd58f7794cc7620d0ea7e4f9af02b) ...... ================================================ FILE: docs/changelog/index.md ================================================ --- hide: - navigation - footer search: exclude: true --- ### `2026-01-04` * 新增适配 EndeavourOS 操作系统 [#30310f5](https://github.com/SuperManito/LinuxMirrors/commit/30310f5508b1943b647b54834dd60c206d9fb366) ### `2025-11-02` * Docker 脚本新增适配 Kylin Server 操作系统 [#1ddf1fb](https://github.com/SuperManito/LinuxMirrors/commit/1ddf1fb708987cf59c4ef56b0a0410caf1b8e726) ### `2025-10-12` * 新增适配 I18n [#bf2adc1](https://github.com/SuperManito/LinuxMirrors/commit/bf2adc1adf4f2de4820f617a23aabf247a47281c) ### `2025-09-28` * 适配 openSUSE 16 [#a934676](https://github.com/SuperManito/LinuxMirrors/commit/a934676aeb4dfc1d008b2b46ecea5811d7382317) ### `2025-09-26` * Docker 脚本新增 `指定 Docker CE 软件源仓库版本` 命令选项 [#4c7860d](https://github.com/SuperManito/LinuxMirrors/commit/4c7860d48cfefded15c32f1baa0f544fde18e8ce) ### `2025-08-07` * Docker 脚本新增适配 TencentOS Server & Alibaba Cloud Linux 操作系统 [#00f3b19](https://github.com/SuperManito/LinuxMirrors/commit/00f3b19edfcb152f22337306e7fc25e135e75c14) ### `2025-08-03` * Docker 脚本新增适配 Huawei Cloud EulerOS 操作系统 [#b19f748](https://github.com/SuperManito/LinuxMirrors/commit/b19f748154d66fa6a385726ae899db5740499a7e) ### `2025-07-18` * 新增适配 Oracle Linux 操作系统 [#76b8b08](https://github.com/SuperManito/LinuxMirrors/commit/76b8b0834ae493ed8731c83440c4a8f4dcad17dc) ### `2025-06-15` * 适配 Rocky Linux 10 [#dafaa13](https://github.com/SuperManito/LinuxMirrors/commit/dafaa13e44209d719b5b6f06f4cc3c4f2ef24d3b) ### `2025-06-03` * 新增适配 Manjaro 操作系统 [#a93f23e](https://github.com/SuperManito/LinuxMirrors/commit/a93f23e48d4ffbffb0e04efcf33138fc7218b560) ### `2025-05-29` * 适配 Red Hat Enterprise Linux 10 & AlmaLinux 10 [#26f493a](https://github.com/SuperManito/LinuxMirrors/commit/26f493a762221569404d45a6556afd7945ac75f8) ### `2025-05-13` * 为 Debian 和 Ubuntu 的新版本软件源启用 DEB822 格式 [#c3d0d5f](https://github.com/SuperManito/LinuxMirrors/commit/c3d0d5fa2c0993e104711f55e37fa8ada1031b5e) ### `2025-05-12` * Docker 脚本新增 `仅更换镜像加速器` 命令选项 [#3f13f40](https://github.com/SuperManito/LinuxMirrors/commit/3f13f40111fa3631555ca7104cea21b4bb5adefa) ### `2025-05-11` * 适配 Anolis OS 8.10 [#582b1d1](https://github.com/SuperManito/LinuxMirrors/commit/582b1d1fbcc3cab4899d4d400cf9a51023773aad) ### `2025-04-05` * 命令选项新增 `纯净模式` [#e63dea7](https://github.com/SuperManito/LinuxMirrors/commit/e63dea7e64fa6c31ecee3c02b143924ab12917b4) ### `2025-03-16` * 适配 EPEL 10 [#b71c0b9](https://github.com/SuperManito/LinuxMirrors/commit/b71c0b9790cc1dfb431729b817e726d6dd19a555) ### `2025-03-15` * 新增适配 Raspberry Pi OS 操作系统 [#c08000c](https://github.com/SuperManito/LinuxMirrors/commit/c08000cb645994d669e5ca2678d429a9d9eb3c90) ### `2025-03-14` * 适配 CentOS Stream 10 [#12eb98c](https://github.com/SuperManito/LinuxMirrors/commit/12eb98ce2945294873bfaa7b422fda175d9f8c10) ### `2025-02-20` * 新增适配 NixOS 操作系统 [#4d91f7d](https://github.com/SuperManito/LinuxMirrors/commit/4d91f7d1b2ddd58f7794cc7620d0ea7e4f9af02b) ...... ================================================ FILE: docs/changelog/index.zh-Hant.md ================================================ --- hide: - navigation - footer search: exclude: true --- ### `2026-01-04` * 新增適配 EndeavourOS 作業系統 [#30310f5](https://github.com/SuperManito/LinuxMirrors/commit/30310f5508b1943b647b54834dd60c206d9fb366) ### `2025-11-02` * Docker 腳本新增適配 Kylin Server 作業系統 [#1ddf1fb](https://github.com/SuperManito/LinuxMirrors/commit/1ddf1fb708987cf59c4ef56b0a0410caf1b8e726) ### `2025-10-12` * 新增適配 I18n [#bf2adc1](https://github.com/SuperManito/LinuxMirrors/commit/bf2adc1adf4f2de4820f617a23aabf247a47281c) ### `2025-09-28` * 適配 openSUSE 16 [#a934676](https://github.com/SuperManito/LinuxMirrors/commit/a934676aeb4dfc1d008b2b46ecea5811d7382317) ### `2025-09-26` * Docker 腳本新增 `指定 Docker CE 軟體源倉庫版本` 命令選項 [#4c7860d](https://github.com/SuperManito/LinuxMirrors/commit/4c7860d48cfefded15c32f1baa0f544fde18e8ce) ### `2025-08-07` * Docker 腳本新增適配 TencentOS Server & Alibaba Cloud Linux 作業系統 [#00f3b19](https://github.com/SuperManito/LinuxMirrors/commit/00f3b19edfcb152f22337306e7fc25e135e75c14) ### `2025-08-03` * Docker 腳本新增適配 Huawei Cloud EulerOS 作業系統 [#b19f748](https://github.com/SuperManito/LinuxMirrors/commit/b19f748154d66fa6a385726ae899db5740499a7e) ### `2025-07-18` * 新增適配 Oracle Linux 作業系統 [#76b8b08](https://github.com/SuperManito/LinuxMirrors/commit/76b8b0834ae493ed8731c83440c4a8f4dcad17dc) ### `2025-06-15` * 適配 Rocky Linux 10 [#dafaa13](https://github.com/SuperManito/LinuxMirrors/commit/dafaa13e44209d719b5b6f06f4cc3c4f2ef24d3b) ### `2025-06-03` * 新增適配 Manjaro 作業系統 [#a93f23e](https://github.com/SuperManito/LinuxMirrors/commit/a93f23e48d4ffbffb0e04efcf33138fc7218b560) ### `2025-05-29` * 適配 Red Hat Enterprise Linux 10 & AlmaLinux 10 [#26f493a](https://github.com/SuperManito/LinuxMirrors/commit/26f493a762221569404d45a6556afd7945ac75f8) ### `2025-05-13` * 為 Debian 和 Ubuntu 的新版本軟體源啟用 DEB822 格式 [#c3d0d5f](https://github.com/SuperManito/LinuxMirrors/commit/c3d0d5fa2c0993e104711f55e37fa8ada1031b5e) ### `2025-05-12` * Docker 腳本新增 `僅更換鏡像加速器` 命令選項 [#3f13f40](https://github.com/SuperManito/LinuxMirrors/commit/3f13f40111fa3631555ca7104cea21b4bb5adefa) ### `2025-05-11` * 適配 Anolis OS 8.10 [#582b1d1](https://github.com/SuperManito/LinuxMirrors/commit/582b1d1fbcc3cab4899d4d400cf9a51023773aad) ### `2025-04-05` * 命令選項新增 `純淨模式` [#e63dea7](https://github.com/SuperManito/LinuxMirrors/commit/e63dea7e64fa6c31ecee3c02b143924ab12917b4) ### `2025-03-16` * 適配 EPEL 10 [#b71c0b9](https://github.com/SuperManito/LinuxMirrors/commit/b71c0b9790cc1dfb431729b817e726d6dd19a555) ### `2025-03-15` * 新增適配 Raspberry Pi OS 作業系統 [#c08000c](https://github.com/SuperManito/LinuxMirrors/commit/c08000cb645994d669e5ca2678d429a9d9eb3c90) ### `2025-03-14` * 適配 CentOS Stream 10 [#12eb98c](https://github.com/SuperManito/LinuxMirrors/commit/12eb98ce2945294873bfaa7b422fda175d9f8c10) ### `2025-02-20` * 新增適配 NixOS 作業系統 [#4d91f7d](https://github.com/SuperManito/LinuxMirrors/commit/4d91f7d1b2ddd58f7794cc7620d0ea7e4f9af02b) ...... ================================================ FILE: docs/changelog/sitemap.en.xml ================================================ ================================================ FILE: docs/changelog/sitemap.xml ================================================ ================================================ FILE: docs/changelog/sitemap.zh-Hant.xml ================================================ ================================================ FILE: docs/community/index.en.md ================================================ --- comments: true comments_description: Please ensure that the discussion content is relevant to the project and do not publish any illegal content such as advertisements hide: - navigation - toc - footer --- ================================================ FILE: docs/community/index.md ================================================ --- comments: true comments_description: 请确保讨论内容与项目的相关性,不得发布广告等违规内容 hide: - navigation - toc - footer --- ================================================ FILE: docs/community/index.zh-Hant.md ================================================ --- comments: true comments_description: 請確保討論內容與專案的相關性,不得發布廣告等違規內容 hide: - navigation - toc - footer --- ================================================ FILE: docs/community/sitemap.en.xml ================================================ ================================================ FILE: docs/community/sitemap.xml ================================================ ================================================ FILE: docs/community/sitemap.zh-Hant.xml ================================================ ================================================ FILE: docs/index.en.md ================================================ --- title: One-Click Script Makes Mirror Switching Easier description: GNU/Linux mirror switching script & Docker installation and registry mirror switching script comments: true glightbox: false comments_description: This comment section is only for sharing project usage reviews and experiences. For issues or suggestions, please go to the Community or Issues hide: - navigation - toc - footer ---
LinuxMirrors LinuxMirrors
GNU/Linux mirror switching script & Docker installation and registry mirror switching script
One-Click Script Makes Mirror Switching Easier
=== ":linux:{ .middle } GNU/Linux" command-linux command-linux === ":simple-docker:{ .lg .middle style="color: #1d63ed"} Docker" command-docker command-docker
- :material-thumb-up-outline:{ .lg .middle } __Easy to Use__ --- Just one command to run directly, zero technical barrier, no dependencies required Documentation integrates AI search and chat, providing solutions for various use cases - :material-vector-polyline:{ .lg .middle } __Wide System Support__ --- Supports up to `26+` operating systems, covering various versions, accurately identifying system types High script compatibility, unsupported systems will prompt and exit without operation - :material-vector-triangle:{ .lg .middle } __Diverse Mirror Adaptation__ --- In-depth research on domestic mirror site compatibility Also provides a collection of domestic education network and overseas mirrors for users to choose - :material-rocket-launch-outline:{ .lg .middle } __Fast and Efficient__ --- Mirror switching can be completed in as little as 10 seconds, efficient operations, saving a lot of time The project has undergone years of iteration and optimization, with excellent script performance and stability, and comprehensive scenario handling - :octicons-globe-24:{ .lg .middle } __Global Network, Worry-Free Access__ --- This website provides global edge network acceleration, easily accessible in any network environment Multiple backup addresses are provided to ensure the script is always available, truly worry-free usage - :material-arm-flex-outline:{ .lg .middle } __Powerful and Unmatched__ --- The script guides users step by step to select mirror configurations via arrow key interaction, making switching easier In addition, the script offers rich command options, supporting CI/CD integration and automated operations - :material-pencil-ruler-outline:{ .lg .middle } __Highly Customizable__ --- Script command options are designed according to formal application standards, meeting various advanced needs Code structure is clear, easy to read and modify, and supports customization after cloning, supports multi-language printing - :material-scale-balance:{ .lg .middle } __Free and Open Source__ --- The project is licensed under the MIT open source license, script code is fully open source and free to use Please respect the author's intellectual achievements, and indicate the source or project address prominently when sharing
| Operating System | Supported Versions | | --- | :---: | | Debian **Debian** | _8~13_ | | Ubuntu **Ubuntu** :material-information-outline:{ title="Supports Ubuntu family derivatives, such as UKylin, Kubuntu, etc.
Due to rapid iteration, not all non-LTS versions are directly supported. See documentation for details." } | _14~25_ | | Kali Linux **Kali Linux** | _all_ | | Linux Mint **Linux Mint** | _17~22 / LMDE 2~7_ | | Deepin **Deepin** | _all_ | | Zorin OS **Zorin OS** | _all_ | | Armbian **Armbian** | _all_ | | Proxmox VE **Proxmox VE** | _all_ | | Raspberry Pi OS **Raspberry Pi OS** | _all_ | | Red Hat Enterprise Linux **Red Hat Enterprise Linux** :material-information-outline:{ title="Uses CentOS Stream or CentOS mirrors" } | _7~10_ | | Fedora **Fedora** | _30~43_ | | CentOS **CentOS** | _7~8 / Stream 8~10_ | | Rocky Linux **Rocky Linux** | _8~10_ | | AlmaLinux **AlmaLinux** | _8~10_ | | Oracle Linux **Oracle Linux** :material-information-outline:{ title="Uses CentOS Stream mirrors" } | _8~10_ | | openEuler **openEuler** | _20~25_ | | OpenCloudOS **OpenCloudOS** | _8.6~9 / Stream 23_ | | openKylin **openKylin** | _all_ | | Anolis OS **Anolis OS** | _8 / 23_ | | openSUSE **openSUSE** | _Leap 15 ~ 16 / Tumbleweed_ | | Arch Linux **Arch Linux** | _all_ | | Manjaro **Manjaro** | _all_ | | EndeavourOS **EndeavourOS** | _all_ | | Alpine Linux **Alpine Linux** | _v3 / edge_ | | Gentoo **Gentoo** | _all_ | | NixOS **NixOS** | _19~25_ |
[Get Started](use/index.md){ .md-button .md-button--primary }   [Mirror List](mirrors/index.md){ .md-button }
--8<-- "docs/sponsor/main.html" ================================================ FILE: docs/index.md ================================================ --- title: 一键脚本使换源更简单 description: GNU/Linux 更换系统软件源脚本及 Docker 安装与换源脚本 comments: true glightbox: false comments_description: 该评论区仅用于展示项目使用评价和经验分享,反馈问题或建议请前往社区Issues hide: - navigation - toc - footer ---
LinuxMirrors LinuxMirrors
GNU/Linux 更换系统软件源脚本及 Docker 安装与换源脚本
一键脚本使换源更简单
=== ":linux:{ .middle } GNU/Linux" command-linux command-linux === ":simple-docker:{ .lg .middle style="color: #1d63ed"} Docker" command-docker command-docker
- :material-thumb-up-outline:{ .lg .middle } __轻松使用__ --- 只需要一行命令就能直接运行,零技术门槛,无需安装任何依赖 文档集成了 AI 搜索与聊天,提供各种使用场景的解决方案 - :material-vector-polyline:{ .lg .middle } __系统支持广泛__ --- 已适配高达 `26+` 操作系统,涵盖各类版本,精准识别系统类型 脚本兼容性高,不支持的系统会有相应提示并无操作跳出 - :material-vector-triangle:{ .lg .middle } __多元软件源适配__ --- 深入考察了国内镜像站的系统适配情况,专为中国用户打造 还提供全网搜集的国内教育网和海外镜像站供用户选择 - :material-rocket-launch-outline:{ .lg .middle } __快,且高效__ --- 最快仅需 10 秒即可完成软件源的更换,高效运维,节省大量时间成本 项目经过数年的迭代与优化,脚本性能卓越运行稳定,场景判断完善 - :octicons-globe-24:{ .lg .middle } __全球网络,调用无忧__ --- 本网站提供全球边缘网络加速,不惧各种网络环境,国内轻松访问 同时提供了多个备用地址以确保项目脚本始终可用,真正做到使用无忧 - :material-arm-flex-outline:{ .lg .middle } __功能强大,无与伦比__ --- 脚本通过方向键交互逐步引导用户选择软件源配置,使换源更简单 此外脚本提供了丰富的命令选项,支持 CI/CD 集成与自动化运维 - :material-pencil-ruler-outline:{ .lg .middle } __高度可定制__ --- 脚本命令选项遵循正式应用程序规范设计,能够满足各种高级需求 代码结构清晰,易于阅读和修改,支持克隆后定制,支持多语言打印 - :material-scale-balance:{ .lg .middle } __自由,开源__ --- 项目已设立 MIT 开源许可协议,脚本代码完全开源且免费使用 请尊重作者的知识成果,传播时请在显著位置标注来源或项目地址
| 操作系统 | 适配版本 | | --- | :---: | | Debian **Debian** | _8~13_ | | Ubuntu **Ubuntu** :material-information-outline:{ title="支持乌班图家族衍生操作系统,例如 优麒麟 Kubuntu
由于迭代速度较快并不直接支持所有非 LTS 的版本,具体详见文档" } | _14~25_ | | Kali Linux **Kali Linux** | _all_ | | Linux Mint **Linux Mint** | _17~22 / LMDE 2~7_ | | Deepin **Deepin(深度)** | _all_ | | Zorin OS **Zorin OS** | _all_ | | Armbian **Armbian** | _all_ | | Proxmox VE **Proxmox VE** | _all_ | | Raspberry Pi OS **Raspberry Pi OS** | _all_ | | Red Hat Enterprise Linux **Red Hat Enterprise Linux** :material-information-outline:{ title="使用 CentOS StreamCentOS 源" } | _7~10_ | | Fedora **Fedora** | _30~43_ | | CentOS **CentOS** | _7~8 / Stream 8~10_ | | Rocky Linux **Rocky Linux** | _8~10_ | | AlmaLinux **AlmaLinux** | _8~10_ | | Oracle Linux **Oracle Linux** :material-information-outline:{ title="使用 CentOS Stream 源" } | _8~10_ | | openEuler **openEuler(开源欧拉)** | _20~25_ | | OpenCloudOS **OpenCloudOS(鸥栖)** | _8.6~9 / Stream 23_ | | openKylin **openKylin(开放麒麟)** | _all_ | | Anolis OS **Anolis OS(龙蜥)** | _8 / 23_ | | openSUSE **openSUSE** | _Leap 15 ~ 16 / Tumbleweed_ | | Arch Linux **Arch Linux** | _all_ | | Manjaro **Manjaro** | _all_ | | EndeavourOS **EndeavourOS** | _all_ | | Alpine Linux **Alpine Linux** | _v3 / edge_ | | Gentoo **Gentoo** | _all_ | | NixOS **NixOS** | _19~25_ |
[开 始 使 用](use/index.md){ .md-button .md-button--primary }   [软件源列表](mirrors/index.md){ .md-button }
--8<-- "docs/sponsor/main.html" ================================================ FILE: docs/index.zh-Hant.md ================================================ --- title: 一鍵腳本讓換源更簡單 description: GNU/Linux 更換系統軟體源腳本及 Docker 安裝與換源腳本 comments: true glightbox: false comments_description: 此評論區僅用於展示專案使用評估和經驗分享,回饋問題或建議請前往社群Issues hide: - navigation - toc - footer ---
LinuxMirrors LinuxMirrors
GNU/Linux 更換系統軟體源腳本及 Docker 安裝與換源腳本
一鍵腳本讓換源更簡單
=== ":linux:{ .middle } GNU/Linux" command-linux command-linux === ":simple-docker:{ .lg .middle style="color: #1d63ed"} Docker" command-docker command-docker
- :material-thumb-up-outline:{ .lg .middle } __輕鬆使用__ --- 只需要一行指令就能直接運行,零技術門檻,無需安裝任何依賴 文件整合了 AI 搜尋與聊天,提供各種使用場景的解決方案 - :material-vector-polyline:{ .lg .middle } __系統支援廣泛__ --- 已適配高達 `26+` 作業系統,涵蓋各類版本,精準辨識系統類型 腳本相容性高,不支援的系統會有對應提示並無操作跳出 - :material-vector-triangle:{ .lg .middle } __多元軟體源適配__ --- 深入考察了中國大陸鏡像站的系統適配狀況,專為國人打造 也提供全網蒐集的國內教育網和海外鏡像站供用戶選擇 - :material-rocket-launch-outline:{ .lg .middle } __快,且高效__ --- 最快僅需 10 秒即可完成軟體源的更換,高效能維運,節省大量時間成本 專案經過數年的迭代與最佳化,腳本效能卓越運作穩定,場景判斷完善 - :octicons-globe-24:{ .lg .middle } __全球網絡,執行無憂__ --- 本網站提供全球邊緣網路加速,不畏各種網路環境,輕鬆訪問 同時提供了多個備用地址以確保專案腳本始終可用,並真正做到使用無憂 - :material-arm-flex-outline:{ .lg .middle } __功能強大,無與倫比__ --- 腳本透過方向鍵互動逐步引導使用者選擇軟體軟體源配置,讓換源更簡單 此外腳本提供了豐富的命令選項,支援 CI/CD 整合與自動化維運 - :material-pencil-ruler-outline:{ .lg .middle } __高度可自定義__ --- 腳本命令選項遵循正式應用程式規範設計,能夠滿足各種進階需求 程式碼結構清晰,易於閱讀和修改,支援克隆後定制,支援多語言列印 - :material-scale-balance:{ .lg .middle } __自由,開源__ --- 專案已設立 MIT 開源授權協定,腳本程式碼完全開源且免費使用 請尊重作者的知識成果,傳播時請在顯著位置標註軟體源或專案地址
| 作業系統 | 適配版本 | | --- | :---: | | Debian **Debian** | _8~13_ | | Ubuntu **Ubuntu** :material-information-outline:{ title="支援烏班圖家族衍生作業系統,例如 優麒麟 Kubuntu
由於迭代速度較快並不直接支援所有非 LTS 的版本,因此具體詳見文件" } | _14~25_ | | Kali Linux **Kali Linux** | _all_ | | Linux Mint **Linux Mint** | _17~22 / LMDE 2~7_ | | Deepin **Deepin** | _all_ | | Zorin OS **Zorin OS** | _all_ | | Armbian **Armbian** | _all_ | | Proxmox VE **Proxmox VE** | _all_ | | Raspberry Pi OS **Raspberry Pi OS** | _all_ | | Red Hat Enterprise Linux **Red Hat Enterprise Linux** :material-information-outline:{ title="使用 CentOS StreamCentOS 源" } | _7~10_ | | Fedora **Fedora** | _30~43_ | | CentOS **CentOS** | _7~8 / Stream 8~10_ | | Rocky Linux **Rocky Linux** | _8~10_ | | AlmaLinux **AlmaLinux** | _8~10_ | | Oracle Linux **Oracle Linux** :material-information-outline:{ title="使用 CentOS Stream 源" } | _8~10_ | | openEuler **openEuler** | _20~25_ | | OpenCloudOS **OpenCloudOS** | _8.6~9 / Stream 23_ | | openKylin **openKylin** | _all_ | | Anolis OS **Anolis OS** | _8 / 23_ | | openSUSE **openSUSE** | _Leap 15 ~ 16 / Tumbleweed_ | | Arch Linux **Arch Linux** | _all_ | | Manjaro **Manjaro** | _all_ | | EndeavourOS **EndeavourOS** | _all_ | | Alpine Linux **Alpine Linux** | _v3 / edge_ | | Gentoo **Gentoo** | _all_ | | NixOS **NixOS** | _19~25_ |
[開 始 使 用](use/index.md){ .md-button .md-button--primary }   [軟體源列表](mirrors/index.md){ .md-button }
--8<-- "docs/sponsor/main.html" ================================================ FILE: docs/mirrors/index.en.md ================================================ --- hide: - navigation - toc - feedback - footer search: exclude: true --- ## Chinese Mainland :flag-CN:

Loading table

???+ question "Usage Help" :supported: Supported    :unsupport: Not Supported    :incompatible: Incompatible, meaning the mirror site's repository directory naming does not conform to the script's default rules but can still be used via command options. For specific usage examples and the default branch names for each operating system, [see here](../use/index.md#specify-mirror-repository-directory). If you can't find the mirror site you want to use here, you can check other modes and command options. The speed of a mirror site is divided into synchronization speed and user download speed, with the latter being the key. Please choose and try according to your actual geographic location. You can also use [auxiliary tool websites](#tool-websites) for testing. :material-thumb-up-outline: Usage suggestions: For speed, we recommend `USTC` and `ByteDance (Volcengine)`; for regional compatibility, `Aliyun` and `Tencent Cloud`; for repository variety, `Nanjing University` and `CAS`. For overseas or complex network environments, it is not recommended to use mirrors like `Tsinghua (TUNA)` that are prone to blocking. ??? note "China Education Network (Click to expand)" | Mirror Name | Mirror URL | | :- | :-: | | Peking University | [mirrors.pku.edu.cn](https://mirrors.pku.edu.cn "https://mirrors.pku.edu.cn") | | Beijing Jiaotong University | [mirror.bjtu.edu.cn](https://mirror.bjtu.edu.cn "https://mirror.bjtu.edu.cn") | | Beijing Foreign Studies University | [mirrors.bfsu.edu.cn](https://mirrors.bfsu.edu.cn "https://mirrors.bfsu.edu.cn") | | Beijing University of Posts and Telecommunications | [mirror.bupt.edu.cn](https://mirror.bupt.edu.cn "https://mirror.bupt.edu.cn") | | Chongqing University | [mirrors.cqu.edu.cn](https://mirrors.cqu.edu.cn "https://mirrors.cqu.edu.cn") | | Chongqing University of Posts and Telecommunications | [mirrors.cqupt.edu.cn](https://mirrors.cqupt.edu.cn "https://mirrors.cqupt.edu.cn") | | Dalian Neusoft University of Information | [mirrors.neusoft.edu.cn](https://mirrors.neusoft.edu.cn "https://mirrors.neusoft.edu.cn") | | University of Electronic Science and Technology of China | [mirrors.uestc.cn](https://mirrors.uestc.cn "https://mirrors.uestc.cn") | | South China Agricultural University | [mirrors.scau.edu.cn](https://mirrors.scau.edu.cn "https://mirrors.scau.edu.cn") | | Huazhong University of Science and Technology | [mirrors.hust.edu.cn](https://mirrors.hust.edu.cn "https://mirrors.hust.edu.cn") | | Jilin University | [mirrors.jlu.edu.cn](https://mirrors.jlu.edu.cn "https://mirrors.jlu.edu.cn") | | Jingchu University of Technology | [mirrors.jcut.edu.cn](https://mirrors.jcut.edu.cn "https://mirrors.jcut.edu.cn") | | Jiangxi University of Science and Technology | [mirrors.jxust.edu.cn](https://mirrors.jxust.edu.cn "https://mirrors.jxust.edu.cn") | | Lanzhou University | [mirror.lzu.edu.cn](https://mirror.lzu.edu.cn "https://mirror.lzu.edu.cn") | | Nanjing University | [mirrors.nju.edu.cn](https://mirrors.nju.edu.cn "https://mirrors.nju.edu.cn") | | Nanjing Tech University | [mirrors.njtech.edu.cn](https://mirrors.njtech.edu.cn "https://mirrors.njtech.edu.cn") | | Nanjing University of Posts and Telecommunications | [mirrors.njupt.edu.cn](https://mirrors.njupt.edu.cn "https://mirrors.njupt.edu.cn") | | Southern University of Science and Technology | [mirrors.sustech.edu.cn](https://mirrors.sustech.edu.cn "https://mirrors.sustech.edu.cn") | | Nanyang Institute of Technology | [mirror.nyist.edu.cn](https://mirror.nyist.edu.cn "https://mirror.nyist.edu.cn") | | Qilu University of Technology | [mirrors.qlu.edu.cn](https://mirrors.qlu.edu.cn "https://mirrors.qlu.edu.cn") | | Tsinghua University | [mirrors.tuna.tsinghua.edu.cn](https://mirrors.tuna.tsinghua.edu.cn "https://mirrors.tuna.tsinghua.edu.cn") | | Shandong University | [mirrors.sdu.edu.cn](https://mirrors.sdu.edu.cn "https://mirrors.sdu.edu.cn") | | ShanghaiTech University | [mirrors.shanghaitech.edu.cn](https://mirrors.shanghaitech.edu.cn "https://mirrors.shanghaitech.edu.cn") | | Shanghai Jiao Tong University (Siyuan) | [mirror.sjtu.edu.cn](https://mirror.sjtu.edu.cn "https://mirror.sjtu.edu.cn") | | Shanghai Jiao Tong University (Zhiyuan) | [mirrors.sjtug.sjtu.edu.cn](https://mirrors.sjtug.sjtu.edu.cn "https://mirrors.sjtug.sjtu.edu.cn") | | Wuchang Shouyi University | [mirrors.wsyu.edu.cn](https://mirrors.wsyu.edu.cn "https://mirrors.wsyu.edu.cn") | | Xi'an Jiaotong University | [mirrors.xjtu.edu.cn](https://mirrors.xjtu.edu.cn "https://mirrors.xjtu.edu.cn") | | Northwest A&F University | [mirrors.nwafu.edu.cn](https://mirrors.nwafu.edu.cn "https://mirrors.nwafu.edu.cn") | | Zhejiang University | [mirrors.zju.edu.cn](https://mirrors.zju.edu.cn "https://mirrors.zju.edu.cn") | | University of Science and Technology of China | [mirrors.ustc.edu.cn](https://mirrors.ustc.edu.cn "https://mirrors.ustc.edu.cn") | ## Overseas And International Regions :flag-world-map: === ":fontawesome-solid-earth-asia: AS" | Mirror Name | Mirror URL | | :- | :-: | | AS · xTom · Hong Kong :flag-HK: | [mirrors.xtom.hk](https://mirrors.xtom.hk "https://mirrors.xtom.hk") | | AS · 01Link · Hong Kong :flag-HK: | [mirror.01link.hk](https://mirror.01link.hk "https://mirror.01link.hk") | | AS · National University of Singapore (NUS) · Singapore :flag-SG: | [download.nus.edu.sg/mirror](https://download.nus.edu.sg "https://download.nus.edu.sg") | | AS · SG.GS · Singapore :flag-SG: | [mirror.sg.gs](https://mirror.sg.gs "https://mirror.sg.gs") | | AS · xTom · Singapore :flag-SG: | [mirrors.xtom.sg](https://mirrors.xtom.sg "https://mirrors.xtom.sg") | | AS · NCHC Free Software Lab · Taiwan :flag-TW: | [free.nchc.org.tw](https://free.nchc.org.tw "https://free.nchc.org.tw") | | AS · OSS Planet · Taiwan :flag-TW: | [mirror.ossplanet.net](https://mirror.ossplanet.net "https://mirror.ossplanet.net") | | AS · National Yang Ming Chiao Tung University · Taiwan :flag-TW: | [linux.cs.nctu.edu.tw](https://linux.cs.nctu.edu.tw "https://linux.cs.nctu.edu.tw") | | AS · Tamkang University · Taiwan :flag-TW: | [ftp.tku.edu.tw](https://ftp.tku.edu.tw "https://ftp.tku.edu.tw") | | AS · Taiwan Digital Streaming · Taiwan :flag-TW: | [mirror.twds.com.tw](https://mirror.twds.com.tw "https://mirror.twds.com.tw") | | AS · AniGil Linux Archive · Korea :flag-KR: | [mirror.anigil.com](https://mirror.anigil.com "https://mirror.anigil.com") | | AS · ICSCoE (Industrial Cyber Security Center of Excellence) · Japan :flag-JP: | [ftp.udx.icscoe.jp/Linux](https://ftp.udx.icscoe.jp/Linux "https://ftp.udx.icscoe.jp/Linux") | | AS · JAIST (Japan Advanced Institute of Science and Technology) · Japan :flag-JP: | [ftp.jaist.ac.jp/pub/Linux](https://ftp.jaist.ac.jp/pub/Linux "https://ftp.jaist.ac.jp/pub/Linux") | | AS · Yamagata University · Japan :flag-JP: | [linux2.yz.yamagata-u.ac.jp/pub/Linux](https://linux2.yz.yamagata-u.ac.jp/pub/Linux "https://linux2.yz.yamagata-u.ac.jp/pub/Linux") | | AS · xTom · Japan :flag-JP: | [mirrors.xtom.jp](https://mirrors.xtom.jp "https://mirrors.xtom.jp") | | AS · GB Network Solutions · Malaysia :flag-MY: | [mirrors.gbnetwork.com](https://mirrors.gbnetwork.com "https://mirrors.gbnetwork.com") | | AS · Khon Kaen University · Thailand :flag-TH: | [mirror.kku.ac.th](https://mirror.kku.ac.th "https://mirror.kku.ac.th") | === ":fontawesome-solid-earth-europe: Europe" | Mirror Name | Mirror URL | | :- | :-: | | EU · Vorboss Ltd · United Kiongdom :flag-GB: | [mirror.vorboss.net](https://mirror.vorboss.net "https://mirror.vorboss.net") | | EU · QuickHost · United Kiongdom :flag-GB: | [mirror.quickhost.uk](https://mirror.quickhost.uk "https://mirror.quickhost.uk") | | EU · dogado · Germany :flag-DE: | [mirror.dogado.de](https://mirror.dogado.de "https://mirror.dogado.de") | | EU · xTom · Germany :flag-DE: | [mirrors.xtom.de](https://mirrors.xtom.de "https://mirrors.xtom.de") | | EU · RWTH Aachen University · Germany :flag-DE: | [ftp.halifax.rwth-aachen.de](https://ftp.halifax.rwth-aachen.de "https://ftp.halifax.rwth-aachen.de") | | EU · Dresden University (AG DSN) · Germany :flag-DE: | [ftp.agdsn.de](https://ftp.agdsn.de "https://ftp.agdsn.de") | | EU · CCIN2P3 · France :flag-FR: | [mirror.in2p3.fr/pub/linux](https://mirror.in2p3.fr/pub/linux "https://mirror.in2p3.fr/pub/linux") | | EU · Ircam · France :flag-FR: | [mirrors.ircam.fr/pub](https://mirrors.ircam.fr/pub "https://mirrors.ircam.fr/pub") | | EU · Crans · France :flag-FR: | [eclats.crans.org](https://eclats.crans.org "https://eclats.crans.org") | | EU · CRIHAN · France :flag-FR: | [ftp.crihan.fr](https://ftp.crihan.fr "https://ftp.crihan.fr") | | EU · xTom · Netherlands :flag-NL: | [mirrors.xtom.nl](https://mirrors.xtom.nl "https://mirrors.xtom.nl") | | EU · DataPacket · Netherlands :flag-NL: | [mirror.datapacket.com](https://mirror.datapacket.com "https://mirror.datapacket.com") | | EU · Linux Kernel · Netherlands :flag-NL: | [eu.edge.kernel.org](https://eu.edge.kernel.org "https://eu.edge.kernel.org") | | EU · xTom · Estonia :flag-EE: | [mirrors.xtom.ee](https://mirrors.xtom.ee "https://mirrors.xtom.ee") | | EU · netsite · Denmark :flag-DK: | [mirror.netsite.dk](https://mirror.netsite.dk "https://mirror.netsite.dk") | | EU · Dotsrc · Denmark :flag-DK: | [mirrors.dotsrc.org](https://mirrors.dotsrc.org "https://mirrors.dotsrc.org") | | EU · Academic Computer Club · Sweden :flag-SE: | [mirror.accum.se](https://mirror.accum.se "https://mirror.accum.se") | | EU · Lysator · Sweden :flag-SE: | [ftp.lysator.liu.se](https://ftp.lysator.liu.se "https://ftp.lysator.liu.se") | | EU · Yandex · Russia :flag-RU: | [mirror.yandex.ru](https://mirror.yandex.ru "https://mirror.yandex.ru") | | EU · ia64 · Russia :flag-RU: | [mirror.linux-ia64.org](https://mirror.linux-ia64.org "https://mirror.linux-ia64.org") | | EU · Truenetwork · Russia :flag-RU: | [mirror.truenetwork.ru](https://mirror.truenetwork.ru "https://mirror.truenetwork.ru") | | EU · Belgian Research Network · Belgium :flag-BE: | [ftp.belnet.be/mirror](https://ftp.belnet.be/mirror "https://ftp.belnet.be/mirror") | | EU · University of Crete Computer Center · Greece :flag-GR: | [ftp.cc.uoc.gr/mirrors/linux](https://ftp.cc.uoc.gr/mirrors/linux "https://ftp.cc.uoc.gr/mirrors/linux") | | EU · Masaryk University Faculty of Informatics · Czech :flag-CZ: | [ftp.fi.muni.cz/pub/linux](https://ftp.fi.muni.cz/pub/linux "https://ftp.fi.muni.cz/pub/linux") | | EU · Czech Technical University Student Club (Silicon Hill) · Czech :flag-CZ: | [ftp.sh.cvut.cz](https://ftp.sh.cvut.cz "https://ftp.sh.cvut.cz") | | EU · Vodafone · Czech :flag-CZ: | [mirror.karneval.cz/pub/linux](https://mirror.karneval.cz/pub/linux "https://mirror.karneval.cz/pub/linux") | | EU · CZ.NIC · Czech :flag-CZ: | [mirrors.nic.cz](https://mirrors.nic.cz "https://mirrors.nic.cz") | | EU · ETH Zurich · Switzerland :flag-CH: | [mirror.ethz.ch](https://mirror.ethz.ch "https://mirror.ethz.ch") | === ":fontawesome-solid-earth-americas: North America" | Mirror Name | Mirror URL | | :- | :-: | | NA · Linux Kernel · United States :flag-US: | [mirrors.kernel.org](https://mirrors.kernel.org "https://mirrors.kernel.org") | | NA · MIT · United States :flag-US: | [mirrors.mit.edu](https://mirrors.mit.edu "https://mirrors.mit.edu") | | NA · Princeton University Department of Mathematics · United States :flag-US: | [mirror.math.princeton.edu/pub](https://mirror.math.princeton.edu/pub "https://mirror.math.princeton.edu/pub") | | NA · Oregon State University Open Source Lab · United States :flag-US: | [ftp-chi.osuosl.org/pub](https://ftp-chi.osuosl.org/pub "https://ftp-chi.osuosl.org/pub") | | NA · Fremont Cabal Internet Exchange (FCIX) · United States :flag-US: | [mirror.fcix.net](https://mirror.fcix.net "https://mirror.fcix.net") | | NA · xTom · United States :flag-US: | [mirrors.xtom.com](https://mirrors.xtom.com "https://mirrors.xtom.com") | | NA · Steadfast · United States :flag-US: | [mirror.steadfast.net](https://mirror.steadfast.net "https://mirror.steadfast.net") | | NA · University of British Columbia · Canada :flag-CA: | [mirror.it.ubc.ca](https://mirror.it.ubc.ca "https://mirror.it.ubc.ca") | | NA · GoCodeIT · Canada :flag-CA: | [mirror.xenyth.net](https://mirror.xenyth.net "https://mirror.xenyth.net") | | NA · Switch · Canada :flag-CA: | [mirrors.switch.ca](https://mirrors.switch.ca "https://mirrors.switch.ca") | === ":fontawesome-solid-earth-americas: South America" | Mirror Name | Mirror URL | | :- | :-: | | SA · PoP-SC · Brazil :flag-BR: | [mirror.pop-sc.rnp.br/mirror](https://mirror.pop-sc.rnp.br/mirror "https://mirror.pop-sc.rnp.br/mirror") | | SA · State University of Ponta Grossa · Brazil :flag-BR: | [mirror.uepg.br](https://mirror.uepg.br "https://mirror.uepg.br") | | SA · UFSCar · Brazil :flag-BR: | [mirror.ufscar.br](https://mirror.ufscar.br "https://mirror.ufscar.br") | | SA · Sysarmy Community · Argentina :flag-AR: | [mirrors.eze.sysarmy.com](https://mirrors.eze.sysarmy.com "https://mirrors.eze.sysarmy.com") | === ":fontawesome-solid-earth-oceania: Oceania" | Mirror Name | Mirror URL | | :- | :-: | | OC · Fremont Cabal Internet Exchange (FCIX) · Australia :flag-AU: | [gsl-syd.mm.fcix.net](https://gsl-syd.mm.fcix.net "https://gsl-syd.mm.fcix.net") | | OC · AARNet · Australia :flag-AU: | [mirror.aarnet.edu.au/pub](https://mirror.aarnet.edu.au/pub "https://mirror.aarnet.edu.au/pub") | | OC · DataMossa · Australia :flag-AU: | [mirror.datamossa.io](https://mirror.datamossa.io "https://mirror.datamossa.io") | | OC · Amaze · Australia :flag-AU: | [mirror.amaze.com.au](https://mirror.amaze.com.au "https://mirror.amaze.com.au") | | OC · xTom · Australia :flag-AU: | [mirrors.xtom.au](https://mirrors.xtom.au "https://mirrors.xtom.au") | | OC · Over the Wire · Australia :flag-AU: | [mirror.overthewire.com.au](https://mirror.overthewire.com.au "https://mirror.overthewire.com.au") | | OC · Free Software Mirror Group · New Zealand :flag-NZ: | [mirror.fsmg.org.nz](https://mirror.fsmg.org.nz "https://mirror.fsmg.org.nz") | === ":fontawesome-solid-earth-africa: Africa" | Mirror Name | Mirror URL | | :- | :-: | | AF · Liquid Telecom · Kenya :flag-KE: | [mirror.liquidtelecom.com](https://mirror.liquidtelecom.com "https://mirror.liquidtelecom.com") | | AF · Dimension Data · South Africa :flag-ZA: | [mirror.dimensiondata.com](https://mirror.dimensiondata.com "https://mirror.dimensiondata.com") | === ":octicons-globe-16: All" | Mirror Name | Mirror URL | | :- | :-: | | AS · xTom · Hong Kong :flag-HK: | [mirrors.xtom.hk](https://mirrors.xtom.hk "https://mirrors.xtom.hk") | | AS · 01Link · Hong Kong :flag-HK: | [mirror.01link.hk](https://mirror.01link.hk "https://mirror.01link.hk") | | AS · National University of Singapore (NUS) · Singapore :flag-SG: | [download.nus.edu.sg/mirror](https://download.nus.edu.sg "https://download.nus.edu.sg") | | AS · SG.GS · Singapore :flag-SG: | [mirror.sg.gs](https://mirror.sg.gs "https://mirror.sg.gs") | | AS · xTom · Singapore :flag-SG: | [mirrors.xtom.sg](https://mirrors.xtom.sg "https://mirrors.xtom.sg") | | AS · NCHC Free Software Lab · Taiwan :flag-TW: | [free.nchc.org.tw](https://free.nchc.org.tw "https://free.nchc.org.tw") | | AS · OSS Planet · Taiwan :flag-TW: | [mirror.ossplanet.net](https://mirror.ossplanet.net "https://mirror.ossplanet.net") | | AS · National Yang Ming Chiao Tung University · Taiwan :flag-TW: | [linux.cs.nctu.edu.tw](https://linux.cs.nctu.edu.tw "https://linux.cs.nctu.edu.tw") | | AS · Tamkang University · Taiwan :flag-TW: | [ftp.tku.edu.tw](https://ftp.tku.edu.tw "https://ftp.tku.edu.tw") | | AS · Taiwan Digital Streaming · Taiwan :flag-TW: | [mirror.twds.com.tw](https://mirror.twds.com.tw "https://mirror.twds.com.tw") | | AS · AniGil Linux Archive · Korea :flag-KR: | [mirror.anigil.com](https://mirror.anigil.com "https://mirror.anigil.com") | | AS · ICSCoE (Industrial Cyber Security Center of Excellence) · Japan :flag-JP: | [ftp.udx.icscoe.jp/Linux](https://ftp.udx.icscoe.jp/Linux "https://ftp.udx.icscoe.jp/Linux") | | AS · JAIST (Japan Advanced Institute of Science and Technology) · Japan :flag-JP: | [ftp.jaist.ac.jp/pub/Linux](https://ftp.jaist.ac.jp/pub/Linux "https://ftp.jaist.ac.jp/pub/Linux") | | AS · Yamagata University · Japan :flag-JP: | [linux2.yz.yamagata-u.ac.jp/pub/Linux](https://linux2.yz.yamagata-u.ac.jp/pub/Linux "https://linux2.yz.yamagata-u.ac.jp/pub/Linux") | | AS · xTom · Japan :flag-JP: | [mirrors.xtom.jp](https://mirrors.xtom.jp "https://mirrors.xtom.jp") | | AS · GB Network Solutions · Malaysia :flag-MY: | [mirrors.gbnetwork.com](https://mirrors.gbnetwork.com "https://mirrors.gbnetwork.com") | | AS · Khon Kaen University · Thailand :flag-TH: | [mirror.kku.ac.th](https://mirror.kku.ac.th "https://mirror.kku.ac.th") | | EU · Vorboss Ltd · United Kiongdom :flag-GB: | [mirror.vorboss.net](https://mirror.vorboss.net "https://mirror.vorboss.net") | | EU · QuickHost · United Kiongdom :flag-GB: | [mirror.quickhost.uk](https://mirror.quickhost.uk "https://mirror.quickhost.uk") | | EU · dogado · Germany :flag-DE: | [mirror.dogado.de](https://mirror.dogado.de "https://mirror.dogado.de") | | EU · xTom · Germany :flag-DE: | [mirrors.xtom.de](https://mirrors.xtom.de "https://mirrors.xtom.de") | | EU · RWTH Aachen University · Germany :flag-DE: | [ftp.halifax.rwth-aachen.de](https://ftp.halifax.rwth-aachen.de "https://ftp.halifax.rwth-aachen.de") | | EU · Dresden University (AG DSN) · Germany :flag-DE: | [ftp.agdsn.de](https://ftp.agdsn.de "https://ftp.agdsn.de") | | EU · CCIN2P3 · France :flag-FR: | [mirror.in2p3.fr/pub/linux](https://mirror.in2p3.fr/pub/linux "https://mirror.in2p3.fr/pub/linux") | | EU · Ircam · France :flag-FR: | [mirrors.ircam.fr/pub](https://mirrors.ircam.fr/pub "https://mirrors.ircam.fr/pub") | | EU · Crans · France :flag-FR: | [eclats.crans.org](https://eclats.crans.org "https://eclats.crans.org") | | EU · CRIHAN · France :flag-FR: | [ftp.crihan.fr](https://ftp.crihan.fr "https://ftp.crihan.fr") | | EU · xTom · Netherlands :flag-NL: | [mirrors.xtom.nl](https://mirrors.xtom.nl "https://mirrors.xtom.nl") | | EU · DataPacket · Netherlands :flag-NL: | [mirror.datapacket.com](https://mirror.datapacket.com "https://mirror.datapacket.com") | | EU · Linux Kernel · Netherlands :flag-NL: | [eu.edge.kernel.org](https://eu.edge.kernel.org "https://eu.edge.kernel.org") | | EU · xTom · Estonia :flag-EE: | [mirrors.xtom.ee](https://mirrors.xtom.ee "https://mirrors.xtom.ee") | | EU · netsite · Denmark :flag-DK: | [mirror.netsite.dk](https://mirror.netsite.dk "https://mirror.netsite.dk") | | EU · Dotsrc · Denmark :flag-DK: | [mirrors.dotsrc.org](https://mirrors.dotsrc.org "https://mirrors.dotsrc.org") | | EU · Academic Computer Club · Sweden :flag-SE: | [mirror.accum.se](https://mirror.accum.se "https://mirror.accum.se") | | EU · Lysator · Sweden :flag-SE: | [ftp.lysator.liu.se](https://ftp.lysator.liu.se "https://ftp.lysator.liu.se") | | EU · Yandex · Russia :flag-RU: | [mirror.yandex.ru](https://mirror.yandex.ru "https://mirror.yandex.ru") | | EU · ia64 · Russia :flag-RU: | [mirror.linux-ia64.org](https://mirror.linux-ia64.org "https://mirror.linux-ia64.org") | | EU · Truenetwork · Russia :flag-RU: | [mirror.truenetwork.ru](https://mirror.truenetwork.ru "https://mirror.truenetwork.ru") | | EU · Belgian Research Network · Belgium :flag-BE: | [ftp.belnet.be/mirror](https://ftp.belnet.be/mirror "https://ftp.belnet.be/mirror") | | EU · University of Crete Computer Center · Greece :flag-GR: | [ftp.cc.uoc.gr/mirrors/linux](https://ftp.cc.uoc.gr/mirrors/linux "https://ftp.cc.uoc.gr/mirrors/linux") | | EU · Masaryk University Faculty of Informatics · Czech :flag-CZ: | [ftp.fi.muni.cz/pub/linux](https://ftp.fi.muni.cz/pub/linux "https://ftp.fi.muni.cz/pub/linux") | | EU · Czech Technical University Student Club (Silicon Hill) · Czech :flag-CZ: | [ftp.sh.cvut.cz](https://ftp.sh.cvut.cz "https://ftp.sh.cvut.cz") | | EU · Vodafone · Czech :flag-CZ: | [mirror.karneval.cz/pub/linux](https://mirror.karneval.cz/pub/linux "https://mirror.karneval.cz/pub/linux") | | EU · CZ.NIC · Czech :flag-CZ: | [mirrors.nic.cz](https://mirrors.nic.cz "https://mirrors.nic.cz") | | EU · ETH Zurich · Switzerland :flag-CH: | [mirror.ethz.ch](https://mirror.ethz.ch "https://mirror.ethz.ch") | | NA · Linux Kernel · United States :flag-US: | [mirrors.kernel.org](https://mirrors.kernel.org "https://mirrors.kernel.org") | | NA · MIT · United States :flag-US: | [mirrors.mit.edu](https://mirrors.mit.edu "https://mirrors.mit.edu") | | NA · Princeton University Department of Mathematics · United States :flag-US: | [mirror.math.princeton.edu/pub](https://mirror.math.princeton.edu/pub "https://mirror.math.princeton.edu/pub") | | NA · Oregon State University Open Source Lab · United States :flag-US: | [ftp-chi.osuosl.org/pub](https://ftp-chi.osuosl.org/pub "https://ftp-chi.osuosl.org/pub") | | NA · Fremont Cabal Internet Exchange (FCIX) · United States :flag-US: | [mirror.fcix.net](https://mirror.fcix.net "https://mirror.fcix.net") | | NA · xTom · United States :flag-US: | [mirrors.xtom.com](https://mirrors.xtom.com "https://mirrors.xtom.com") | | NA · Steadfast · United States :flag-US: | [mirror.steadfast.net](https://mirror.steadfast.net "https://mirror.steadfast.net") | | NA · University of British Columbia · Canada :flag-CA: | [mirror.it.ubc.ca](https://mirror.it.ubc.ca "https://mirror.it.ubc.ca") | | NA · GoCodeIT · Canada :flag-CA: | [mirror.xenyth.net](https://mirror.xenyth.net "https://mirror.xenyth.net") | | NA · Switch · Canada :flag-CA: | [mirrors.switch.ca](https://mirrors.switch.ca "https://mirrors.switch.ca") | | SA · PoP-SC · Brazil :flag-BR: | [mirror.pop-sc.rnp.br/mirror](https://mirror.pop-sc.rnp.br/mirror "https://mirror.pop-sc.rnp.br/mirror") | | SA · State University of Ponta Grossa · Brazil :flag-BR: | [mirror.uepg.br](https://mirror.uepg.br "https://mirror.uepg.br") | | SA · UFSCar · Brazil :flag-BR: | [mirror.ufscar.br](https://mirror.ufscar.br "https://mirror.ufscar.br") | | SA · Sysarmy Community · Argentina :flag-AR: | [mirrors.eze.sysarmy.com](https://mirrors.eze.sysarmy.com "https://mirrors.eze.sysarmy.com") | | OC · Fremont Cabal Internet Exchange (FCIX) · Australia :flag-AU: | [gsl-syd.mm.fcix.net](https://gsl-syd.mm.fcix.net "https://gsl-syd.mm.fcix.net") | | OC · AARNet · Australia :flag-AU: | [mirror.aarnet.edu.au/pub](https://mirror.aarnet.edu.au/pub "https://mirror.aarnet.edu.au/pub") | | OC · DataMossa · Australia :flag-AU: | [mirror.datamossa.io](https://mirror.datamossa.io "https://mirror.datamossa.io") | | OC · Amaze · Australia :flag-AU: | [mirror.amaze.com.au](https://mirror.amaze.com.au "https://mirror.amaze.com.au") | | OC · xTom · Australia :flag-AU: | [mirrors.xtom.au](https://mirrors.xtom.au "https://mirrors.xtom.au") | | OC · Over the Wire · Australia :flag-AU: | [mirror.overthewire.com.au](https://mirror.overthewire.com.au "https://mirror.overthewire.com.au") | | OC · Free Software Mirror Group · New Zealand :flag-NZ: | [mirror.fsmg.org.nz](https://mirror.fsmg.org.nz "https://mirror.fsmg.org.nz") | | AF · Liquid Telecom · Kenya :flag-KE: | [mirror.liquidtelecom.com](https://mirror.liquidtelecom.com "https://mirror.liquidtelecom.com") | | AF · Dimension Data · South Africa :flag-ZA: | [mirror.dimensiondata.com](https://mirror.dimensiondata.com "https://mirror.dimensiondata.com") | ???+ note "Help improve more overseas and foreign software sources" The software repositories in this list are referenced from [`Ubuntu Mirrors`](https://launchpad.net/ubuntu/+cdmirrors "https://launchpad.net/ubuntu/+cdmirrors"), [`Debian Mirrors`](https://www.debian.org/CD/http-ftp/#mirrors "https://www.debian.org/CD/http-ftp/#mirrors"), and [`Fedora Mirror Manager`](https://mirrormanager.fedoraproject.org/mirrors "https://mirrormanager.fedoraproject.org/mirrors") and have all been verified for effectiveness, but not actually tested. The author does not have the energy to continuously maintain these overseas mirror sites in the list. If you want to add more software sources or correct the existing ones, please modify the [`mirror_list_abroad array variable`](https://github.com/SuperManito/LinuxMirrors/blob/main/ChangeMirrors.sh#L70 "https://github.com/SuperManito/LinuxMirrors/blob/main/ChangeMirrors.sh#L70") in the script and modify it according to the following editing specifications. You can submit [Pull Requests](https://github.com/SuperManito/LinuxMirrors/pulls "https://github.com/SuperManito/LinuxMirrors/pulls") to the GitHub repository after confirming the mirror address is correct. You can also fork the repository and customize it yourself. - Overseas and foreign software source (mirror site) editing specifications: Complete format: `Continent · Software Source Name · Country/Region@Software Source Address (Domain)` Please sort according to geographical location, country or region for user selection. Units with iconic abbreviation characters should be supplemented in brackets at the end, and the name of the unit should prioritize the domain name. The following are naming rules: - Educational institution: Use the Chinese translation of the name. If the full name contains the name of the country or region, it should also be included. Pay attention to distinguishing subordinate units, such as colleges, student unions, societies, etc. The common second-level domain name format is `ftp.mirrors.xxx.xxx`. The name of the top-level institution should be used directly. If there is a third-level domain name, consider whether to add the subordinate unit in the name. The domain name takes priority. - Non-educational institutions: The brand name used by their parent official website should be prioritized, and it should be the official English name rather than the characters in the logo. If there is no official English name and the website is in a language other than Chinese or English, the website domain name should be used as the name. ## Tool Websites !!! tip "This page displays only the default repository addresses provided by the script. If you can't find the one you want, don't worry—the script supports custom addresses via command options. See [Advanced Usage](../use/index.md#command-options-advanced-usage) for details." --- !!! warning "Because the information on this page may be controversial, it is recommended that you do not include this page's content in your sharing on certain social media platforms to avoid unnecessary trouble." The flag icons on this page are for quick geographic identification only and do not represent any political stance of the author. Please do not over-interpret. Statement made for clarification. ================================================ FILE: docs/mirrors/index.md ================================================ --- hide: - navigation - toc - feedback - footer search: exclude: true --- ## 中国大陆 :flag-CN:

正在加载表格

???+ question "使用帮助" :supported: 支持    :unsupport: 不支持    :incompatible: 不兼容,表示镜像站上的仓库目录命名不符合脚本默认规则但可以通过命令选项来使用,关于具体用法示例和各操作系统所使用的默认分支名称[详见此处](../use/index.md#指定软件源仓库目录) 如果这里没有想使用的镜像站那可以看看其它运行模式和命令选项。镜像站的速度分为同步刷新速度和用户下载速度,后者才是关键,具体请结合实际地理位置选择尝试,还可以通过[辅助工具网站](#工具网站)进行一些测试 :material-thumb-up-outline: 使用建议:速度上推荐 `中科大`、`字节(火山引擎)`,地域兼容性上推荐 `阿里云`、`腾讯云`,软件源种类上推荐 `南京大学`、`中科院`,境外、海外或复杂网络环境下不建议使用 `清华(TUNA)` 等容易阻断的镜像站 ??? note "中国大陆教育网(点击展开查看)" | 镜像站名称 | 镜像站地址 | | :- | :-: | | 北京大学 | [mirrors.pku.edu.cn](https://mirrors.pku.edu.cn "https://mirrors.pku.edu.cn") | | 北京交通大学 | [mirror.bjtu.edu.cn](https://mirror.bjtu.edu.cn "https://mirror.bjtu.edu.cn") | | 北京外国语大学 | [mirrors.bfsu.edu.cn](https://mirrors.bfsu.edu.cn "https://mirrors.bfsu.edu.cn") | | 北京邮电大学 | [mirror.bupt.edu.cn](https://mirror.bupt.edu.cn "https://mirror.bupt.edu.cn") | | 重庆大学 | [mirrors.cqu.edu.cn](https://mirrors.cqu.edu.cn "https://mirrors.cqu.edu.cn") | | 重庆邮电大学 | [mirrors.cqupt.edu.cn](https://mirrors.cqupt.edu.cn "https://mirrors.cqupt.edu.cn") | | 大连东软信息学院 | [mirrors.neusoft.edu.cn](https://mirrors.neusoft.edu.cn "https://mirrors.neusoft.edu.cn") | | 电子科技大学 | [mirrors.uestc.cn](https://mirrors.uestc.cn "https://mirrors.uestc.cn") | | 华南农业大学 | [mirrors.scau.edu.cn](https://mirrors.scau.edu.cn "https://mirrors.scau.edu.cn") | | 华中科技大学 | [mirrors.hust.edu.cn](https://mirrors.hust.edu.cn "https://mirrors.hust.edu.cn") | | 吉林大学 | [mirrors.jlu.edu.cn](https://mirrors.jlu.edu.cn "https://mirrors.jlu.edu.cn") | | 荆楚理工学院 | [mirrors.jcut.edu.cn](https://mirrors.jcut.edu.cn "https://mirrors.jcut.edu.cn") | | 江西理工大学 | [mirrors.jxust.edu.cn](https://mirrors.jxust.edu.cn "https://mirrors.jxust.edu.cn") | | 兰州大学 | [mirror.lzu.edu.cn](https://mirror.lzu.edu.cn "https://mirror.lzu.edu.cn") | | 南京大学 | [mirrors.nju.edu.cn](https://mirrors.nju.edu.cn "https://mirrors.nju.edu.cn") | | 南京工业大学 | [mirrors.njtech.edu.cn](https://mirrors.njtech.edu.cn "https://mirrors.njtech.edu.cn") | | 南京邮电大学 | [mirrors.njupt.edu.cn](https://mirrors.njupt.edu.cn "https://mirrors.njupt.edu.cn") | | 南方科技大学 | [mirrors.sustech.edu.cn](https://mirrors.sustech.edu.cn "https://mirrors.sustech.edu.cn") | | 南阳理工学院 | [mirror.nyist.edu.cn](https://mirror.nyist.edu.cn "https://mirror.nyist.edu.cn") | | 齐鲁工业大学 | [mirrors.qlu.edu.cn](https://mirrors.qlu.edu.cn "https://mirrors.qlu.edu.cn") | | 清华大学 | [mirrors.tuna.tsinghua.edu.cn](https://mirrors.tuna.tsinghua.edu.cn "https://mirrors.tuna.tsinghua.edu.cn") | | 山东大学 | [mirrors.sdu.edu.cn](https://mirrors.sdu.edu.cn "https://mirrors.sdu.edu.cn") | | 上海科技大学 | [mirrors.shanghaitech.edu.cn](https://mirrors.shanghaitech.edu.cn "https://mirrors.shanghaitech.edu.cn") | | 上海交通大学(思源) | [mirror.sjtu.edu.cn](https://mirror.sjtu.edu.cn "https://mirror.sjtu.edu.cn") | | 上海交通大学(致远) | [mirrors.sjtug.sjtu.edu.cn](https://mirrors.sjtug.sjtu.edu.cn "https://mirrors.sjtug.sjtu.edu.cn") | | 武昌首义学院 | [mirrors.wsyu.edu.cn](https://mirrors.wsyu.edu.cn "https://mirrors.wsyu.edu.cn") | | 西安交通大学 | [mirrors.xjtu.edu.cn](https://mirrors.xjtu.edu.cn "https://mirrors.xjtu.edu.cn") | | 西北农林科技大学 | [mirrors.nwafu.edu.cn](https://mirrors.nwafu.edu.cn "https://mirrors.nwafu.edu.cn") | | 浙江大学 | [mirrors.zju.edu.cn](https://mirrors.zju.edu.cn "https://mirrors.zju.edu.cn") | | 中国科学技术大学 | [mirrors.ustc.edu.cn](https://mirrors.ustc.edu.cn "https://mirrors.ustc.edu.cn") | ## 境外以及海外地区 :flag-world-map: === ":fontawesome-solid-earth-asia: 亚洲" | 镜像站名称 | 镜像站地址 | | :- | :-: | | 亚洲 · 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") | | 亚洲 · SG.GS · 新加坡 :flag-SG: | [mirror.sg.gs](https://mirror.sg.gs "https://mirror.sg.gs") | | 亚洲 · xTom · 新加坡 :flag-SG: | [mirrors.xtom.sg](https://mirrors.xtom.sg "https://mirrors.xtom.sg") | | 亚洲 · 自由软件实验室(NCHC) · 台湾 :flag-TW: | [free.nchc.org.tw](https://free.nchc.org.tw "https://free.nchc.org.tw") | | 亚洲 · OSS Planet · 台湾 :flag-TW: | [mirror.ossplanet.net](https://mirror.ossplanet.net "https://mirror.ossplanet.net") | | 亚洲 · 国立阳明交通大学 · 台湾 :flag-TW: | [linux.cs.nctu.edu.tw](https://linux.cs.nctu.edu.tw "https://linux.cs.nctu.edu.tw") | | 亚洲 · 淡江大学 · 台湾 :flag-TW: | [ftp.tku.edu.tw](https://ftp.tku.edu.tw "https://ftp.tku.edu.tw") | | 亚洲 · Taiwan Digital Streaming · 台湾 :flag-TW: | [mirror.twds.com.tw](https://mirror.twds.com.tw "https://mirror.twds.com.tw") | | 亚洲 · AniGil Linux Archive · 韩国 :flag-KR: | [mirror.anigil.com](https://mirror.anigil.com "https://mirror.anigil.com") | | 亚洲 · 工业网络安全中心(ICSCoE) · 日本 :flag-JP: | [ftp.udx.icscoe.jp/Linux](https://ftp.udx.icscoe.jp/Linux "https://ftp.udx.icscoe.jp/Linux") | | 亚洲 · 北陆先端科学技术大学院大学(JAIST) · 日本 :flag-JP: | [ftp.jaist.ac.jp/pub/Linux](https://ftp.jaist.ac.jp/pub/Linux "https://ftp.jaist.ac.jp/pub/Linux") | | 亚洲 · 山形大学 · 日本 :flag-JP: | [linux2.yz.yamagata-u.ac.jp/pub/Linux](https://linux2.yz.yamagata-u.ac.jp/pub/Linux "https://linux2.yz.yamagata-u.ac.jp/pub/Linux") | | 亚洲 · xTom · 日本 :flag-JP: | [mirrors.xtom.jp](https://mirrors.xtom.jp "https://mirrors.xtom.jp") | | 亚洲 · GB Network Solutions · 马来西亚 :flag-MY: | [mirrors.gbnetwork.com](https://mirrors.gbnetwork.com "https://mirrors.gbnetwork.com") | | 亚洲 · 孔敬大学 · 泰国 :flag-TH: | [mirror.kku.ac.th](https://mirror.kku.ac.th "https://mirror.kku.ac.th") | === ":fontawesome-solid-earth-europe: 欧洲" | 镜像站名称 | 镜像站地址 | | :- | :-: | | 欧洲 · Vorboss Ltd · 英国 :flag-GB: | [mirror.vorboss.net](https://mirror.vorboss.net "https://mirror.vorboss.net") | | 欧洲 · QuickHost · 英国 :flag-GB: | [mirror.quickhost.uk](https://mirror.quickhost.uk "https://mirror.quickhost.uk") | | 欧洲 · dogado · 德国 :flag-DE: | [mirror.dogado.de](https://mirror.dogado.de "https://mirror.dogado.de") | | 欧洲 · xTom · 德国 :flag-DE: | [mirrors.xtom.de](https://mirrors.xtom.de "https://mirrors.xtom.de") | | 欧洲 · 亚琛工业大学(RWTH Aachen) · 德国 :flag-DE: | [ftp.halifax.rwth-aachen.de](https://ftp.halifax.rwth-aachen.de "https://ftp.halifax.rwth-aachen.de") | | 欧洲 · 德累斯顿大学(AG DSN) · 德国 :flag-DE: | [ftp.agdsn.de](https://ftp.agdsn.de "https://ftp.agdsn.de") | | 欧洲 · CCIN2P3 · 法国 :flag-FR: | [mirror.in2p3.fr/pub/linux](https://mirror.in2p3.fr/pub/linux "https://mirror.in2p3.fr/pub/linux") | | 欧洲 · Ircam · 法国 :flag-FR: | [mirrors.ircam.fr/pub](https://mirrors.ircam.fr/pub "https://mirrors.ircam.fr/pub") | | 欧洲 · Crans · 法国 :flag-FR: | [eclats.crans.org](https://eclats.crans.org "https://eclats.crans.org") | | 欧洲 · CRIHAN · 法国 :flag-FR: | [ftp.crihan.fr](https://ftp.crihan.fr "https://ftp.crihan.fr") | | 欧洲 · xTom · 荷兰 :flag-NL: | [mirrors.xtom.nl](https://mirrors.xtom.nl "https://mirrors.xtom.nl") | | 欧洲 · DataPacket · 荷兰 :flag-NL: | [mirror.datapacket.com](https://mirror.datapacket.com "https://mirror.datapacket.com") | | 欧洲 · Linux Kernel · 荷兰 :flag-NL: | [eu.edge.kernel.org](https://eu.edge.kernel.org "https://eu.edge.kernel.org") | | 欧洲 · xTom · 爱沙尼亚 :flag-EE: | [mirrors.xtom.ee](https://mirrors.xtom.ee "https://mirrors.xtom.ee") | | 欧洲 · netsite · 丹麦 :flag-DK: | [mirror.netsite.dk](https://mirror.netsite.dk "https://mirror.netsite.dk") | | 欧洲 · Dotsrc · 丹麦 :flag-DK: | [mirrors.dotsrc.org](https://mirrors.dotsrc.org "https://mirrors.dotsrc.org") | | 欧洲 · Academic Computer Club · 瑞典 :flag-SE: | [mirror.accum.se](https://mirror.accum.se "https://mirror.accum.se") | | 欧洲 · Lysator · 瑞典 :flag-SE: | [ftp.lysator.liu.se](https://ftp.lysator.liu.se "https://ftp.lysator.liu.se") | | 欧洲 · Yandex · 俄罗斯 :flag-RU: | [mirror.yandex.ru](https://mirror.yandex.ru "https://mirror.yandex.ru") | | 欧洲 · ia64 · 俄罗斯 :flag-RU: | [mirror.linux-ia64.org](https://mirror.linux-ia64.org "https://mirror.linux-ia64.org") | | 欧洲 · Truenetwork · 俄罗斯 :flag-RU: | [mirror.truenetwork.ru](https://mirror.truenetwork.ru "https://mirror.truenetwork.ru") | | 欧洲 · Belgian Research Network · 比利时 :flag-BE: | [ftp.belnet.be/mirror](https://ftp.belnet.be/mirror "https://ftp.belnet.be/mirror") | | 欧洲 · 克里特大学计算机中心 · 希腊 :flag-GR: | [ftp.cc.uoc.gr/mirrors/linux](https://ftp.cc.uoc.gr/mirrors/linux "https://ftp.cc.uoc.gr/mirrors/linux") | | 欧洲 · 马萨里克大学信息学院 · 捷克 :flag-CZ: | [ftp.fi.muni.cz/pub/linux](https://ftp.fi.muni.cz/pub/linux "https://ftp.fi.muni.cz/pub/linux") | | 欧洲 · 捷克理工大学学生会俱乐部(Silicon Hill) · 捷克 :flag-CZ: | [ftp.sh.cvut.cz](https://ftp.sh.cvut.cz "https://ftp.sh.cvut.cz") | | 欧洲 · Vodafone · 捷克 :flag-CZ: | [mirror.karneval.cz/pub/linux](https://mirror.karneval.cz/pub/linux "https://mirror.karneval.cz/pub/linux") | | 欧洲 · CZ.NIC · 捷克 :flag-CZ: | [mirrors.nic.cz](https://mirrors.nic.cz "https://mirrors.nic.cz") | | 欧洲 · 苏黎世联邦理工学院 · 瑞士 :flag-CH: | [mirror.ethz.ch](https://mirror.ethz.ch "https://mirror.ethz.ch") | === ":fontawesome-solid-earth-americas: 北美洲" | 镜像站名称 | 镜像站地址 | | :- | :-: | | 北美 · Linux Kernel · 美国 :flag-US: | [mirrors.kernel.org](https://mirrors.kernel.org "https://mirrors.kernel.org") | | 北美 · 麻省理工学院(MIT) · 美国 :flag-US: | [mirrors.mit.edu](https://mirrors.mit.edu "https://mirrors.mit.edu") | | 北美 · 普林斯顿大学数学系 · 美国 :flag-US: | [mirror.math.princeton.edu/pub](https://mirror.math.princeton.edu/pub "https://mirror.math.princeton.edu/pub") | | 北美 · 俄勒冈州立大学开源实验室 · 美国 :flag-US: | [ftp-chi.osuosl.org/pub](https://ftp-chi.osuosl.org/pub "https://ftp-chi.osuosl.org/pub") | | 北美 · Fremont Cabal Internet Exchange(FCIX) · 美国 :flag-US: | [mirror.fcix.net](https://mirror.fcix.net "https://mirror.fcix.net") | | 北美 · xTom · 美国 :flag-US: | [mirrors.xtom.com](https://mirrors.xtom.com "https://mirrors.xtom.com") | | 北美 · Steadfast · 美国 :flag-US: | [mirror.steadfast.net](https://mirror.steadfast.net "https://mirror.steadfast.net") | | 北美 · 不列颠哥伦比亚大学 · 加拿大 :flag-CA: | [mirror.it.ubc.ca](https://mirror.it.ubc.ca "https://mirror.it.ubc.ca") | | 北美 · GoCodeIT · 加拿大 :flag-CA: | [mirror.xenyth.net](https://mirror.xenyth.net "https://mirror.xenyth.net") | | 北美 · Switch · 加拿大 :flag-CA: | [mirrors.switch.ca](https://mirrors.switch.ca "https://mirrors.switch.ca") | === ":fontawesome-solid-earth-americas: 南美洲" | 镜像站名称 | 镜像站地址 | | :- | :-: | | 南美 · PoP-SC · 巴西 :flag-BR: | [mirror.pop-sc.rnp.br/mirror](https://mirror.pop-sc.rnp.br/mirror "https://mirror.pop-sc.rnp.br/mirror") | | 南美 · 蓬塔格罗萨州立大学 · 巴西 :flag-BR: | [mirror.uepg.br](https://mirror.uepg.br "https://mirror.uepg.br") | | 南美 · UFSCar · 巴西 :flag-BR: | [mirror.ufscar.br](https://mirror.ufscar.br "https://mirror.ufscar.br") | | 南美 · Sysarmy Community · 阿根廷 :flag-AR: | [mirrors.eze.sysarmy.com](https://mirrors.eze.sysarmy.com "https://mirrors.eze.sysarmy.com") | === ":fontawesome-solid-earth-oceania: 大洋洲" | 镜像站名称 | 镜像站地址 | | :- | :-: | | 大洋 · Fremont Cabal Internet Exchange(FCIX) · 澳大利亚 :flag-AU: | [gsl-syd.mm.fcix.net](https://gsl-syd.mm.fcix.net "https://gsl-syd.mm.fcix.net") | | 大洋 · AARNet · 澳大利亚 :flag-AU: | [mirror.aarnet.edu.au/pub](https://mirror.aarnet.edu.au/pub "https://mirror.aarnet.edu.au/pub") | | 大洋 · DataMossa · 澳大利亚 :flag-AU: | [mirror.datamossa.io](https://mirror.datamossa.io "https://mirror.datamossa.io") | | 大洋 · Amaze · 澳大利亚 :flag-AU: | [mirror.amaze.com.au](https://mirror.amaze.com.au "https://mirror.amaze.com.au") | | 大洋 · xTom · 澳大利亚 :flag-AU: | [mirrors.xtom.au](https://mirrors.xtom.au "https://mirrors.xtom.au") | | 大洋 · Over the Wire · 澳大利亚 :flag-AU: | [mirror.overthewire.com.au](https://mirror.overthewire.com.au "https://mirror.overthewire.com.au") | | 大洋 · Free Software Mirror Group · 新西兰 :flag-NZ: | [mirror.fsmg.org.nz](https://mirror.fsmg.org.nz "https://mirror.fsmg.org.nz") | === ":fontawesome-solid-earth-africa: 非洲" | 镜像站名称 | 镜像站地址 | | :- | :-: | | 非洲 · Liquid Telecom · 肯尼亚 :flag-KE: | [mirror.liquidtelecom.com](https://mirror.liquidtelecom.com "https://mirror.liquidtelecom.com") | | 非洲 · Dimension Data · 南非 :flag-ZA: | [mirror.dimensiondata.com](https://mirror.dimensiondata.com "https://mirror.dimensiondata.com") | === ":octicons-globe-16: 全部" | 镜像站名称 | 镜像站地址 | | :- | :-: | | 亚洲 · 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") | | 亚洲 · SG.GS · 新加坡 :flag-SG: | [mirror.sg.gs](https://mirror.sg.gs "https://mirror.sg.gs") | | 亚洲 · xTom · 新加坡 :flag-SG: | [mirrors.xtom.sg](https://mirrors.xtom.sg "https://mirrors.xtom.sg") | | 亚洲 · 自由软件实验室(NCHC) · 台湾 :flag-TW: | [free.nchc.org.tw](https://free.nchc.org.tw "https://free.nchc.org.tw") | | 亚洲 · OSS Planet · 台湾 :flag-TW: | [mirror.ossplanet.net](https://mirror.ossplanet.net "https://mirror.ossplanet.net") | | 亚洲 · 国立阳明交通大学 · 台湾 :flag-TW: | [linux.cs.nctu.edu.tw](https://linux.cs.nctu.edu.tw "https://linux.cs.nctu.edu.tw") | | 亚洲 · 淡江大学 · 台湾 :flag-TW: | [ftp.tku.edu.tw](https://ftp.tku.edu.tw "https://ftp.tku.edu.tw") | | 亚洲 · Taiwan Digital Streaming · 台湾 :flag-TW: | [mirror.twds.com.tw](https://mirror.twds.com.tw "https://mirror.twds.com.tw") | | 亚洲 · AniGil Linux Archive · 韩国 :flag-KR: | [mirror.anigil.com](https://mirror.anigil.com "https://mirror.anigil.com") | | 亚洲 · 工业网络安全中心(ICSCoE) · 日本 :flag-JP: | [ftp.udx.icscoe.jp/Linux](https://ftp.udx.icscoe.jp/Linux "https://ftp.udx.icscoe.jp/Linux") | | 亚洲 · 北陆先端科学技术大学院大学(JAIST) · 日本 :flag-JP: | [ftp.jaist.ac.jp/pub/Linux](https://ftp.jaist.ac.jp/pub/Linux "https://ftp.jaist.ac.jp/pub/Linux") | | 亚洲 · 山形大学 · 日本 :flag-JP: | [linux2.yz.yamagata-u.ac.jp/pub/Linux](https://linux2.yz.yamagata-u.ac.jp/pub/Linux "https://linux2.yz.yamagata-u.ac.jp/pub/Linux") | | 亚洲 · xTom · 日本 :flag-JP: | [mirrors.xtom.jp](https://mirrors.xtom.jp "https://mirrors.xtom.jp") | | 亚洲 · GB Network Solutions · 马来西亚 :flag-MY: | [mirrors.gbnetwork.com](https://mirrors.gbnetwork.com "https://mirrors.gbnetwork.com") | | 亚洲 · 孔敬大学 · 泰国 :flag-TH: | [mirror.kku.ac.th](https://mirror.kku.ac.th "https://mirror.kku.ac.th") | | 欧洲 · Vorboss Ltd · 英国 :flag-GB: | [mirror.vorboss.net](https://mirror.vorboss.net "https://mirror.vorboss.net") | | 欧洲 · QuickHost · 英国 :flag-GB: | [mirror.quickhost.uk](https://mirror.quickhost.uk "https://mirror.quickhost.uk") | | 欧洲 · dogado · 德国 :flag-DE: | [mirror.dogado.de](https://mirror.dogado.de "https://mirror.dogado.de") | | 欧洲 · xTom · 德国 :flag-DE: | [mirrors.xtom.de](https://mirrors.xtom.de "https://mirrors.xtom.de") | | 欧洲 · 亚琛工业大学(RWTH Aachen) · 德国 :flag-DE: | [ftp.halifax.rwth-aachen.de](https://ftp.halifax.rwth-aachen.de "https://ftp.halifax.rwth-aachen.de") | | 欧洲 · 德累斯顿大学(AG DSN) · 德国 :flag-DE: | [ftp.agdsn.de](https://ftp.agdsn.de "https://ftp.agdsn.de") | | 欧洲 · CCIN2P3 · 法国 :flag-FR: | [mirror.in2p3.fr/pub/linux](https://mirror.in2p3.fr/pub/linux "https://mirror.in2p3.fr/pub/linux") | | 欧洲 · Ircam · 法国 :flag-FR: | [mirrors.ircam.fr/pub](https://mirrors.ircam.fr/pub "https://mirrors.ircam.fr/pub") | | 欧洲 · Crans · 法国 :flag-FR: | [eclats.crans.org](https://eclats.crans.org "https://eclats.crans.org") | | 欧洲 · CRIHAN · 法国 :flag-FR: | [ftp.crihan.fr](https://ftp.crihan.fr "https://ftp.crihan.fr") | | 欧洲 · xTom · 荷兰 :flag-NL: | [mirrors.xtom.nl](https://mirrors.xtom.nl "https://mirrors.xtom.nl") | | 欧洲 · DataPacket · 荷兰 :flag-NL: | [mirror.datapacket.com](https://mirror.datapacket.com "https://mirror.datapacket.com") | | 欧洲 · Linux Kernel · 荷兰 :flag-NL: | [eu.edge.kernel.org](https://eu.edge.kernel.org "https://eu.edge.kernel.org") | | 欧洲 · xTom · 爱沙尼亚 :flag-EE: | [mirrors.xtom.ee](https://mirrors.xtom.ee "https://mirrors.xtom.ee") | | 欧洲 · netsite · 丹麦 :flag-DK: | [mirror.netsite.dk](https://mirror.netsite.dk "https://mirror.netsite.dk") | | 欧洲 · Dotsrc · 丹麦 :flag-DK: | [mirrors.dotsrc.org](https://mirrors.dotsrc.org "https://mirrors.dotsrc.org") | | 欧洲 · Academic Computer Club · 瑞典 :flag-SE: | [mirror.accum.se](https://mirror.accum.se "https://mirror.accum.se") | | 欧洲 · Lysator · 瑞典 :flag-SE: | [ftp.lysator.liu.se](https://ftp.lysator.liu.se "https://ftp.lysator.liu.se") | | 欧洲 · Yandex · 俄罗斯 :flag-RU: | [mirror.yandex.ru](https://mirror.yandex.ru "https://mirror.yandex.ru") | | 欧洲 · ia64 · 俄罗斯 :flag-RU: | [mirror.linux-ia64.org](https://mirror.linux-ia64.org "https://mirror.linux-ia64.org") | | 欧洲 · Truenetwork · 俄罗斯 :flag-RU: | [mirror.truenetwork.ru](https://mirror.truenetwork.ru "https://mirror.truenetwork.ru") | | 欧洲 · Belgian Research Network · 比利时 :flag-BE: | [ftp.belnet.be/mirror](https://ftp.belnet.be/mirror "https://ftp.belnet.be/mirror") | | 欧洲 · 克里特大学计算机中心 · 希腊 :flag-GR: | [ftp.cc.uoc.gr/mirrors/linux](https://ftp.cc.uoc.gr/mirrors/linux "https://ftp.cc.uoc.gr/mirrors/linux") | | 欧洲 · 马萨里克大学信息学院 · 捷克 :flag-CZ: | [ftp.fi.muni.cz/pub/linux](https://ftp.fi.muni.cz/pub/linux "https://ftp.fi.muni.cz/pub/linux") | | 欧洲 · 捷克理工大学学生会俱乐部(Silicon Hill) · 捷克 :flag-CZ: | [ftp.sh.cvut.cz](https://ftp.sh.cvut.cz "https://ftp.sh.cvut.cz") | | 欧洲 · Vodafone · 捷克 :flag-CZ: | [mirror.karneval.cz/pub/linux](https://mirror.karneval.cz/pub/linux "https://mirror.karneval.cz/pub/linux") | | 欧洲 · CZ.NIC · 捷克 :flag-CZ: | [mirrors.nic.cz](https://mirrors.nic.cz "https://mirrors.nic.cz") | | 欧洲 · 苏黎世联邦理工学院 · 瑞士 :flag-CH: | [mirror.ethz.ch](https://mirror.ethz.ch "https://mirror.ethz.ch") | | 北美 · Linux Kernel · 美国 :flag-US: | [mirrors.kernel.org](https://mirrors.kernel.org "https://mirrors.kernel.org") | | 北美 · 麻省理工学院(MIT) · 美国 :flag-US: | [mirrors.mit.edu](https://mirrors.mit.edu "https://mirrors.mit.edu") | | 北美 · 普林斯顿大学数学系 · 美国 :flag-US: | [mirror.math.princeton.edu/pub](https://mirror.math.princeton.edu/pub "https://mirror.math.princeton.edu/pub") | | 北美 · 俄勒冈州立大学开源实验室 · 美国 :flag-US: | [ftp-chi.osuosl.org/pub](https://ftp-chi.osuosl.org/pub "https://ftp-chi.osuosl.org/pub") | | 北美 · Fremont Cabal Internet Exchange(FCIX) · 美国 :flag-US: | [mirror.fcix.net](https://mirror.fcix.net "https://mirror.fcix.net") | | 北美 · xTom · 美国 :flag-US: | [mirrors.xtom.com](https://mirrors.xtom.com "https://mirrors.xtom.com") | | 北美 · Steadfast · 美国 :flag-US: | [mirror.steadfast.net](https://mirror.steadfast.net "https://mirror.steadfast.net") | | 北美 · 不列颠哥伦比亚大学 · 加拿大 :flag-CA: | [mirror.it.ubc.ca](https://mirror.it.ubc.ca "https://mirror.it.ubc.ca") | | 北美 · GoCodeIT · 加拿大 :flag-CA: | [mirror.xenyth.net](https://mirror.xenyth.net "https://mirror.xenyth.net") | | 北美 · Switch · 加拿大 :flag-CA: | [mirrors.switch.ca](https://mirrors.switch.ca "https://mirrors.switch.ca") | | 南美 · PoP-SC · 巴西 :flag-BR: | [mirror.pop-sc.rnp.br/mirror](https://mirror.pop-sc.rnp.br/mirror "https://mirror.pop-sc.rnp.br/mirror") | | 南美 · 蓬塔格罗萨州立大学 · 巴西 :flag-BR: | [mirror.uepg.br](https://mirror.uepg.br "https://mirror.uepg.br") | | 南美 · UFSCar · 巴西 :flag-BR: | [mirror.ufscar.br](https://mirror.ufscar.br "https://mirror.ufscar.br") | | 南美 · Sysarmy Community · 阿根廷 :flag-AR: | [mirrors.eze.sysarmy.com](https://mirrors.eze.sysarmy.com "https://mirrors.eze.sysarmy.com") | | 大洋 · Fremont Cabal Internet Exchange(FCIX) · 澳大利亚 :flag-AU: | [gsl-syd.mm.fcix.net](https://gsl-syd.mm.fcix.net "https://gsl-syd.mm.fcix.net") | | 大洋 · AARNet · 澳大利亚 :flag-AU: | [mirror.aarnet.edu.au/pub](https://mirror.aarnet.edu.au/pub "https://mirror.aarnet.edu.au/pub") | | 大洋 · DataMossa · 澳大利亚 :flag-AU: | [mirror.datamossa.io](https://mirror.datamossa.io "https://mirror.datamossa.io") | | 大洋 · Amaze · 澳大利亚 :flag-AU: | [mirror.amaze.com.au](https://mirror.amaze.com.au "https://mirror.amaze.com.au") | | 大洋 · xTom · 澳大利亚 :flag-AU: | [mirrors.xtom.au](https://mirrors.xtom.au "https://mirrors.xtom.au") | | 大洋 · Over the Wire · 澳大利亚 :flag-AU: | [mirror.overthewire.com.au](https://mirror.overthewire.com.au "https://mirror.overthewire.com.au") | | 大洋 · Free Software Mirror Group · 新西兰 :flag-NZ: | [mirror.fsmg.org.nz](https://mirror.fsmg.org.nz "https://mirror.fsmg.org.nz") | | 非洲 · Liquid Telecom · 肯尼亚 :flag-KE: | [mirror.liquidtelecom.com](https://mirror.liquidtelecom.com "https://mirror.liquidtelecom.com") | | 非洲 · Dimension Data · 南非 :flag-ZA: | [mirror.dimensiondata.com](https://mirror.dimensiondata.com "https://mirror.dimensiondata.com") | ???+ note "帮助项目完善更多境外、海外软件源" 该列表中的软件源参考自 [`Ubuntu 镜像列表`](https://launchpad.net/ubuntu/+cdmirrors "https://launchpad.net/ubuntu/+cdmirrors")、[`Debian 镜像列表`](https://www.debian.org/CD/http-ftp/#mirrors "https://www.debian.org/CD/http-ftp/#mirrors")、[`Fedora Mirror Manager`](https://mirrormanager.fedoraproject.org/mirrors "https://mirrormanager.fedoraproject.org/mirrors") 并且在此之前全部经过了有效性验证,但未作实际测试 作者没有精力持续维护列表中的这些境外、海外镜像站,如果你想补充更多软件源或更正当前已有,请修改脚本内的 [`mirror_list_abroad 数组变量`](https://github.com/SuperManito/LinuxMirrors/blob/main/ChangeMirrors.sh#L70 "https://github.com/SuperManito/LinuxMirrors/blob/main/ChangeMirrors.sh#L70") 并按照下面的编辑规范进行修改 你可以在确认镜像站地址无误后前往 GitHub 仓库提交 [Pull Requests](https://github.com/SuperManito/LinuxMirrors/pulls "https://github.com/SuperManito/LinuxMirrors/pulls"),也可以 :material-source-fork: Fork 仓库后自行定制使用 - 境外以及海外软件源(镜像站)编辑规范: 完整格式:`洲 · 软件源名称 · 国家/地区@软件源地址(域名)` 请根据地理位置、国家或地区进行排序以便于用户选择,有标志性缩写字符的单位应在最后用括号补充,单位的名称应以域名作为优先原则,下面是命名规则: - 教育单位:需使用中文译名,全称中若含有国家或地区的名称则也要带上,注意区分下属单位,例如学院、学生会、社团等。常见的二级域名格式 `ftp.mirrors.xxx.xxx` 应直接采用顶级单位的名称,如果有三级域名则应考虑是否在名称中加上下属单位,以域名为优先原则 注:`Technology` 一词应称为 `理工` 而不能使用翻译结果的 `技术` 一词,大部分教育单位都有正式或公认的中文译名 - 非教育单位:应优先采用其上属官网所自称的品牌名称,注意是正式的英文名称而不是logo中的字符,如果没有并且网站是除中文、英文以外的语言文字应使用网站域名作为名称 ## 工具网站 !!! tip "该页面展示的均为脚本默认提供可供选择的软件源地址,如果没有找到你想使用的也没有关系,脚本支持命令选项可自定义使用,详见[高级用法](../use/index.md#命令选项高级用法)" --- !!! warning "由于该页面的信息可能会引起争议,为了避免不必要的麻烦,建议不要在部分社交媒体的分享中包含此页面内容" 本页面涉及的旗帜图标仅用于快速区分地理位置,不代表作者任何的政治立场,请不要过度解读,特此声明。 ================================================ FILE: docs/mirrors/index.zh-Hant.md ================================================ --- hide: - navigation - toc - feedback - footer search: exclude: true --- ## 中國大陸 :flag-CN:

正在載入表格

???+ question "使用幫助" :supported: 支援    :unsupport: 不支援    :incompatible: 不相容,表示鏡像站上的倉庫目錄命名不符合腳本預設規則但可以透過命令選項來使用,關於具體用法範例和各作業系統所使用的預設分支名稱[請參見此處](../use/index.md#指定軟體源倉庫目錄)。 如果這裡沒有想使用的鏡像站,那可以看看其它運行模式和命令選項。鏡像站的速度分為同步刷新速度和用戶下載速度,後者才是關鍵,具體請結合實際地理位置選擇嘗試,也可以透過[輔助工具網站](#工具網站)進行一些測試。 :material-thumb-up-outline: 使用建議:速度上推薦 `中科大`、`字節(火山引擎)`,地域相容性上推薦 `阿里雲`、`騰訊雲`,軟體源種類上推薦 `南京大學`、`中科院`,境外、海外或複雜網路環境下不建議使用 `清華(TUNA)` 等容易阻斷的鏡像站。 ??? note "中國大陸教育網(點擊展開查看)" | 鏡像站名稱 | 鏡像站位址 | | :- | :-: | | 北京大學 | [mirrors.pku.edu.cn](https://mirrors.pku.edu.cn "https://mirrors.pku.edu.cn") | | 北京交通大學 | [mirror.bjtu.edu.cn](https://mirror.bjtu.edu.cn "https://mirror.bjtu.edu.cn") | | 北京外國語大學 | [mirrors.bfsu.edu.cn](https://mirrors.bfsu.edu.cn "https://mirrors.bfsu.edu.cn") | | 北京郵電大學 | [mirror.bupt.edu.cn](https://mirror.bupt.edu.cn "https://mirror.bupt.edu.cn") | | 重慶大學 | [mirrors.cqu.edu.cn](https://mirrors.cqu.edu.cn "https://mirrors.cqu.edu.cn") | | 重慶郵電大學 | [mirrors.cqupt.edu.cn](https://mirrors.cqupt.edu.cn "https://mirrors.cqupt.edu.cn") | | 大連東軟信息學院 | [mirrors.neusoft.edu.cn](https://mirrors.neusoft.edu.cn "https://mirrors.neusoft.edu.cn") | | 電子科技大學 | [mirrors.uestc.cn](https://mirrors.uestc.cn "https://mirrors.uestc.cn") | | 華南農業大學 | [mirrors.scau.edu.cn](https://mirrors.scau.edu.cn "https://mirrors.scau.edu.cn") | | 華中科技大學 | [mirrors.hust.edu.cn](https://mirrors.hust.edu.cn "https://mirrors.hust.edu.cn") | | 吉林大學 | [mirrors.jlu.edu.cn](https://mirrors.jlu.edu.cn "https://mirrors.jlu.edu.cn") | | 荊楚理工學院 | [mirrors.jcut.edu.cn](https://mirrors.jcut.edu.cn "https://mirrors.jcut.edu.cn") | | 江西理工大學 | [mirrors.jxust.edu.cn](https://mirrors.jxust.edu.cn "https://mirrors.jxust.edu.cn") | | 蘭州大學 | [mirror.lzu.edu.cn](https://mirror.lzu.edu.cn "https://mirror.lzu.edu.cn") | | 南京大學 | [mirrors.nju.edu.cn](https://mirrors.nju.edu.cn "https://mirrors.nju.edu.cn") | | 南京工業大學 | [mirrors.njtech.edu.cn](https://mirrors.njtech.edu.cn "https://mirrors.njtech.edu.cn") | | 南京郵電大學 | [mirrors.njupt.edu.cn](https://mirrors.njupt.edu.cn "https://mirrors.njupt.edu.cn") | | 南方科技大學 | [mirrors.sustech.edu.cn](https://mirrors.sustech.edu.cn "https://mirrors.sustech.edu.cn") | | 南陽理工學院 | [mirror.nyist.edu.cn](https://mirror.nyist.edu.cn "https://mirror.nyist.edu.cn") | | 齊魯工業大學 | [mirrors.qlu.edu.cn](https://mirrors.qlu.edu.cn "https://mirrors.qlu.edu.cn") | | 清華大學 | [mirrors.tuna.tsinghua.edu.cn](https://mirrors.tuna.tsinghua.edu.cn "https://mirrors.tuna.tsinghua.edu.cn") | | 山東大學 | [mirrors.sdu.edu.cn](https://mirrors.sdu.edu.cn "https://mirrors.sdu.edu.cn") | | 上海科技大學 | [mirrors.shanghaitech.edu.cn](https://mirrors.shanghaitech.edu.cn "https://mirrors.shanghaitech.edu.cn") | | 上海交通大學(思源) | [mirror.sjtu.edu.cn](https://mirror.sjtu.edu.cn "https://mirror.sjtu.edu.cn") | | 上海交通大學(致遠) | [mirrors.sjtug.sjtu.edu.cn](https://mirrors.sjtug.sjtu.edu.cn "https://mirrors.sjtug.sjtu.edu.cn") | | 武昌首義學院 | [mirrors.wsyu.edu.cn](https://mirrors.wsyu.edu.cn "https://mirrors.wsyu.edu.cn") | | 西安交通大學 | [mirrors.xjtu.edu.cn](https://mirrors.xjtu.edu.cn "https://mirrors.xjtu.edu.cn") | | 西北農林科技大學 | [mirrors.nwafu.edu.cn](https://mirrors.nwafu.edu.cn "https://mirrors.nwafu.edu.cn") | | 浙江大學 | [mirrors.zju.edu.cn](https://mirrors.zju.edu.cn "https://mirrors.zju.edu.cn") | | 中國科學技術大學 | [mirrors.ustc.edu.cn](https://mirrors.ustc.edu.cn "https://mirrors.ustc.edu.cn") | ## 國際地區 :flag-world-map: === ":fontawesome-solid-earth-asia: 亞洲" | 鏡像站名稱 | 鏡像站位址 | | :- | :-: | | 亞洲 · 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") | | 亞洲 · SG.GS · 新加坡 :flag-SG: | [mirror.sg.gs](https://mirror.sg.gs "https://mirror.sg.gs") | | 亞洲 · xTom · 新加坡 :flag-SG: | [mirrors.xtom.sg](https://mirrors.xtom.sg "https://mirrors.xtom.sg") | | 亞洲 · 自由軟體實驗室(NCHC) · 臺灣 :flag-TW: | [free.nchc.org.tw](https://free.nchc.org.tw "https://free.nchc.org.tw") | | 亞洲 · OSS Planet · 臺灣 :flag-TW: | [mirror.ossplanet.net](https://mirror.ossplanet.net "https://mirror.ossplanet.net") | | 亞洲 · 國立陽明交通大學 · 臺灣 :flag-TW: | [linux.cs.nctu.edu.tw](https://linux.cs.nctu.edu.tw "https://linux.cs.nctu.edu.tw") | | 亞洲 · 淡江大學 · 臺灣 :flag-TW: | [ftp.tku.edu.tw](https://ftp.tku.edu.tw "https://ftp.tku.edu.tw") | | 亞洲 · Taiwan Digital Streaming · 臺灣 :flag-TW: | [mirror.twds.com.tw](https://mirror.twds.com.tw "https://mirror.twds.com.tw") | | 亞洲 · AniGil Linux Archive · 韓國 :flag-KR: | [mirror.anigil.com](https://mirror.anigil.com "https://mirror.anigil.com") | | 亞洲 · 工業網路安全中心(ICSCoE) · 日本 :flag-JP: | [ftp.udx.icscoe.jp/Linux](https://ftp.udx.icscoe.jp/Linux "https://ftp.udx.icscoe.jp/Linux") | | 亞洲 · 北陸先端科學技術大學院大學(JAIST) · 日本 :flag-JP: | [ftp.jaist.ac.jp/pub/Linux](https://ftp.jaist.ac.jp/pub/Linux "https://ftp.jaist.ac.jp/pub/Linux") | | 亞洲 · 山形大學 · 日本 :flag-JP: | [linux2.yz.yamagata-u.ac.jp/pub/Linux](https://linux2.yz.yamagata-u.ac.jp/pub/Linux "https://linux2.yz.yamagata-u.ac.jp/pub/Linux") | | 亞洲 · xTom · 日本 :flag-JP: | [mirrors.xtom.jp](https://mirrors.xtom.jp "https://mirrors.xtom.jp") | | 亞洲 · GB Network Solutions · 馬來西亞 :flag-MY: | [mirrors.gbnetwork.com](https://mirrors.gbnetwork.com "https://mirrors.gbnetwork.com") | | 亞洲 · 孔敬大學 · 泰國 :flag-TH: | [mirror.kku.ac.th](https://mirror.kku.ac.th "https://mirror.kku.ac.th") | === ":fontawesome-solid-earth-europe: 歐洲" | 鏡像站名稱 | 鏡像站位址 | | :- | :-: | | 歐洲 · Vorboss Ltd · 英國 :flag-GB: | [mirror.vorboss.net](https://mirror.vorboss.net "https://mirror.vorboss.net") | | 歐洲 · QuickHost · 英國 :flag-GB: | [mirror.quickhost.uk](https://mirror.quickhost.uk "https://mirror.quickhost.uk") | | 歐洲 · dogado · 德國 :flag-DE: | [mirror.dogado.de](https://mirror.dogado.de "https://mirror.dogado.de") | | 歐洲 · xTom · 德國 :flag-DE: | [mirrors.xtom.de](https://mirrors.xtom.de "https://mirrors.xtom.de") | | 歐洲 · 亞琛工業大學(RWTH Aachen) · 德國 :flag-DE: | [ftp.halifax.rwth-aachen.de](https://ftp.halifax.rwth-aachen.de "https://ftp.halifax.rwth-aachen.de") | | 歐洲 · 德勒斯登大學(AG DSN) · 德國 :flag-DE: | [ftp.agdsn.de](https://ftp.agdsn.de "https://ftp.agdsn.de") | | 歐洲 · CCIN2P3 · 法國 :flag-FR: | [mirror.in2p3.fr/pub/linux](https://mirror.in2p3.fr/pub/linux "https://mirror.in2p3.fr/pub/linux") | | 歐洲 · Ircam · 法國 :flag-FR: | [mirrors.ircam.fr/pub](https://mirrors.ircam.fr/pub "https://mirrors.ircam.fr/pub") | | 歐洲 · Crans · 法國 :flag-FR: | [eclats.crans.org](https://eclats.crans.org "https://eclats.crans.org") | | 歐洲 · CRIHAN · 法國 :flag-FR: | [ftp.crihan.fr](https://ftp.crihan.fr "https://ftp.crihan.fr") | | 歐洲 · xTom · 荷蘭 :flag-NL: | [mirrors.xtom.nl](https://mirrors.xtom.nl "https://mirrors.xtom.nl") | | 歐洲 · DataPacket · 荷蘭 :flag-NL: | [mirror.datapacket.com](https://mirror.datapacket.com "https://mirror.datapacket.com") | | 歐洲 · Linux Kernel · 荷蘭 :flag-NL: | [eu.edge.kernel.org](https://eu.edge.kernel.org "https://eu.edge.kernel.org") | | 歐洲 · xTom · 愛沙尼亞 :flag-EE: | [mirrors.xtom.ee](https://mirrors.xtom.ee "https://mirrors.xtom.ee") | | 歐洲 · netsite · 丹麥 :flag-DK: | [mirror.netsite.dk](https://mirror.netsite.dk "https://mirror.netsite.dk") | | 歐洲 · Dotsrc · 丹麥 :flag-DK: | [mirrors.dotsrc.org](https://mirrors.dotsrc.org "https://mirrors.dotsrc.org") | | 歐洲 · Academic Computer Club · 瑞典 :flag-SE: | [mirror.accum.se](https://mirror.accum.se "https://mirror.accum.se") | | 歐洲 · Lysator · 瑞典 :flag-SE: | [ftp.lysator.liu.se](https://ftp.lysator.liu.se "https://ftp.lysator.liu.se") | | 歐洲 · Yandex · 俄羅斯 :flag-RU: | [mirror.yandex.ru](https://mirror.yandex.ru "https://mirror.yandex.ru") | | 歐洲 · ia64 · 俄羅斯 :flag-RU: | [mirror.linux-ia64.org](https://mirror.linux-ia64.org "https://mirror.linux-ia64.org") | | 歐洲 · Truenetwork · 俄羅斯 :flag-RU: | [mirror.truenetwork.ru](https://mirror.truenetwork.ru "https://mirror.truenetwork.ru") | | 歐洲 · Belgian Research Network · 比利時 :flag-BE: | [ftp.belnet.be/mirror](https://ftp.belnet.be/mirror "https://ftp.belnet.be/mirror") | | 歐洲 · 克里特大學電腦中心 · 希臘 :flag-GR: | [ftp.cc.uoc.gr/mirrors/linux](https://ftp.cc.uoc.gr/mirrors/linux "https://ftp.cc.uoc.gr/mirrors/linux") | | 歐洲 · 馬薩里克大學信息學院 · 捷克 :flag-CZ: | [ftp.fi.muni.cz/pub/linux](https://ftp.fi.muni.cz/pub/linux "https://ftp.fi.muni.cz/pub/linux") | | 歐洲 · 捷克理工大學學生會俱樂部(Silicon Hill) · 捷克 :flag-CZ: | [ftp.sh.cvut.cz](https://ftp.sh.cvut.cz "https://ftp.sh.cvut.cz") | | 歐洲 · Vodafone · 捷克 :flag-CZ: | [mirror.karneval.cz/pub/linux](https://mirror.karneval.cz/pub/linux "https://mirror.karneval.cz/pub/linux") | | 歐洲 · CZ.NIC · 捷克 :flag-CZ: | [mirrors.nic.cz](https://mirrors.nic.cz "https://mirrors.nic.cz") | | 歐洲 · 蘇黎世聯邦理工學院 · 瑞士 :flag-CH: | [mirror.ethz.ch](https://mirror.ethz.ch "https://mirror.ethz.ch") | === ":fontawesome-solid-earth-americas: 北美洲" | 鏡像站名稱 | 鏡像站位址 | | :- | :-: | | 北美 · Linux Kernel · 美國 :flag-US: | [mirrors.kernel.org](https://mirrors.kernel.org "https://mirrors.kernel.org") | | 北美 · 麻省理工學院(MIT) · 美國 :flag-US: | [mirrors.mit.edu](https://mirrors.mit.edu "https://mirrors.mit.edu") | | 北美 · 普林斯頓大學數學系 · 美國 :flag-US: | [mirror.math.princeton.edu/pub](https://mirror.math.princeton.edu/pub "https://mirror.math.princeton.edu/pub") | | 北美 · 俄勒岡州立大學開源實驗室 · 美國 :flag-US: | [ftp-chi.osuosl.org/pub](https://ftp-chi.osuosl.org/pub "https://ftp-chi.osuosl.org/pub") | | 北美 · Fremont Cabal Internet Exchange(FCIX) · 美國 :flag-US: | [mirror.fcix.net](https://mirror.fcix.net "https://mirror.fcix.net") | | 北美 · xTom · 美國 :flag-US: | [mirrors.xtom.com](https://mirrors.xtom.com "https://mirrors.xtom.com") | | 北美 · Steadfast · 美國 :flag-US: | [mirror.steadfast.net](https://mirror.steadfast.net "https://mirror.steadfast.net") | | 北美 · 不列顛哥倫比亞大學 · 加拿大 :flag-CA: | [mirror.it.ubc.ca](https://mirror.it.ubc.ca "https://mirror.it.ubc.ca") | | 北美 · GoCodeIT · 加拿大 :flag-CA: | [mirror.xenyth.net](https://mirror.xenyth.net "https://mirror.xenyth.net") | | 北美 · Switch · 加拿大 :flag-CA: | [mirrors.switch.ca](https://mirrors.switch.ca "https://mirrors.switch.ca") | === ":fontawesome-solid-earth-americas: 南美洲" | 鏡像站名稱 | 鏡像站位址 | | :- | :-: | | 南美 · PoP-SC · 巴西 :flag-BR: | [mirror.pop-sc.rnp.br/mirror](https://mirror.pop-sc.rnp.br/mirror "https://mirror.pop-sc.rnp.br/mirror") | | 南美 · 蓬塔格羅薩州立大學 · 巴西 :flag-BR: | [mirror.uepg.br](https://mirror.uepg.br "https://mirror.uepg.br") | | 南美 · UFSCar · 巴西 :flag-BR: | [mirror.ufscar.br](https://mirror.ufscar.br "https://mirror.ufscar.br") | | 南美 · Sysarmy Community · 阿根廷 :flag-AR: | [mirrors.eze.sysarmy.com](https://mirrors.eze.sysarmy.com "https://mirrors.eze.sysarmy.com") | === ":fontawesome-solid-earth-oceania: 大洋洲" | 鏡像站名稱 | 鏡像站位址 | | :- | :-: | | 大洋 · Fremont Cabal Internet Exchange(FCIX) · 澳大利亞 :flag-AU: | [gsl-syd.mm.fcix.net](https://gsl-syd.mm.fcix.net "https://gsl-syd.mm.fcix.net") | | 大洋 · AARNet · 澳大利亞 :flag-AU: | [mirror.aarnet.edu.au/pub](https://mirror.aarnet.edu.au/pub "https://mirror.aarnet.edu.au/pub") | | 大洋 · DataMossa · 澳大利亞 :flag-AU: | [mirror.datamossa.io](https://mirror.datamossa.io "https://mirror.datamossa.io") | | 大洋 · Amaze · 澳大利亞 :flag-AU: | [mirror.amaze.com.au](https://mirror.amaze.com.au "https://mirror.amaze.com.au") | | 大洋 · xTom · 澳大利亞 :flag-AU: | [mirrors.xtom.au](https://mirrors.xtom.au "https://mirrors.xtom.au") | | 大洋 · Over the Wire · 澳大利亞 :flag-AU: | [mirror.overthewire.com.au](https://mirror.overthewire.com.au "https://mirror.overthewire.com.au") | | 大洋 · Free Software Mirror Group · 紐西蘭 :flag-NZ: | [mirror.fsmg.org.nz](https://mirror.fsmg.org.nz "https://mirror.fsmg.org.nz") | === ":fontawesome-solid-earth-africa: 非洲" | 鏡像站名稱 | 鏡像站位址 | | :- | :-: | | 非洲 · Liquid Telecom · 肯亞 :flag-KE: | [mirror.liquidtelecom.com](https://mirror.liquidtelecom.com "https://mirror.liquidtelecom.com") | | 非洲 · Dimension Data · 南非 :flag-ZA: | [mirror.dimensiondata.com](https://mirror.dimensiondata.com "https://mirror.dimensiondata.com") | === ":octicons-globe-16: 全部" | 鏡像站名稱 | 鏡像站位址 | | :- | :-: | | 亞洲 · 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") | | 亞洲 · SG.GS · 新加坡 :flag-SG: | [mirror.sg.gs](https://mirror.sg.gs "https://mirror.sg.gs") | | 亞洲 · xTom · 新加坡 :flag-SG: | [mirrors.xtom.sg](https://mirrors.xtom.sg "https://mirrors.xtom.sg") | | 亞洲 · 自由軟體實驗室(NCHC) · 臺灣 :flag-TW: | [free.nchc.org.tw](https://free.nchc.org.tw "https://free.nchc.org.tw") | | 亞洲 · OSS Planet · 臺灣 :flag-TW: | [mirror.ossplanet.net](https://mirror.ossplanet.net "https://mirror.ossplanet.net") | | 亞洲 · 國立陽明交通大學 · 臺灣 :flag-TW: | [linux.cs.nctu.edu.tw](https://linux.cs.nctu.edu.tw "https://linux.cs.nctu.edu.tw") | | 亞洲 · 淡江大學 · 臺灣 :flag-TW: | [ftp.tku.edu.tw](https://ftp.tku.edu.tw "https://ftp.tku.edu.tw") | | 亞洲 · Taiwan Digital Streaming · 臺灣 :flag-TW: | [mirror.twds.com.tw](https://mirror.twds.com.tw "https://mirror.twds.com.tw") | | 亞洲 · AniGil Linux Archive · 韓國 :flag-KR: | [mirror.anigil.com](https://mirror.anigil.com "https://mirror.anigil.com") | | 亞洲 · 工業網路安全中心(ICSCoE) · 日本 :flag-JP: | [ftp.udx.icscoe.jp/Linux](https://ftp.udx.icscoe.jp/Linux "https://ftp.udx.icscoe.jp/Linux") | | 亞洲 · 北陸先端科學技術大學院大學(JAIST) · 日本 :flag-JP: | [ftp.jaist.ac.jp/pub/Linux](https://ftp.jaist.ac.jp/pub/Linux "https://ftp.jaist.ac.jp/pub/Linux") | | 亞洲 · 山形大學 · 日本 :flag-JP: | [linux2.yz.yamagata-u.ac.jp/pub/Linux](https://linux2.yz.yamagata-u.ac.jp/pub/Linux "https://linux2.yz.yamagata-u.ac.jp/pub/Linux") | | 亞洲 · xTom · 日本 :flag-JP: | [mirrors.xtom.jp](https://mirrors.xtom.jp "https://mirrors.xtom.jp") | | 亞洲 · GB Network Solutions · 馬來西亞 :flag-MY: | [mirrors.gbnetwork.com](https://mirrors.gbnetwork.com "https://mirrors.gbnetwork.com") | | 亞洲 · 孔敬大學 · 泰國 :flag-TH: | [mirror.kku.ac.th](https://mirror.kku.ac.th "https://mirror.kku.ac.th") | | 歐洲 · Vorboss Ltd · 英國 :flag-GB: | [mirror.vorboss.net](https://mirror.vorboss.net "https://mirror.vorboss.net") | | 歐洲 · QuickHost · 英國 :flag-GB: | [mirror.quickhost.uk](https://mirror.quickhost.uk "https://mirror.quickhost.uk") | | 歐洲 · dogado · 德國 :flag-DE: | [mirror.dogado.de](https://mirror.dogado.de "https://mirror.dogado.de") | | 歐洲 · xTom · 德國 :flag-DE: | [mirrors.xtom.de](https://mirrors.xtom.de "https://mirrors.xtom.de") | | 歐洲 · 亞琛工業大學(RWTH Aachen) · 德國 :flag-DE: | [ftp.halifax.rwth-aachen.de](https://ftp.halifax.rwth-aachen.de "https://ftp.halifax.rwth-aachen.de") | | 歐洲 · 德勒斯登大學(AG DSN) · 德國 :flag-DE: | [ftp.agdsn.de](https://ftp.agdsn.de "https://ftp.agdsn.de") | | 歐洲 · CCIN2P3 · 法國 :flag-FR: | [mirror.in2p3.fr/pub/linux](https://mirror.in2p3.fr/pub/linux "https://mirror.in2p3.fr/pub/linux") | | 歐洲 · Ircam · 法國 :flag-FR: | [mirrors.ircam.fr/pub](https://mirrors.ircam.fr/pub "https://mirrors.ircam.fr/pub") | | 歐洲 · Crans · 法國 :flag-FR: | [eclats.crans.org](https://eclats.crans.org "https://eclats.crans.org") | | 歐洲 · CRIHAN · 法國 :flag-FR: | [ftp.crihan.fr](https://ftp.crihan.fr "https://ftp.crihan.fr") | | 歐洲 · xTom · 荷蘭 :flag-NL: | [mirrors.xtom.nl](https://mirrors.xtom.nl "https://mirrors.xtom.nl") | | 歐洲 · DataPacket · 荷蘭 :flag-NL: | [mirror.datapacket.com](https://mirror.datapacket.com "https://mirror.datapacket.com") | | 歐洲 · Linux Kernel · 荷蘭 :flag-NL: | [eu.edge.kernel.org](https://eu.edge.kernel.org "https://eu.edge.kernel.org") | | 歐洲 · xTom · 愛沙尼亞 :flag-EE: | [mirrors.xtom.ee](https://mirrors.xtom.ee "https://mirrors.xtom.ee") | | 歐洲 · netsite · 丹麥 :flag-DK: | [mirror.netsite.dk](https://mirror.netsite.dk "https://mirror.netsite.dk") | | 歐洲 · Dotsrc · 丹麥 :flag-DK: | [mirrors.dotsrc.org](https://mirrors.dotsrc.org "https://mirrors.dotsrc.org") | | 歐洲 · Academic Computer Club · 瑞典 :flag-SE: | [mirror.accum.se](https://mirror.accum.se "https://mirror.accum.se") | | 歐洲 · Lysator · 瑞典 :flag-SE: | [ftp.lysator.liu.se](https://ftp.lysator.liu.se "https://ftp.lysator.liu.se") | | 歐洲 · Yandex · 俄羅斯 :flag-RU: | [mirror.yandex.ru](https://mirror.yandex.ru "https://mirror.yandex.ru") | | 歐洲 · ia64 · 俄羅斯 :flag-RU: | [mirror.linux-ia64.org](https://mirror.linux-ia64.org "https://mirror.linux-ia64.org") | | 歐洲 · Truenetwork · 俄羅斯 :flag-RU: | [mirror.truenetwork.ru](https://mirror.truenetwork.ru "https://mirror.truenetwork.ru") | | 歐洲 · Belgian Research Network · 比利時 :flag-BE: | [ftp.belnet.be/mirror](https://ftp.belnet.be/mirror "https://ftp.belnet.be/mirror") | | 歐洲 · 克里特大學電腦中心 · 希臘 :flag-GR: | [ftp.cc.uoc.gr/mirrors/linux](https://ftp.cc.uoc.gr/mirrors/linux "https://ftp.cc.uoc.gr/mirrors/linux") | | 歐洲 · 馬薩里克大學信息學院 · 捷克 :flag-CZ: | [ftp.fi.muni.cz/pub/linux](https://ftp.fi.muni.cz/pub/linux "https://ftp.fi.muni.cz/pub/linux") | | 歐洲 · 捷克理工大學學生會俱樂部(Silicon Hill) · 捷克 :flag-CZ: | [ftp.sh.cvut.cz](https://ftp.sh.cvut.cz "https://ftp.sh.cvut.cz") | | 歐洲 · Vodafone · 捷克 :flag-CZ: | [mirror.karneval.cz/pub/linux](https://mirror.karneval.cz/pub/linux "https://mirror.karneval.cz/pub/linux") | | 歐洲 · CZ.NIC · 捷克 :flag-CZ: | [mirrors.nic.cz](https://mirrors.nic.cz "https://mirrors.nic.cz") | | 歐洲 · 蘇黎世聯邦理工學院 · 瑞士 :flag-CH: | [mirror.ethz.ch](https://mirror.ethz.ch "https://mirror.ethz.ch") | | 北美 · Linux Kernel · 美國 :flag-US: | [mirrors.kernel.org](https://mirrors.kernel.org "https://mirrors.kernel.org") | | 北美 · 麻省理工學院(MIT) · 美國 :flag-US: | [mirrors.mit.edu](https://mirrors.mit.edu "https://mirrors.mit.edu") | | 北美 · 普林斯頓大學數學系 · 美國 :flag-US: | [mirror.math.princeton.edu/pub](https://mirror.math.princeton.edu/pub "https://mirror.math.princeton.edu/pub") | | 北美 · 俄勒岡州立大學開源實驗室 · 美國 :flag-US: | [ftp-chi.osuosl.org/pub](https://ftp-chi.osuosl.org/pub "https://ftp-chi.osuosl.org/pub") | | 北美 · Fremont Cabal Internet Exchange(FCIX) · 美國 :flag-US: | [mirror.fcix.net](https://mirror.fcix.net "https://mirror.fcix.net") | | 北美 · xTom · 美國 :flag-US: | [mirrors.xtom.com](https://mirrors.xtom.com "https://mirrors.xtom.com") | | 北美 · Steadfast · 美國 :flag-US: | [mirror.steadfast.net](https://mirror.steadfast.net "https://mirror.steadfast.net") | | 北美 · 不列顛哥倫比亞大學 · 加拿大 :flag-CA: | [mirror.it.ubc.ca](https://mirror.it.ubc.ca "https://mirror.it.ubc.ca") | | 北美 · GoCodeIT · 加拿大 :flag-CA: | [mirror.xenyth.net](https://mirror.xenyth.net "https://mirror.xenyth.net") | | 北美 · Switch · 加拿大 :flag-CA: | [mirrors.switch.ca](https://mirrors.switch.ca "https://mirrors.switch.ca") | | 南美 · PoP-SC · 巴西 :flag-BR: | [mirror.pop-sc.rnp.br/mirror](https://mirror.pop-sc.rnp.br/mirror "https://mirror.pop-sc.rnp.br/mirror") | | 南美 · 蓬塔格羅薩州立大學 · 巴西 :flag-BR: | [mirror.uepg.br](https://mirror.uepg.br "https://mirror.uepg.br") | | 南美 · UFSCar · 巴西 :flag-BR: | [mirror.ufscar.br](https://mirror.ufscar.br "https://mirror.ufscar.br") | | 南美 · Sysarmy Community · 阿根廷 :flag-AR: | [mirrors.eze.sysarmy.com](https://mirrors.eze.sysarmy.com "https://mirrors.eze.sysarmy.com") | | 大洋 · Fremont Cabal Internet Exchange(FCIX) · 澳大利亞 :flag-AU: | [gsl-syd.mm.fcix.net](https://gsl-syd.mm.fcix.net "https://gsl-syd.mm.fcix.net") | | 大洋 · AARNet · 澳大利亞 :flag-AU: | [mirror.aarnet.edu.au/pub](https://mirror.aarnet.edu.au/pub "https://mirror.aarnet.edu.au/pub") | | 大洋 · DataMossa · 澳大利亞 :flag-AU: | [mirror.datamossa.io](https://mirror.datamossa.io "https://mirror.datamossa.io") | | 大洋 · Amaze · 澳大利亞 :flag-AU: | [mirror.amaze.com.au](https://mirror.amaze.com.au "https://mirror.amaze.com.au") | | 大洋 · xTom · 澳大利亞 :flag-AU: | [mirrors.xtom.au](https://mirrors.xtom.au "https://mirrors.xtom.au") | | 大洋 · Over the Wire · 澳大利亞 :flag-AU: | [mirror.overthewire.com.au](https://mirror.overthewire.com.au "https://mirror.overthewire.com.au") | | 大洋 · Free Software Mirror Group · 紐西蘭 :flag-NZ: | [mirror.fsmg.org.nz](https://mirror.fsmg.org.nz "https://mirror.fsmg.org.nz") | | 非洲 · Liquid Telecom · 肯亞 :flag-KE: | [mirror.liquidtelecom.com](https://mirror.liquidtelecom.com "https://mirror.liquidtelecom.com") | | 非洲 · Dimension Data · 南非 :flag-ZA: | [mirror.dimensiondata.com](https://mirror.dimensiondata.com "https://mirror.dimensiondata.com") | ???+ note "幫助專案完善更多境外、海外軟體源" 此清單中的軟體源參考自 [`Ubuntu 鏡像清單`](https://launchpad.net/ubuntu/+cdmirrors "https://launchpad.net/ubuntu/+cdmirrors")、[`Debian 鏡像清單`](https://www.debian.org/CD/http-ftp/#mirrors "https://www.debian.org/CD/http-ftp/#mirrors")、[`Fedora Mirror Manager`](https://mirrormanager.fedoraproject.org/mirrors "https://mirrormanager.fedoraproject.org/mirrors") 並且在此之前全部經過有效性驗證,但在此之前未完成了實際測試 作者沒有精力持續維護清單中的這些境外、海外鏡像站,如果你想補充更多軟體源或更正目前已有,請修改腳本內的 [`mirror_list_abroad 陣列變數`](https://github.com/SuperManito/LinuxMirrors/blob/main/ChangeMirrors.sh#L70 "https://github.com/SuperManito/LinuxMirrors/blob/main/ChangeMirrors.sh#L70") 並依照下面的編輯規格進行修改 你可以在確認鏡像站位址無誤後前往 GitHub 倉庫提交 [Pull Requests](https://github.com/SuperManito/LinuxMirrors/pulls "https://github.com/SuperManito/LinuxMirrors/pulls"),也可以 :material-source-fork: Fork 倉庫後自訂使用 - 境外以及海外軟體源(鏡像站)編輯規格: 完整格式:`洲 · 軟體源名稱 · 國家/地區@軟體源位址(網域)` 請根據地理位置、國家或地區進行排序以便於使用者選擇,有標誌性縮寫字元的單位應在最後用括號補充,單位的名稱應以網域名稱作為優先原則,以下是命名規則: - 教育單位:需使用中文譯名,全稱若含有國家或地區的名稱也要帶上,注意區分下屬單位,例如學院、學生會、社團等。常見的二級網域格式 `ftp.mirrors.xxx.xxx` 應直接採用頂級單位的名稱,如果有三級網域則應考慮是否在名稱中加上下屬單位,以網域為優先原則 註:`Technology` 一詞應稱為 `理工` 而不能使用翻譯結果的 `技術` 一詞,大部分教育單位都有正式或公認的中文譯名 - 非教育單位:應優先採用其上屬官網所自稱的品牌名稱,注意是正式的英文名稱而不是logo中的字符,如果沒有並且網站是除中文、英文以外的語言文字應使用網站域名作為名稱 ## 工具網站 !!! tip "該頁面顯示的皆為腳本預設提供可供選擇的軟體源位址,如果沒有找到你想使用的也沒有關係,腳本支援命令選項可自定義使用,詳見[進階用法](../use/index.md#命令選項進階用法)" --- !!! warning "由於該頁面的資訊可能會引起爭議,為了避免不必要的麻煩,建議不要在部分社交媒體的分享中包含此頁面內容" 本頁面涉及的旗幟圖示僅用於快速區分地理位置,不代表作者任何的政治立場,請不要過度解讀,特此聲明。 ================================================ FILE: docs/mirrors/sitemap.en.xml ================================================ ================================================ FILE: docs/mirrors/sitemap.xml ================================================ ================================================ FILE: docs/mirrors/sitemap.zh-Hant.xml ================================================ ================================================ FILE: docs/other/example1.md ================================================ ``` bash # !/bin/bash function install_docker() { if command -v docker &>/dev/null; then return fi # script options local script_host="linuxmirrors.cn" # official host (CDN), more host see official site local close_firewall="true" # close firewalld service and selinux (redhat systems need) # mirrors options local source_docker_ce_address="mirrors.tencent.com/docker-ce" # global high availability address local source_docker_ce_protocol="https" # https or http local source_docker_registry_address="registry.hub.docker.com" # judge network environment local region_code="$(curl -s ipinfo.io/country)" if [[ "${region_code}" == "CN" ]]; then local source_intranet_address="" # use intranet source if possible if [ -s "/sys/class/dmi/id/sys_vendor" ]; then local sys_vendor="$(cat /sys/class/dmi/id/sys_vendor)" if [[ "${sys_vendor}" == *"Alibaba"* ]]; then source_intranet_address="mirrors.cloud.aliyuncs.com/docker-ce" elif [[ "${sys_vendor}" == *"Huawei"* ]]; then source_intranet_address="mirrors.myhuaweicloud.com/docker-ce" elif [[ "${sys_vendor}" == *"Tencent"* ]]; then source_intranet_address="mirrors.tencentyun.com/docker-ce" elif [[ "${sys_vendor}" == *"Inspur"* ]]; then source_intranet_address="mirrors.ivolces.com/docker-ce" fi else cat /etc/motd | grep "Alibaba Cloud " -q if [ $? -eq 0 ]; then source_intranet_address="mirrors.cloud.aliyuncs.com/docker-ce" fi fi # check connectivity if [ -n "${source_intranet_address}" ]; then if ping -c1 -W1 "${source_intranet_address%%/*}" >/dev/null 2>&1; then source_docker_ce_address="${source_intranet_address}" source_docker_ce_protocol="http" fi fi # registry mirror (best choice for Chinese mainland) source_docker_registry_address="docker.1ms.run" else # use official source source_docker_ce_address="download.docker.com" source_docker_registry_address="registry.hub.docker.com" fi # install docker engine bash <(curl -sSL https://${script_host}/docker-lite.sh) \ --source "${source_docker_ce_address}" \ --source-registry "${source_docker_registry_address}" \ --protocol "${source_docker_ce_protocol}" \ --close-firewall "${close_firewall}" } install_docker ``` ================================================ FILE: docs/other/example2.md ================================================ ``` bash # !/bin/bash function install_docker() { if command -v docker &>/dev/null; then return fi bash <(curl -sSL https://${script_host}/docker.sh) \ --install-latest true \ --ignore-backup-tips \ --lang auto if command -v docker &>/dev/null; then echo -e "\n# Docker installation successful.\n# Please run this script again manually after installation." exit 0 else echo -e "\n# Docker installation failed.\n# Please check the error message above." exit 1 fi } install_docker ``` ================================================ FILE: docs/other/index.en.md ================================================ --- hide: - navigation - footer --- # :simple-docker:{style="color: #1d63ed"} Docker Installation & Registry Mirror Switcher ## One-Click Command === "Install" !!! quote "" === ":linuxmirrors: Official Site (Recommended)" ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --en ``` === ":simple-github: GitHub" ``` bash bash <(curl -sSL https://raw.githubusercontent.com/SuperManito/LinuxMirrors/main/DockerInstallation.sh) --en ``` === ":simple-gitee: Gitee" ``` bash bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/DockerInstallation.sh) --en ``` > Real-time sync, no delay. Recommended for use in Chinese mainland network environments. === ":simple-gitcode: GitCode" ``` bash bash <(curl -sSL https://raw.gitcode.com/SuperManito/LinuxMirrors/raw/main/DockerInstallation.sh) --en ``` > 1-hour sync delay. === ":simple-jsdelivr: jsDelivr (CDN)" ``` bash bash <(curl -sSL https://cdn.jsdelivr.net/gh/SuperManito/LinuxMirrors@main/DockerInstallation.sh) --en ``` === ":tencent-cloud: Tencent Cloud EO (CDN)" ``` bash bash <(curl -sSL https://edgeone.linuxmirrors.cn/docker.sh) --en ``` > Not recommended in Chinese mainland network environments. Integrates installation of [`Docker Engine`](https://docs.docker.com/engine) and [`Docker Compose`](https://docs.docker.com/compose), supports selecting or switching software repositories (Docker repositories) and registry mirrors, installing specific versions, reinstalling, and supports ARM architecture. The script refers to the [official documentation](https://docs.docker.com/engine/install) and uses the system package manager for installation. There are no compatibility or security issues. The available versions are determined by the Docker CE repository. === "Only Switch Registry Mirror" !!! quote "" === ":linuxmirrors: Official Site (Recommended)" ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --en --only-registry ``` === ":simple-github: GitHub" ``` bash bash <(curl -sSL https://raw.githubusercontent.com/SuperManito/LinuxMirrors/main/DockerInstallation.sh) --en --only-registry ``` === ":simple-gitee: Gitee" ``` bash bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/DockerInstallation.sh) --en --only-registry ``` > Real-time sync, no delay. Recommended for use in Chinese mainland network environments. === ":simple-gitcode: GitCode" ``` bash bash <(curl -sSL https://raw.gitcode.com/SuperManito/LinuxMirrors/raw/main/DockerInstallation.sh) --en --only-registry ``` > 1-hour sync delay. === ":simple-jsdelivr: jsDelivr (CDN)" ``` bash bash <(curl -sSL https://cdn.jsdelivr.net/gh/SuperManito/LinuxMirrors@main/DockerInstallation.sh) --en --only-registry ``` === ":tencent-cloud: Tencent Cloud EO (CDN)" ``` bash bash <(curl -sSL https://edgeone.linuxmirrors.cn/docker.sh) --en --only-registry ``` > Not recommended in Chinese mainland network environments.
- :material-shimmer:{ .lg .middle } __Completely replace the official installation script__ --- It is logically consistent with [get.docker.com](https://get.docker.com) and incorporates the repositories and features of this project. - :material-graph:{ .lg .middle } __Supports domestic derivative operating systems__ --- Compatible with a number of derivative operating systems not supported by the official installation script. :material-information-outline:{ title="In addition to the operating systems shown on the official website homepage, it also supports special systems such as those shown below.
  • Kylin Server
  • Huawei Cloud EulerOS
  • TencentOS Server
  • Alibaba Cloud Linux
" } - :material-weight-lifter:{ .lg .middle } __Powerful and unparalleled__ --- One of the most practical open source operation and maintenance scripts on the entire network, with excellent performance - :material-compass-rose:{ .lg .middle } __Exquisite interactive design__ --- An interactive command line interface that is easy to understand and use, way ahead of the competition

✨ After years of technical accumulation and production environment testing, it has been widely praised by the community and deeply loved by developers. It is used by major companies.


!!! tip "Docker Compose does not require a separate installation" Starting from V2, Docker Compose is part of the Docker CLI. The script integrates the installation of this [plugin](https://docs.docker.com/compose/install/linux) by default. Please use the `docker compose` command instead of `docker-compose`. !!! node "About Software Sources"
- __Docker CE Software Repository__ --- Docker CE stands for Docker Community Edition, which is another name for Docker Engine. This repository is used to download and install Docker-related packages. - __Docker Registry Mirror__ --- Used to control the default source repository for pulling images, also known as a registry accelerator. The default is the official container registry [Docker Hub](https://hub.docker.com).
Due to some force majeure, [Docker Hub](https://hub.docker.com) is currently inaccessible in the Chinese mainland network environment, so the image cannot be pulled normally. It is recommended to use the image repository source available in Chinese mainland mentioned below. Note: The specified Web protocol in the script is only for controlling the `Docker CE` software source. `Docker Registry` always uses the `HTTPS` protocol. !!! quote "Built-in Registry Mirrors"
Available in Chinese mainland
| Site Name | Address | Description | | :--: | :--: | :-- | | 1ms Mirror | [docker.1ms.run](https://1ms.run "docker.1ms.run") | Enterprise mirror, CDN smart distribution, extremely fast, supports paid customization, recommended | | Docker Proxy | [dockerproxy.net](https://dockerproxy.net "dockerproxy.net") | Created by ghproxy, highly available but slow, supports paid enterprise acceleration | | DaoCloud | [docker.m.daocloud.io](https://docker.m.daocloud.io "docker.m.daocloud.io") | Well-known enterprise mirror, highly available and fast, now whitelist only | | 1Panel Mirror | [docker.1panel.live](https://1panel.cn "docker.1panel.live") | Enterprise product self-use mirror |
This open source project is not suitable for collecting personal self-built registry accelerators. If needed, you can use command options to specify your own.
Others
| Site Name | Address | Site Name | Address | | :- | :-: | :- | :-: | | Alibaba Cloud (Hangzhou) | [registry.cn-hangzhou.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-hangzhou.aliyuncs.com") | Alibaba Cloud (Japan - Tokyo) | [registry.ap-northeast-1.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.ap-northeast-1.aliyuncs.com") | | Alibaba Cloud (Shanghai) | [registry.cn-shanghai.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-shanghai.aliyuncs.com") | Alibaba Cloud (Singapore) | [registry.ap-southeast-1.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.ap-southeast-1.aliyuncs.com") | | Alibaba Cloud (Qingdao) | [registry.cn-qingdao.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-qingdao.aliyuncs.com") | Alibaba Cloud (Malaysia - Kuala Lumpur) | [registry.ap-southeast-3.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.ap-southeast-3.aliyuncs.com") | | Alibaba Cloud (Beijing) | [registry.cn-beijing.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-beijing.aliyuncs.com") | Alibaba Cloud (Indonesia - Jakarta) | [registry.ap-southeast-5.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.ap-southeast-5.aliyuncs.com") | | Alibaba Cloud (Zhangjiakou) | [registry.cn-zhangjiakou.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-zhangjiakou.aliyuncs.com") | Alibaba Cloud (Germany - Frankfurt) | [registry.eu-central-1.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.eu-central-1.aliyuncs.com") | | Alibaba Cloud (Hohhot) | [registry.cn-huhehaote.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-huhehaote.aliyuncs.com") | Alibaba Cloud (UK - London) | [registry.eu-west-1.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.eu-west-1.aliyuncs.com") | | Alibaba Cloud (Ulanqab) | [registry.cn-wulanchabu.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-wulanchabu.aliyuncs.com") | Alibaba Cloud (US West - Silicon Valley) | [registry.us-west-1.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.us-west-1.aliyuncs.com") | | Alibaba Cloud (Shenzhen) | [registry.cn-shenzhen.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-shenzhen.aliyuncs.com") | Alibaba Cloud (US East - Virginia) | [registry.us-east-1.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.us-east-1.aliyuncs.com") | | Alibaba Cloud (Heyuan) | [registry.cn-heyuan.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-heyuan.aliyuncs.com") | Alibaba Cloud (UAE - Dubai) | [registry.me-east-1.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.me-east-1.aliyuncs.com") | | Alibaba Cloud (Guangzhou) | [registry.cn-guangzhou.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-guangzhou.aliyuncs.com") | Google Cloud (North America) | [gcr.io](https://cloud.google.com/artifact-registry/docs/transition/gcr-repositories?hl=zh-cn "https://gcr.io") | | Alibaba Cloud (Chengdu) | [registry.cn-chengdu.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-chengdu.aliyuncs.com") | Google Cloud (Asia) | [asia.gcr.io](https://cloud.google.com/artifact-registry/docs/transition/gcr-repositories?hl=zh-cn "https://asia.gcr.io") | | Alibaba Cloud (Hong Kong) | [registry.cn-hongkong.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-hongkong.aliyuncs.com") | Google Cloud (Europe) | [eu.gcr.io](https://cloud.google.com/artifact-registry/docs/transition/gcr-repositories?hl=zh-cn "https://eu.gcr.io") | | Tencent Cloud | [mirror.ccs.tencentyun.com](https://cloud.tencent.com/document/product/1207/45596 "https://mirror.ccs.tencentyun.com") | Docker Hub | [registry.hub.docker.com](https://hub.docker.com/ "registry.hub.docker.com") |
Note: Registry mirrors from domestic cloud computing companies are only for their own business. Instances in Chinese mainland may still not be able to access Docker Hub.
## Command Options (Advanced Usage) ``` $ bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --en --help Command options(name/meaning/value): --source Specify Docker CE mirror address (domain or IP) address --source-registry Specify Docker Registry mirror address (domain or IP) address --branch Specify Docker CE mirror repository (path) repo name --branch-version Specify Docker CE mirror repository version version --designated-version Specify Docker Engine installation version version --codename Specify Debian-based OS codename codename --protocol Specify Web protocol for Docker CE mirror http or https --use-intranet-source Prefer intranet Docker CE mirror address true or false --install-latest Whether to install the latest Docker Engine true or false --close-firewall Whether to disable the firewall true or false --clean-screen Whether to clear the screen before running true or false --lang Specify the language of the script output language --only-registry Only switch registry mirror mode none --ignore-backup-tips Ignore backup overwrite prompt (do not backup) none --pure-mode Pure mode, minimal output none --help Show help menu none ``` | Name | Meaning | Value | | :-: | :-: | :-: | | `--source` | Specify `Docker CE` mirror address (domain or IP) | `address` | | `--source-registry` | Specify `Docker Registry` mirror address (domain or IP) | `address (separate multiple entries with commas)` | | `--branch` | Specify `Docker CE` mirror repository (path) | `repo name (see docs below)` | | `--branch-version` | Specify `Docker CE` mirror repository version | `version (see docs below)` | | `--designated-version` | Specify `Docker Engine` installation version | `version (see docs below)` | | `--codename` | Specify `Debian-based` OS codename | `codename` | | `--protocol` | Specify Web protocol for `Docker CE` mirror | `http` or `https` | | `--use-intranet-source` | Prefer intranet `Docker CE` mirror address | `true` or `false` | | `--install-latest` | Whether to install the latest `Docker Engine` | `true` or `false` | | `--close-firewall` | Whether to disable the firewall | `true` or `false` | | `--clean-screen` | Whether to clear the screen before running | `true` or `false` | | `--lang` | Specify the language of the script output | `language id (see docs below)` | | `--only-registry` | Only switch registry mirror mode | none | | `--ignore-backup-tips` | Ignore backup overwrite prompt (do not backup) | none | | `--pure-mode` | Pure mode, minimal output | none | | `--help` | Show help menu | none | > Full source format: `< Web protocol>:///` - ### Specify Registry Mirror Address ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --en --source-registry registry.example.com ``` Can specify multiple addresses at the same time, and they must be separated by commas. ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --en \ --source-registry "registry-1.example.com,registry-2.example.com" ``` - ### Only Switch Registry Mirror === "Use Script for One-Click Replacement" Only switches the registry accelerator. If Docker is not installed, an error will be reported and exit. ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --en --only-registry ``` Lazy one-click command (using multiple addresses) ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --en \ --only-registry \ --source-registry "docker.1ms.run,docker.1panel.live,docker.m.daocloud.io" ``` > The option value can specify multiple addresses, which must be separated by commas. === "Manual Replacement" - Install the `jq` package === "Debian-based / openKylin" ``` bash apt-get install -y jq ``` > `Debian`   `Ubuntu`   `Kali`   `Linux Mint`   `Deepin`   `Zorin OS`   `Armbian`   `Proxmox VE`   `Raspberry Pi OS`   `openKylin` For new systems, run `apt-get update` first. === "RedHat-based / openEuler / OpenCloudOS / Anolis OS" ``` bash dnf install -y jq || yum install -y jq ``` > `Red Hat Enterprise Linux`   `CentOS`   `Rocky Linux`   `AlmaLinux`   `Fedora`   `openEuler`   `OpenCloudOS`   `Anolis OS` - Specify registry mirror address > Manually replace `` with the registry address. See the address column in the "Built-in Registry Mirrors" table above. ``` bash SOURCE_REGISTRY='"https://"' ``` You can also specify multiple registry mirrors, e.g., `SOURCE_REGISTRY='"https://example.registry.com","https://test.registry.com"'`, separated by commas. - Replace registry mirror address ``` bash [ -s "/etc/docker/daemon.json" ] || echo "{}" >/etc/docker/daemon.json jq '.["registry-mirrors"] = ['"${SOURCE_REGISTRY}"']' /etc/docker/daemon.json >/etc/docker/daemon.json.tmp && mv /etc/docker/daemon.json.tmp ``` - Restart Docker service ``` bash systemctl daemon-reload [[ $(systemctl is-active docker) == "active" ]] && systemctl restart docker || systemctl enable --now docker ``` - ### Specify Docker CE Source Address ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --en --source mirror.example.com/docker-ce ``` > Note: The address path must include the Docker CE mirror repository path, i.e., `docker-ce`. - ### Specify Docker CE Source Repository The script will automatically detect this in most cases. Specify only if you have special requirements. ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --en --branch centos ``` > Repository names are fixed: [`centos`](https://download.docker.com/linux/centos/) [`debian`](https://download.docker.com/linux/debian/) [`fedora`](https://download.docker.com/linux/fedora/) [`raspbian`](https://download.docker.com/linux/raspbian/) [`rhel`](https://download.docker.com/linux/rhel/) [`sles`](https://download.docker.com/linux/sles/) [`static`](https://download.docker.com/linux/static/) [`ubuntu`](https://download.docker.com/linux/ubuntu/) > See [official installation docs](https://docs.docker.com/engine/install) and [Docker CE official repo](https://download.docker.com/linux) for details. ``` { .bash .no-copy title="Can also specify the repository version number." } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --en \ --branch centos \ --branch-version 9 ``` > This option can be used to control the compatibility of the installed software package (only applicable to Red Hat operating systems). For details, see the path name (positive integer) representing the version number in the corresponding repository directory. - ### Specify Docker Engine Installation Version When specifying a version, the "install latest" option is ignored. Format: `major.minor.patch`, e.g., `28.4.1`. ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --en --designated-version 28.0.0 ``` > If the specified version does not exist or is not supported on your system, the script will report an error and exit. ??? quote "How to view available versions" === "Debian-based" ``` bash apt-cache madison docker-ce | awk '{print $3}' | grep -Eo "[0-9][0-9].[0-9]{1,2}.[0-9]{1,2}" | sort -t '.' -k1,1nr -k2,2nr -k3,3nr ``` > `Debian`   `Ubuntu`   `Kali`   `Linux Mint`   `Deepin`   `Zorin OS`   `Armbian`   `Proxmox VE`   `Raspberry Pi OS` === "RedHat-based / openEuler / OpenCloudOS / Anolis OS" ``` bash dnf list docker-ce --showduplicates | sort -r | awk '{print $2}' | grep -Eo "[0-9][0-9].[0-9]{1,2}.[0-9]{1,2}" | sort -t '.' -k1,1nr -k2,2nr -k3,3nr ``` > `Red Hat Enterprise Linux`   `CentOS`   `Rocky Linux`   `AlmaLinux`   `Fedora`   `openEuler`   `OpenCloudOS`   `Anolis OS` Versions not listed are not supported by this script. If you cannot get the version list, your system environment has not been properly configured for the Docker CE repository (this will not happen when running the script). - ### I18n (Internationalization) The script provides multi-language support. Currently, there are three built-in display languages: `简体中文`、`繁體中文`、`English`. The default is `简体中文`. - #### Specify Language ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --lang xxx ``` | Type | Value | | :-: | :-: | | 简体中文 | `zh-hans` `zh-cn` `zh` | | 繁體中文 | `zh-hant` `zh-tw` `zh-hk` | | English | `en` `en-us` | It can also be used directly as a command option ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --zh-hant ``` > `--en` `--en-us` `--zh` `--zh-cn` `--zh-hans` `--zh-hant` - #### Select through interaction ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --lang auto ``` - ### Unattended (Automation) To perform installation without interaction, use at least the following options. Recommended for experienced users. ``` { .bash .no-copy title="Example Command" } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --en \ --source mirror.example.com/docker-ce \ --source-registry registry.hub.docker.com \ --protocol http \ --use-intranet-source false \ --install-latest true \ --close-firewall true \ --ignore-backup-tips ``` > If you get an "invalid option" error, check the option validity and whitespace encoding. Each option is written on a separate line for readability. - ### Pure Mode This feature is introduced to facilitate the use of developers and operation and maintenance personnel. After it is enabled, the script content output will be simplified. It is recommended to use it with other command options without interaction. ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --en --pure-mode ``` !!! tip "Scrolling command logs may have unpredictable display issues, but no problems have been found so far." ## FAQ - #### About Service Startup Errors !!! quote "" In non-fresh environments, you may encounter `Docker` service startup failures after running the script. It is recommended to reinstall to resolve this. Uninstalling will not delete local images or container data. Uninstall commands: === "Debian-based" ``` bash apt-get remove -y docker* containerd.io runc && apt-get autoremove ``` > `Debian`   `Ubuntu`   `Kali`   `Linux Mint`   `Deepin`   `Zorin OS`   `Armbian`   `Proxmox VE`   `Raspberry Pi OS` === "RedHat-based / openEuler / OpenCloudOS / Anolis OS" ``` bash yum remove -y docker* containerd.io podman* runc ``` > `Red Hat Enterprise Linux`   `CentOS`   `Rocky Linux`   `AlmaLinux`   `Fedora`   `openEuler`   `OpenCloudOS`   `Anolis OS` After uninstalling, simply rerun the script to install. - #### About unsupported operating systems If it prompts that it is not supported, please use the system's own package management tool to install it. Because these packages are built and maintained by the Linux distribution's package maintainers and may have differences in configuration or are built from modified source code. You can also use   [![Docker Desktop](../assets/images/icon/custom/docker-desktop.svg){ width="140" style="vertical-align: -0.2rem" }](https://www.docker.com/products/docker-desktop) ## 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/docker-lite.sh) ``` > Please familiarize yourself with this project before using it. It is not recommended for novice users. ## Best Practices ??? note "Code examples for enterprise product deployment and automated operations such as CI/CD (expand to view)" If you don't want any user interaction, use the `fully automated` example. - #### Fully automated (recommended) --8<-- "docs/other/example1.md" - #### Simple method --8<-- "docs/other/example2.md" > Note: If you don't specify `Docker CE` and `Docker Registry` mirrors, the script will be interactively selected by the user. The screen will be automatically cleared (`$ clear`) at this point, which will cause your script's log to be cleared. ================================================ FILE: docs/other/index.md ================================================ --- hide: - navigation - footer --- # :simple-docker:{style="color: #1d63ed"} Docker 安装与换源脚本 ## 一键执行命令 === "安装" !!! quote "" === ":linuxmirrors: 官网(推荐)" ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) ``` === ":simple-github: GitHub" ``` bash bash <(curl -sSL https://raw.githubusercontent.com/SuperManito/LinuxMirrors/main/DockerInstallation.sh) ``` === ":simple-gitee: Gitee 码云 (镜像仓库)" ``` bash bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/DockerInstallation.sh) ``` > 实时同步、无延迟,国内网络环境下推荐使用 === ":simple-gitcode: GitCode (镜像仓库)" ``` bash bash <(curl -sSL https://raw.gitcode.com/SuperManito/LinuxMirrors/raw/main/DockerInstallation.sh) ``` > 同步存在1小时延迟 === ":simple-jsdelivr: jsDelivr (CDN)" ``` bash bash <(curl -sSL https://cdn.jsdelivr.net/gh/SuperManito/LinuxMirrors@main/DockerInstallation.sh) ``` === ":tencent-cloud: 腾讯云 EO (CDN)" ``` bash bash <(curl -sSL https://edgeone.linuxmirrors.cn/docker.sh) ``` > 不建议在国内网络环境下使用 集成安装 [`Docker Engine`](https://docs.docker.com/engine) 和 [`Docker Compose`](https://docs.docker.com/compose),支持选择或更换软件源(Docker 软件仓库)以及镜像仓库、安装指定版本、重装等功能,支持 ARM 架构 脚本参考[官方文档](https://docs.docker.com/engine/install)使用系统包管理工具进行安装,不存在兼容性、安全性等问题,可安装的版本由 Docker CE 仓库决定 === "仅更换镜像加速器" !!! quote "" === ":linuxmirrors: 官网(推荐)" ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --only-registry ``` === ":simple-github: GitHub" ``` bash bash <(curl -sSL https://raw.githubusercontent.com/SuperManito/LinuxMirrors/main/DockerInstallation.sh) --only-registry ``` === ":simple-gitee: Gitee 码云 (镜像仓库)" ``` bash bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/DockerInstallation.sh) --only-registry ``` > 实时同步、无延迟,国内网络环境下推荐使用 === ":simple-gitcode: GitCode (镜像仓库)" ``` bash bash <(curl -sSL https://raw.gitcode.com/SuperManito/LinuxMirrors/raw/main/DockerInstallation.sh) --only-registry ``` > 同步存在1小时延迟 === ":simple-jsdelivr: jsDelivr (CDN)" ``` bash bash <(curl -sSL https://cdn.jsdelivr.net/gh/SuperManito/LinuxMirrors@main/DockerInstallation.sh) --only-registry ``` === ":tencent-cloud: 腾讯云 EO (CDN)" ``` bash bash <(curl -sSL https://edgeone.linuxmirrors.cn/docker.sh) --only-registry ``` > 不建议在国内网络环境下使用
- :material-shimmer:{ .lg .middle } __完全替代官方安装脚本__ --- 与 [get.docker.com](https://get.docker.com) 逻辑一致,融合了本项目换源架构以及特性 - :material-graph:{ .lg .middle } __支持国产衍生操作系统__ --- 兼容大量不受官方安装脚本支持的衍生操作系统 :material-information-outline:{ title="除官网首页展示的系统外还支持下方等特制系统
  • Kylin Server
  • Huawei Cloud EulerOS
  • TencentOS Server
  • Alibaba Cloud Linux
" } - :material-weight-lifter:{ .lg .middle } __功能强大、无与伦比__ --- 全网最实用的开源运维脚本之一,性能卓越 - :material-compass-rose:{ .lg .middle } __精妙绝伦的交互设计__ --- 易于理解和使用的交互式命令行界面,遥遥领先

✨ 经过了数年的技术沉淀与生产环境检验,广受社区好评,深得开发者喜爱,大厂都在使用


!!! tip "Docker Compose 不再需要独立安装" Docker Compose 自 V2 版本起开始作为 Docker CLI(命令行)的一部分,脚本默认集成安装该[插件](https://docs.docker.com/compose/install/linux),请使用 `docker compose` 命令替代 `docker-compose` !!! node "软件源说明"
- __Docker CE 软件仓库__ --- Docker CE 全称 Docker Community Edition(Docker 社区版),是 Docker Engine 的别称,该仓库用于下载并安装 Docker 相关软件包 - __Docker Registry 镜像仓库__ --- 用于控制拉取镜像的默认来源存储仓库,又称镜像加速器,默认为官方容器镜像仓库 [Docker Hub](https://hub.docker.com)
由于一些不可抗力的因素,国内网络环境下目前无法访问 [Docker Hub](https://hub.docker.com) 因此不能正常拉取镜像,建议使用下方提到的国内可用镜像仓库源 注:脚本内的指定 Web 协议交互仅用于控制 `Docker CE` 软件源,`Docker Registry` 强制使用 `HTTPS` 协议 !!! quote "内置的镜像仓库源"
国内可用
| 站点名称 | 地址 | 说明 | | :--: | :--: | :-- | | 毫秒镜像 | [docker.1ms.run](https://1ms.run "docker.1ms.run") | 企业镜像站,CDN智能分发速度极快,支持付费定制,推荐使用 | | Docker Proxy | [dockerproxy.net](https://dockerproxy.net "dockerproxy.net") | 由 ghproxy 创建,可用性高但速度很慢,支持企业镜像付费加速 | | DaoCloud 道客 | [docker.m.daocloud.io](https://docker.m.daocloud.io "docker.m.daocloud.io") | 老牌企业镜像站,可用性高且速度快,现为白名单模式 | | 1Panel 镜像 | [docker.1panel.live](https://1panel.cn "docker.1panel.live") | 企业产品自用镜像 |
本开源项目不适合采集个人自建的镜像加速器,如有需要可搭配命令选项自行使用
其它
| 站点名称 | 地址 | 站点名称 | 地址 | | :- | :-: | :- | :-: | | 阿里云(杭州) | [registry.cn-hangzhou.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-hangzhou.aliyuncs.com") | 阿里云(日本-东京) | [registry.ap-northeast-1.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.ap-northeast-1.aliyuncs.com") | | 阿里云(上海) | [registry.cn-shanghai.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-shanghai.aliyuncs.com") | 阿里云(新加坡) | [registry.ap-southeast-1.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.ap-southeast-1.aliyuncs.com") | | 阿里云(青岛) | [registry.cn-qingdao.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-qingdao.aliyuncs.com") | 阿里云(马来西亚-吉隆坡) | [registry.ap-southeast-3.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.ap-southeast-3.aliyuncs.com") | | 阿里云(北京) | [registry.cn-beijing.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-beijing.aliyuncs.com") | 阿里云(印度尼西亚-雅加达) | [registry.ap-southeast-5.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.ap-southeast-5.aliyuncs.com") | | 阿里云(张家口) | [registry.cn-zhangjiakou.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-zhangjiakou.aliyuncs.com") | 阿里云(德国-法兰克福) | [registry.eu-central-1.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.eu-central-1.aliyuncs.com") | | 阿里云(呼和浩特) | [registry.cn-huhehaote.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-huhehaote.aliyuncs.com") | 阿里云(英国-伦敦) | [registry.eu-west-1.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.eu-west-1.aliyuncs.com") | | 阿里云(乌兰察布) | [registry.cn-wulanchabu.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-wulanchabu.aliyuncs.com") | 阿里云(美国西部-硅谷) | [registry.us-west-1.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.us-west-1.aliyuncs.com") | | 阿里云(深圳) | [registry.cn-shenzhen.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-shenzhen.aliyuncs.com") | 阿里云(美国东部-弗吉尼亚) | [registry.us-east-1.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.us-east-1.aliyuncs.com") | | 阿里云(河源) | [registry.cn-heyuan.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-heyuan.aliyuncs.com") | 阿里云(阿联酋-迪拜) | [registry.me-east-1.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.me-east-1.aliyuncs.com") | | 阿里云(广州) | [registry.cn-guangzhou.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-guangzhou.aliyuncs.com") | 谷歌云(北美) | [gcr.io](https://cloud.google.com/artifact-registry/docs/transition/gcr-repositories?hl=zh-cn "https://gcr.io") | | 阿里云(成都) | [registry.cn-chengdu.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-chengdu.aliyuncs.com") | 谷歌云(亚洲) | [asia.gcr.io](https://cloud.google.com/artifact-registry/docs/transition/gcr-repositories?hl=zh-cn "https://asia.gcr.io") | | 阿里云(香港) | [registry.cn-hongkong.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-hongkong.aliyuncs.com") | 谷歌云(欧洲) | [eu.gcr.io](https://cloud.google.com/artifact-registry/docs/transition/gcr-repositories?hl=zh-cn "https://eu.gcr.io") | | 腾讯云 | [mirror.ccs.tencentyun.com](https://cloud.tencent.com/document/product/1207/45596 "https://mirror.ccs.tencentyun.com") | Docker Hub | [registry.hub.docker.com](https://hub.docker.com/ "registry.hub.docker.com") |
注:国内云计算企业的镜像仓库源仅针对其业务,境内实例可能仍无法访问 Docker Hub
## 命令选项(高级用法) ``` $ bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --help 命令选项(名称/含义/值): --source 指定 Docker CE 软件源地址(域名或IP) 地址 --source-registry 指定 Docker 镜像仓库地址(域名或IP) 地址 --branch 指定 Docker CE 软件源仓库(路径) 仓库名 --branch-version 指定 Docker CE 软件源仓库版本 版本号 --designated-version 指定 Docker Engine 安装版本 版本号 --codename 指定 Debian 系操作系统的版本代号 代号名称 --protocol 指定 Docker CE 软件源的 Web 协议 http 或 https --use-intranet-source 是否优先使用内网 Docker CE 软件源地址 true 或 false --install-latest 是否安装最新版本的 Docker Engine true 或 false --close-firewall 是否关闭防火墙 true 或 false --clean-screen 是否在运行前清除屏幕上的所有内容 true 或 false --lang 指定脚本输出的语言 语言 --only-registry 仅更换镜像仓库模式 无 --ignore-backup-tips 忽略覆盖备份提示 无 --pure-mode 纯净模式,精简打印内容 无 --help 查看帮助菜单 无 ``` | 名称 | 含义 | 选项值 | | :-: | :-: | :-: | | `--source` | 指定 `Docker CE` 源地址(域名或IP) | `地址` | | `--source-registry` | 指定 `Docker` 镜像仓库地址(域名或IP) | `地址(多个用英文逗号分割)` | | `--branch` | 指定 `Docker CE` 软件源仓库(路径) | `仓库名(详见下方文档)` | | `--branch-version` | 指定 `Docker CE` 软件源仓库版本 | `版本号(详见下方文档)` | | `--designated-version` | 指定 `Docker Engine` 安装版本 | `版本号(详见下方文档)` | | `--codename` | 指定 `Debian` 系操作系统的版本代号 | `代号名称` | | `--protocol` | 指定 `Docker CE` 源的 Web 协议 | `http` 或 `https` | | `--use-intranet-source` | 是否优先使用内网 `Docker CE` 软件源地址 | `true` 或 `false` | | `--install-latest` | 是否安装最新版本的 `Docker Engine` | `true` 或 `false` | | `--close-firewall` | 是否关闭防火墙 | `true` 或 `false` | | `--clean-screen` | 是否在运行前清除屏幕上的所有内容 | `true` 或 `false` | | `--lang` | 指定脚本输出的语言 | `语言ID(详见下方文档)` | | `--only-registry` | 仅更换镜像仓库模式 | 无 | | `--ignore-backup-tips` | 忽略覆盖备份提示(即不覆盖备份) | 无 | | `--pure-mode` | 纯净模式,精简打印内容 | 无 | | `--help` | 查看帮助菜单 | 无 | > 软件源完整格式 `://<软件源地址(域名或IP)>/<软件源仓库(路径)>` - ### 指定镜像仓库地址 ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --source-registry registry.example.com ``` 可以同时指定多个地址,需使用英文逗号进行分割 ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) \ --source-registry "registry-1.example.com,registry-2.example.com" ``` - ### 仅更换镜像仓库 === "使用脚本一键替换" 仅更换镜像加速器,当检测到未安装 Docker 时会报错跳出 ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --only-registry ``` 懒人一键命令(使用多个地址) ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) \ --only-registry \ --source-registry "docker.1ms.run,docker.1panel.live,docker.m.daocloud.io" ``` > 选项值可以指定多个地址,需使用英文逗号进行分割 === "手动替换" - 安装 `jq` 软件包 === "Debian 系 / openKylin" ``` bash apt-get install -y jq ``` > `Debian`   `Ubuntu`   `Kali`   `Linux Mint`   `Deepin`   `Zorin OS`   `Armbian`   `Proxmox VE`   `Raspberry Pi OS`   `openKylin` 新装系统需要先执行一遍更新 `apt-get update` === "RedHat 系 / openEuler / OpenCloudOS / Anolis OS" ``` bash dnf install -y jq || yum install -y jq ``` > `Red Hat Enterprise Linux`   `CentOS`   `Rocky Linux`   `AlmaLinux`   `Fedora`   `openEuler`   `OpenCloudOS`   `Anolis OS` - 指定镜像仓库地址 > 请手动替换 `` 为镜像仓库地址后在执行,详见上方 “项目内置的镜像仓库源” 表格中的地址列 ``` bash SOURCE_REGISTRY='"https://"' ``` 还可以指定多个镜像仓库,如 `SOURCE_REGISTRY='"https://example.registry.com","https://test.registry.com"'`,注意用英文逗号分割 - 替换镜像仓库地址 ``` bash [ -s "/etc/docker/daemon.json" ] || echo "{}" >/etc/docker/daemon.json jq '.["registry-mirrors"] = ['"${SOURCE_REGISTRY}"']' /etc/docker/daemon.json >/etc/docker/daemon.json.tmp && mv /etc/docker/daemon.json.tmp ``` - 重启 Docker 服务 ``` bash systemctl daemon-reload [[ $(systemctl is-active docker) == "active" ]] && systemctl restart docker || systemctl enable --now docker ``` - ### 指定 Docker CE 软件源地址 ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --source mirror.example.com/docker-ce ``` > 注意该地址路径需要包含镜像站的 Docker CE 软件源仓库路径即 `docker-ce` - ### 指定 Docker CE 软件源仓库 脚本默认会自动判断一般无需指定,除非你有特殊需求 ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --branch centos ``` > 仓库名是固定的,目前只有 [`centos`](https://download.docker.com/linux/centos/) [`debian`](https://download.docker.com/linux/debian/) [`fedora`](https://download.docker.com/linux/fedora/) [`raspbian`](https://download.docker.com/linux/raspbian/) [`rhel`](https://download.docker.com/linux/rhel/) [`sles`](https://download.docker.com/linux/sles/) [`static`](https://download.docker.com/linux/static/) [`ubuntu`](https://download.docker.com/linux/ubuntu/) 这几个 > 具体详见 [官方安装文档](https://docs.docker.com/engine/install) 和 [Docker CE 官方仓库](https://download.docker.com/linux) ``` { .bash .no-copy title="还可以指定仓库版本号" } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) \ --branch centos \ --branch-version 9 ``` > 可以使用该选项来控制安装软件包的兼容性(仅适用于红帽系操作系统),具体详见对应仓库目录中代表版本号的路径名称(正整数)。 - ### 指定 Docker Engine 安装版本 指定安装版本时会忽略 `是否安装最新版本` 的命令选项,格式为 `主版本.次版本.补丁版本`,例如 `28.4.1`。 ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --designated-version 28.0.0 ``` > 如果指定的版本不存在或者不支持当前系统,届时脚本会报错跳出 ??? quote "查看版本列表的方法" === "Debian 系" ``` bash apt-cache madison docker-ce | awk '{print $3}' | grep -Eo "[0-9][0-9].[0-9]{1,2}.[0-9]{1,2}" | sort -t '.' -k1,1nr -k2,2nr -k3,3nr ``` > `Debian`   `Ubuntu`   `Kali`   `Linux Mint`   `Deepin`   `Zorin OS`   `Armbian`   `Proxmox VE`   `Raspberry Pi OS` === "RedHat 系 / openEuler / OpenCloudOS / Anolis OS" ``` bash dnf list docker-ce --showduplicates | sort -r | awk '{print $2}' | grep -Eo "[0-9][0-9].[0-9]{1,2}.[0-9]{1,2}" | sort -t '.' -k1,1nr -k2,2nr -k3,3nr ``` > `Red Hat Enterprise Linux`   `CentOS`   `Rocky Linux`   `AlmaLinux`   `Fedora`   `openEuler`   `OpenCloudOS`   `Anolis OS` 未出现在该列表中的版本则不支持通过本脚本安装,如果获取不到版本列表说明你当前的系统环境还没有正确配置 Docker CE 软件源(运行脚本时不存在该问题) - ### 国际化(I18n) 脚本提供多语言支持,当前内置 `简体中文`、`繁體中文`、`English` 共三种显示语言,默认为 `简体中文` - #### 指定语言 ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --lang xxx ``` | 类型 | 值 | | :-: | :-: | | 简体中文 | `zh-hans` `zh-cn` `zh` | | 繁體中文 | `zh-hant` `zh-tw` `zh-hk` | | English | `en` `en-us` | 也可以直接作为命令选项使用 ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --en ``` > `--en` `--en-us` `--zh` `--zh-cn` `--zh-hans` `--zh-hant` - #### 通过交互进行选择 ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --lang auto ``` - ### 无人值守(自动化) 不通过交互完成安装操作,至少需要使用如下命令选项来实现,建议熟悉后再使用 ``` { .bash .no-copy title="参考命令" } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) \ --source mirror.example.com/docker-ce \ --source-registry registry.hub.docker.com \ --protocol http \ --use-intranet-source false \ --install-latest true \ --close-firewall true \ --ignore-backup-tips ``` > 如果报错 `命令选项无效` 那么请检查选项合法性以及空格字符编码,在示例中一行写一个选项是为了提高命令的可读性 - ### 纯净模式 推出该功能是为了便于开发以及运维人员使用,启用后会精简脚本内容输出,建议搭配其它命令选项无交互使用 ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --pure-mode ``` !!! tip "滚动输出的命令日志可能存在无法预料的显示问题,不过目前暂未发现异常" ## 常见问题 - #### 关于服务报错无法启动 !!! quote "" 非新装环境可能会在运行脚本后遇到 `Docker` 服务无法启动的情况,建议重新安装来解决,卸载不会删除本地镜像和容器数据 卸载命令如下: === "Debian 系" ``` bash apt-get remove -y docker* containerd.io runc && apt-get autoremove ``` > `Debian`   `Ubuntu`   `Kali`   `Linux Mint`   `Deepin`   `Zorin OS`   `Armbian`   `Proxmox VE`   `Raspberry Pi OS` === "RedHat 系 / openEuler / OpenCloudOS / Anolis OS" ``` bash yum remove -y docker* containerd.io podman* runc ``` > `Red Hat Enterprise Linux`   `CentOS`   `Rocky Linux`   `AlmaLinux`   `Fedora`   `openEuler`   `OpenCloudOS`   `Anolis OS` 卸载完成后重新执行脚本安装即可 - #### 关于不支持的操作系统 如果提示不支持那么请使用系统自带的包管理工具进行安装。因为这些软件包由 Linux 发行版的软件包维护者构建和维护,可能存在配置差异或由修改后的源代码构建。 也可以使用   [![Docker Desktop](../assets/images/icon/custom/docker-desktop.svg){ width="140" style="vertical-align: -0.2rem" }](https://www.docker.com/products/docker-desktop) ## 精简版(Lite) 额外提供一个精简版本,是主脚本的复制,面向企业产品、开源项目使用,具有以下特性: - 单一显示语言 `English`,无 I18n 国际化功能 - 默认使用官方源,去除了交互选择内置软件源功能 - 去除了无关的打印内容 - 保留核心逻辑与命令选项设计 ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker-lite.sh) ``` > 请熟悉本项目后再使用,不建议新手用户使用 ## 最佳实践 ??? note "适用于企业产品部署以及 CI/CD 等自动化运维场景的代码示例(展开查看)" 如果你不想让用户进行任何交互,请使用 `完全自动化` 示例 - #### 完全自动化(推荐) --8<-- "docs/other/example1.md" - #### 简易方式 --8<-- "docs/other/example2.md" > 注:不指定 `Docker CE 源` 以及 `镜像仓库源` 则会交由用户进行交互选择,届时会自动清屏 `$ clear`,从而导致你脚本的运行日志被清除 ================================================ FILE: docs/other/index.zh-Hant.md ================================================ --- hide: - navigation - footer --- # :simple-docker:{style="color: #1d63ed"} Docker 安裝與換源腳本 ## 一鍵執行命令 === "安裝" !!! quote "" === ":linuxmirrors: 官網(推薦)" ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --zh-hant ``` === ":simple-github: GitHub" ``` bash bash <(curl -sSL https://raw.githubusercontent.com/SuperManito/LinuxMirrors/main/DockerInstallation.sh) --zh-hant ``` === ":simple-gitee: Gitee 碼雲 (鏡像倉庫)" ``` bash bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/DockerInstallation.sh) --zh-hant ``` > 即時同步、無延遲,中國大陸網路環境建議使用 === ":simple-gitcode: GitCode (鏡像倉庫)" ``` bash bash <(curl -sSL https://raw.gitcode.com/SuperManito/LinuxMirrors/raw/main/DockerInstallation.sh) --zh-hant ``` > 同步存在1小時延遲 === ":simple-jsdelivr: jsDelivr (CDN)" ``` bash bash <(curl -sSL https://cdn.jsdelivr.net/gh/SuperManito/LinuxMirrors@main/DockerInstallation.sh) --zh-hant ``` === ":tencent-cloud: 騰訊雲 EO (CDN)" ``` bash bash <(curl -sSL https://edgeone.linuxmirrors.cn/docker.sh) --zh-hant ``` > 不建議在中國大陸網路環境下使用 整合安裝 [`Docker Engine`](https://docs.docker.com/engine) 和 [`Docker Compose`](https://docs.docker.com/compose),支援選擇或更換軟體源(Docker 軟體倉庫)以及映像倉庫、安裝指定版本、重裝等功能,支援 ARM 架構 腳本參考[官方文件](https://docs.docker.com/engine/install)使用系統套件管理工具進行安裝,不存在相容性、安全性等問題,可安裝的版本由 Docker CE 倉庫決定 === "僅更換鏡像加速器" !!! quote "" === ":linuxmirrors: 官網(推薦)" ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --zh-hant --only-registry ``` === ":simple-github: GitHub" ``` bash bash <(curl -sSL https://raw.githubusercontent.com/SuperManito/LinuxMirrors/main/DockerInstallation.sh) --zh-hant --only-registry ``` === ":simple-gitee: Gitee 碼雲 (映像倉庫)" ``` bash bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/DockerInstallation.sh) --zh-hant --only-registry ``` > 即時同步、無延遲,中國大陸網路環境建議使用 === ":simple-gitcode: GitCode (映像倉庫)" ``` bash bash <(curl -sSL https://raw.gitcode.com/SuperManito/LinuxMirrors/raw/main/DockerInstallation.sh) --zh-hant --only-registry ``` > 同步存在1小時延遲 === ":simple-jsdelivr: jsDelivr (CDN)" ``` bash bash <(curl -sSL https://cdn.jsdelivr.net/gh/SuperManito/LinuxMirrors@main/DockerInstallation.sh) --zh-hant --only-registry ``` === ":tencent-cloud: 騰訊雲 EO (CDN)" ``` bash bash <(curl -sSL https://edgeone.linuxmirrors.cn/docker.sh) --zh-hant --only-registry ``` > 不建議在中國大陸網路環境下使用
- :material-shimmer:{ .lg .middle } __完全取代官方安裝腳本__ --- 與 [get.docker.com](https://get.docker.com) 邏輯一致,融合了本專案換源架構以及特性 - :material-graph:{ .lg .middle } __支援衍生作業系統__ --- 相容於大量不受官方安裝腳本支援的衍生作業系統 :material-information-outline:{ title="除官網首頁展示的系統外還支援下方等特製系統
  • Kylin Server
  • Huawei Cloud EulerOS
  • TencentOS Server
  • Alibaba Cloud Linux
" } - :material-weight-lifter:{ .lg .middle } __功能強大、無與倫比__ --- 全網最實用的開源運維腳本之一,效能卓越 - :material-compass-rose:{ .lg .middle } __精妙絕倫的互動設計__ --- 易於理解和使用的互動式命令列介面,遙遙領先

✨ 經過了數年的技術沉澱與生產環境檢驗,廣受社區好評,深得開發者喜愛,大廠都在使用


!!! tip "Docker Compose 不再需要獨立安裝" Docker Compose 自 V2 版本起開始作為 Docker CLI(命令列)的一部分,腳本預設整合安裝該[插件](https://docs.docker.com/compose/install/linux),請使用 `docker compose` 指令取代 `docker-compose` !!! node "軟體源說明"
- __Docker CE 軟體倉庫 --- Docker CE 全稱 Docker Community Edition(Docker 社群版),是 Docker Engine 的別稱,該倉庫用於下載並安裝 Docker 相關軟體包 - __Docker Registry 映像倉庫__ --- 用於控制拉取鏡像的預設軟體源儲存倉庫,又稱為鏡像加速器,預設為官方容器映像倉庫 [Docker Hub](https://hub.docker.com)
由於一些不可抗力的因素,中國大陸網路環境下目前無法訪問 [Docker Hub](https://hub.docker.com) 因此無法正常拉取鏡像,建議使用下方提到的中國大陸可用映像倉庫源 註:腳本內的指定 Web 協定互動僅用於控制 `Docker CE` 軟體源,`Docker Registry` 強制使用 `HTTPS` 協定 !!! quote "預設的映像倉庫源"
中國大陸可用
| 名稱 | 位址 | 說明 | | :--: | :--: | :-- | | 毫秒鏡像 | [docker.1ms.run](https://1ms.run "docker.1ms.run") | 企業鏡像站,CDN智慧分送速度極快,支援付費定制,推薦使用 | | Docker Proxy | [dockerproxy.net](https://dockerproxy.net "dockerproxy.net") | 由 ghproxy 創建,可用性高但速度很慢,支援企業鏡像付費加速 | | DaoCloud | [docker.m.daocloud.io](https://docker.m.daocloud.io "docker.m.daocloud.io") | 老牌企業鏡像站,可用性高且速度快,現為白名單模式 | | 1Panel 鏡像 | [docker.1panel.live](https://1panel.cn "docker.1panel.live") | 企業產品自用鏡像 |
本開源專案不適合採集個人自建的鏡像加速器,如有需要可搭配命令選項自行使用
其它
| 名稱 | 位址 | 名稱 | 位址 | | :- | :-: | :- | :-: | | Alibaba Cloud (Hangzhou) | [registry.cn-hangzhou.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-hangzhou.aliyuncs.com") | Alibaba Cloud (Japan - Tokyo) | [registry.ap-northeast-1.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.ap-northeast-1.aliyuncs.com") | | Alibaba Cloud (Shanghai) | [registry.cn-shanghai.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-shanghai.aliyuncs.com") | Alibaba Cloud (Singapore) | [registry.ap-southeast-1.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.ap-southeast-1.aliyuncs.com") | | Alibaba Cloud (Qingdao) | [registry.cn-qingdao.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-qingdao.aliyuncs.com") | Alibaba Cloud (Malaysia - Kuala Lumpur) | [registry.ap-southeast-3.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.ap-southeast-3.aliyuncs.com") | | Alibaba Cloud (Beijing) | [registry.cn-beijing.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-beijing.aliyuncs.com") | Alibaba Cloud (Indonesia - Jakarta) | [registry.ap-southeast-5.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.ap-southeast-5.aliyuncs.com") | | Alibaba Cloud (Zhangjiakou) | [registry.cn-zhangjiakou.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-zhangjiakou.aliyuncs.com") | Alibaba Cloud (Germany - Frankfurt) | [registry.eu-central-1.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.eu-central-1.aliyuncs.com") | | Alibaba Cloud (Hohhot) | [registry.cn-huhehaote.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-huhehaote.aliyuncs.com") | Alibaba Cloud (UK - London) | [registry.eu-west-1.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.eu-west-1.aliyuncs.com") | | Alibaba Cloud (Ulanqab) | [registry.cn-wulanchabu.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-wulanchabu.aliyuncs.com") | Alibaba Cloud (US Western - Silicon Valley) | [registry.us-west-1.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.us-west-1.aliyuncs.com") | | Alibaba Cloud (Shenzhen) | [registry.cn-shenzhen.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-shenzhen.aliyuncs.com") | Alibaba Cloud (US Eastern - Virginia) | [registry.us-east-1.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.us-east-1.aliyuncs.com") | | Alibaba Cloud (Heyuan) | [registry.cn-heyuan.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-heyuan.aliyuncs.com") | Alibaba Cloud (United Arab Emirates - Dubai) | [registry.me-east-1.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.me-east-1.aliyuncs.com") | | Alibaba Cloud (Guangzhou) | [registry.cn-guangzhou.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-guangzhou.aliyuncs.com") | Google Cloud(North America) | [gcr.io](https://cloud.google.com/artifact-registry/docs/transition/gcr-repositories?hl=zh-cn "https://gcr.io") | | Alibaba Cloud (Chengdu) | [registry.cn-chengdu.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-chengdu.aliyuncs.com") | Google Cloud(Asia) | [asia.gcr.io](https://cloud.google.com/artifact-registry/docs/transition/gcr-repositories?hl=zh-cn "https://asia.gcr.io") | | Alibaba Cloud (Hong Kong) | [registry.cn-hongkong.aliyuncs.com](https://help.aliyun.com/zh/acr/user-guide/accelerate-the-pulls-of-docker-official-images "https://registry.cn-hongkong.aliyuncs.com") | Google Cloud(Europe) | [eu.gcr.io](https://cloud.google.com/artifact-registry/docs/transition/gcr-repositories?hl=zh-cn "https://eu.gcr.io") | | Tencent Cloud | [mirror.ccs.tencentyun.com](https://cloud.tencent.com/document/product/1207/45596 "https://mirror.ccs.tencentyun.com") | Docker Hub | [registry.hub.docker.com](https://hub.docker.com/ "registry.hub.docker.com") |
註:中國大陸雲端運算企業的映像倉庫軟體源僅針對其業務,中國大陸境內實例可能仍無法造訪 Docker Hub
## 命令選項(進階用法) ``` $ bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --zh-hant --help 命令選項(名稱/含義/值): --source 指定 Docker CE 軟體源位址(網域名稱或IP) 位址 --source-registry 指定 Docker 映像倉庫位址 (網域名稱或IP) 位址 --branch 指定 Docker CE 軟體源倉庫 (路徑) 倉庫名稱 --branch-version 指定 Docker CE 軟體源倉庫版本 版本號 --designated-version 指定 Docker Engine 安裝版本 版本號 --codename 指定 Debian 係作業系統的版本代號 代號名稱 --protocol 指定 Docker CE 源的 Web 協定 http 或 https --use-intranet-source 是否優先使用內部網路 Docker CE 軟體源位址 true 或 false --install-latest 是否安裝最新版本的 Docker Engine true 或 false --close-firewall 是否關閉防火牆 true 或 false --clean-screen 是否在運行前清除螢幕上的所有內容 true 或 false --lang 指定腳本輸出的語言 语言 --only-registry 僅更換映像倉庫模式 無 --ignore-backup-tips 忽略覆蓋備份提示 無 --pure-mode 純淨模式,精簡列印內容 無 --help 查看幫助選單 無 ``` | 名稱 | 意義 | 選項值 | | :-: | :-: | :-: | | `--source` | 指定 `Docker CE` 軟體源位址(網域名稱或IP) | `位址` | | `--source-registry` | 指定 `Docker` 映像倉庫位址(網域名稱或IP) | `位址(多個用英文逗號分割)` | | `--branch` | 指定 `Docker CE` 軟體源倉庫(路徑) | `倉庫名稱(詳見下方文件)` | | `--branch-version` | 指定 `Docker CE` 軟體源倉庫版本 | `版本號(詳見下方文件)` | | `--designated-version` | 指定 `Docker Engine` 安裝版本 | `版本號(詳見下方文件)` | | `--codename` | 指定 `Debian` 係作業系統的版本代號 | `代號名稱` | | `--protocol` | 指定 `Docker CE` 源的 Web 協定 | `http` 或 `https` | | `--use-intranet-source` | 是否優先使用內部網路 `Docker CE` 軟體源位址 | `true` 或 `false` | | `--install-latest` | 是否安裝最新版本的 `Docker Engine` | `true` 或 `false` | | `--close-firewall` | 是否關閉防火牆 | `true` 或 `false` | | `--clean-screen` | 是否在運行前清除螢幕上的所有內容 | `true` 或 `false` | | `--lang` | 指定腳本輸出的語言 | `語言ID(詳見下方文件)` | | `--only-registry` | 僅更換映像倉庫模式 | 無 | | `--ignore-backup-tips` | 忽略覆蓋備份提示(即不覆蓋備份) | 無 | | `--pure-mode` | 純淨模式,精簡列印內容 | 無 | | `--help` | 查看幫助選單 | 無 | > 軟體源完整格式 `://<軟體源位址(網域名稱或IP)>/<軟體源倉庫(路徑)>` - ### 指定映像倉庫位址 ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --zh-hant --source-registry registry.example.com ``` 可同時指定多個地址,需使用英文逗號分割 ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --zh-hant \ --source-registry "registry-1.example.com,registry-2.example.com" ``` - ### 僅更換映像倉庫 === "使用腳本一鍵替換" 僅更換鏡像加速器,當偵測到未安裝 Docker 時會報錯跳出 ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --zh-hant --only-registry ``` 懶人一鍵指令(使用多個位址) ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --zh-hant \ --only-registry \ --source-registry "docker.1ms.run,docker.1panel.live,docker.m.daocloud.io" ``` > 選項值可以指定多個位址,需使用英文逗號分割 === "手動替換" - 安裝 `jq` 軟體包 === "Debian 系 / openKylin" ``` bash apt-get install -y jq ``` > `Debian`   `Ubuntu`   `Kali`   `Linux Mint`   `Deepin`   `Zorin OS`   `Armbian`   `Proxmox VE`   `Raspberry Pi OS`   `openKylin` 新裝系統需要先執行一次更新 `apt-get update` === "RedHat 系 / openEuler / OpenCloudOS / Anolis OS" ``` bash dnf install -y jq || yum install -y jq ``` > `Red Hat Enterprise Linux`   `CentOS`   `Rocky Linux`   `AlmaLinux`   `Fedora`   `openEuler`   `OpenCloudOS`   `Anolis OS` - 指定映像倉庫位址 > 請手動替換 `` 為映像倉庫位址後在執行,詳見上方 “專案內置的映像倉庫源” 表格中的位址列 ``` bash SOURCE_REGISTRY='"https://"' ``` 也可以指定多個映像倉庫,如 `SOURCE_REGISTRY='"https://example.registry.com","https://test.registry.com"'`,注意用英文逗號分割 - 替換映像倉庫位址 ``` bash [ -s "/etc/docker/daemon.json" ] || echo "{}" >/etc/docker/daemon.json jq '.["registry-mirrors"] = ['"${SOURCE_REGISTRY}"']' /etc/docker/daemon.json >/etc/docker/daemon.json.tmp && mv /etc/docker/daemon.json.tmp ``` - 重新啟動 Docker 服務 ``` bash systemctl daemon-reload [[ $(systemctl is-active docker) == "active" ]] && systemctl restart docker || systemctl enable --now docker ``` - ### 指定 `Docker CE` 軟體源位址 ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --zh-hant --source mirror.example.com/docker-ce ``` > 注意該位址路徑需要包含映像站的 Docker CE 軟體源倉庫路徑即 `docker-ce` - ### 指定 Docker CE 軟體源倉庫 腳本預設會自動判斷一般無需指定,除非你有特殊需求 ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --zh-hant --branch centos ``` > 倉庫名稱是固定的,目前只有 [`centos`](https://download.docker.com/linux/centos/) [`debian`](https://download.docker.com/linux/debian/) [`fedora`](https://download.docker.com/linux/fedora/) [`raspbian`](https://download.docker.com/linux/raspbian/) [`rhel`](https://download.docker.com/linux/rhel/) [`sles`](https://download.docker.com/linux/sles/) [`static`](https://download.docker.com/linux/static/) [`ubuntu`](https://download.docker.com/linux/ubuntu/) 這幾個 > 詳情請見 [官方安裝文件](https://docs.docker.com/engine/install) 及 [Docker CE 官方倉庫](https://download.docker.com/linux) ``` { .bash .no-copy title="还可以指定倉庫版本號" } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --zh-hant \ --branch centos \ --branch-version 9 ``` > 可以使用此選項來控制安裝軟體套件的相容性(僅適用於紅帽係作業系統),具體詳見對應倉庫目錄中代表版本號的路徑名稱(正整數)。 - ### 指定 Docker Engine 安裝版本 指定安裝版本時會忽略 `是否安裝最新版本` 的命令選項,格式為 `主版.次版本.補丁版本`,例如 `28.4.1`。 ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --zh-hant --designated-version 28.0.0 ``` > 如果指定的版本不存在或不支援當前作業系統,屆時腳本會報錯跳出 ??? quote "查看版本清單的方法" === "Debian 系" ``` bash apt-cache madison docker-ce | awk '{print $3}' | grep -Eo "[0-9][0-9].[0-9]{1,2}.[0-9]{1,2}" | sort -t '.' -k1,1nr -k2,2nr -k3,3nr ``` > `Debian`   `Ubuntu`   `Kali`   `Linux Mint`   `Deepin`   `Zorin OS`   `Armbian`   `Proxmox VE`   `Raspberry Pi OS` === "RedHat 系 / openEuler / OpenCloudOS / Anolis OS" ``` bash dnf list docker-ce --showduplicates | sort -r | awk '{print $2}' | grep -Eo "[0-9][0-9].[0-9]{1,2}.[0-9]{1,2}" | sort -t '.' -k1,1nr -k2,2nr -k3,3nr ``` > `Red Hat Enterprise Linux`   `CentOS`   `Rocky Linux`   `AlmaLinux`   `Fedora`   `openEuler`   `OpenCloudOS`   `Anolis OS` 未出現在該清單中的版本則不支援透過本腳本安裝,如果取得不到版本清單說明你目前的系統環境還沒有正確配置 Docker CE 軟體軟體源(執行腳本時不存在該問題) - ### 國際化(I18n) 腳本提供多語言支持,目前內建 `简体中文`、`繁體中文`、`English` 共三種顯示語言,預設為 `简体中文` - #### 指定語言 ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --lang xxx ``` | 類型 | 值 | | :-: | :-: | | 简体中文 | `zh-hans` `zh-cn` `zh` | | 繁體中文 | `zh-hant` `zh-tw` `zh-hk` | | English | `en` `en-us` | 也可以直接作為指令選項使用 ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --en ``` > `--en` `--en-us` `--zh` `--zh-cn` `--zh-hans` `--zh-hant` - #### 透過互動進行選擇 ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --lang auto ``` - ### 無人值守(自動化) 不透過交互完成安裝操作,至少需要使用以下命令選項來實現,建議熟悉後再使用 ``` { .bash .no-copy title="参考命令" } bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --zh-hant \ --source mirror.example.com/docker-ce \ --source-registry registry.hub.docker.com \ --protocol http \ --use-intranet-source false \ --install-latest true \ --close-firewall true \ --ignore-backup-tips ``` > 如果報錯 `命令選項無效` 那麼請檢查選項合法性以及空格字元編碼,在範例中一行寫一個選項是為了提高命令的可讀性 - ### 純淨模式 推出此功能是為了方便開發以及运维人員使用,啟用後會精簡腳本內容輸出,建議搭配其它指令選項無互動使用 ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker.sh) --zh-hant --pure-mode ``` !!! tip "滾動輸出的命令日誌可能有無法預料的顯示問題,不過目前暫未發現異常" ## 常見問題 - #### 關於服務報錯無法啟動 !!! quote "" 非新裝環境可能會在執行腳本後遇到 `Docker` 服務無法啟動的情況,建議重新安裝來解決,卸載不會刪除本機映像和容器資料 卸載指令如下: === "Debian 系" ``` bash apt-get remove -y docker* containerd.io runc && apt-get autoremove ``` > `Debian`   `Ubuntu`   `Kali`   `Linux Mint`   `Deepin`   `Zorin OS`   `Armbian`   `Proxmox VE`   `Raspberry Pi OS` === "RedHat 系 / openEuler / OpenCloudOS / Anolis OS" ``` bash yum remove -y docker* containerd.io podman* runc ``` > `Red Hat Enterprise Linux`   `CentOS`   `Rocky Linux`   `AlmaLinux`   `Fedora`   `openEuler`   `OpenCloudOS`   `Anolis OS` 卸載完成後重新執行腳本安裝即可 - #### 關於不支援的作業系統 如果提示不支援那麼請使用系統自備的套件管理工具進行安裝。因為這些軟體包由 Linux 發行版的軟體包維護者建構和維護,可能存在配置差異或由修改後的原始碼建構。 也可以使用   [![Docker Desktop](../assets/images/icon/custom/docker-desktop.svg){ width="140" style="vertical-align: -0.2rem" }](https://www.docker.com/products/docker-desktop) ## 精簡版(Lite) 額外提供一個精簡版本,是主腳本的複製,面向企業產品、開源專案使用,具有以下特性: - 單一顯示語言 `English`,無 I18n 國際化功能 - 預設使用官方來源,去除了互動選擇內建軟體源功能 - 去除了無關的列印內容 - 保留核心邏輯與指令選項設計 ``` bash bash <(curl -sSL https://linuxmirrors.cn/docker-lite.sh) ``` > 請熟悉本項目後再使用,不建議新手使用者使用 - ## 最佳實踐 ??? note "適用於企業產品部署以及 CI/CD 等自動化維運場景的程式碼範例(展開檢視)" 如果你不想讓用戶進行任何交互,請使用 `完全自動化` 範例 - #### 完全自動化(建議) --8<-- "docs/other/example1.md" - #### 簡易方式 --8<-- "docs/other/example2.md" > 註:不指定 `Docker CE 源` 以及 `映像倉庫源` 則會交由使用者進行互動選擇,屆時會自動清屏 `$ clear`,從而導致你腳本的運行日誌被清除 ================================================ FILE: docs/other/sitemap.en.xml ================================================ ================================================ FILE: docs/other/sitemap.xml ================================================ ================================================ FILE: docs/other/sitemap.zh-Hant.xml ================================================ ================================================ FILE: docs/sitemap.en.xml ================================================ ================================================ FILE: docs/sitemap.xml ================================================ ================================================ FILE: docs/sitemap.zh-Hant.xml ================================================ ================================================ FILE: docs/sponsor/index.en.md ================================================ --- hide: - navigation - toc - footer --- --8<-- "docs/sponsor/main.html" #
Become a Sponsor

Please go to the author's afdian homepage to view instructions and contact the author

================================================ FILE: docs/sponsor/index.md ================================================ --- hide: - navigation - toc - footer --- --8<-- "docs/sponsor/main.html" #
成为赞助商

请前往作者爱发电主页查看说明并与作者取得联系

================================================ FILE: docs/sponsor/index.zh-Hant.md ================================================ --- hide: - navigation - toc - feedback - footer --- --8<-- "docs/sponsor/main.html" #
成為贊助商

請前往作者愛發電主頁查看說明並與作者取得聯繫

================================================ FILE: docs/sponsor/main.html ================================================ ================================================ FILE: docs/sponsor/sitemap.en.xml ================================================ ================================================ FILE: docs/sponsor/sitemap.xml ================================================ ================================================ FILE: docs/sponsor/sitemap.zh-Hant.xml ================================================ ================================================ FILE: docs/stylesheets/extra.css ================================================ :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-code-font: 'SF Mono', Meslo, 'Monaspace Neon', 'JetBrains Mono', Consolas, monospace; --md-primary-fg-color--light: hsl(0, 0%, 100%, 0.33); --md-default-bg-color--light: #fff; --view-transition-z-index-foreground: 999; --view-transition-z-index-background: 1; --hero-background-image: linear-gradient(90deg, rgb(104 104 104) 50%, rgb(104 104 104) 50%); --navbar-background: hsla(240, 9%, 75%, 0.33); --component-border-radius: 8px; --td-radius-default: 5px; --component-hover-color: rgba(0, 0, 0, 0.05); } [data-md-color-scheme='slate'] { --md-default-bg-color: rgb(18, 18, 18); --md-code-bg-color: hsla(var(--md-hue), 5%, 12%, 1); --md-code-bg-color--lighter: hsla(var(--md-hue), 5%, 12%, 1); --md-code-bg-color--light: hsla(var(--md-hue), 5%, 12%, 1); --md-footer-bg-color--dark: hsla(var(--md-hue), 5%, 12%, 1); --navbar-background: hsla(var(--md-hue), 5%, 19%, 0.33); --hero-background-image: linear-gradient(90deg, rgb(88 88 88) 50%, rgb(88 88 88) 50%); --component-hover-color: rgba(240, 241, 244, 0.05); } [data-md-color-primary=white] { --md-typeset-a-color: #1677ff; --md-accent-fg-color: #0059ff; --md-accent-fg-color--transparent: #52a1fc1a; } [data-md-color-scheme='slate'][data-md-color-primary=black] { --md-typeset-a-color: #5b84f5; --md-accent-fg-color: #3a75f5; --md-accent-fg-color--transparent: #4172f71a; } /* logo */ [data-md-color-scheme="default"] .md-logo img { content: url(/assets/images/brand/svg/logo-light.svg); } [data-md-color-scheme="slate"] .md-logo img { content: url(/assets/images/brand/svg/logo-dark.svg); } /* 字体 */ @font-face { font-family: 'SF Mono'; src: url('./fonts/SF-Mono-Regular.otf'); } /* 告诫 */ .md-typeset .admonition, .md-typeset details { border-radius: var(--component-border-radius) !important; border-width: 0; border-left-width: 4px; } .md-typeset .admonition.quote, .md-typeset details.quote { border-width: .075rem !important; border-color: var(--md-default-fg-color--lightest) !important; } [data-md-color-scheme='slate'] .md-typeset .quote>.admonition-title, .md-typeset .quote>summary { background-color: #6f6f6f1a !important; } [data-md-color-scheme='slate'] .md-typeset .admonition, [data-md-color-scheme='slate'] .md-typeset details { box-shadow: var(--md-shadow-z2) !important; } [data-md-color-scheme='slate'] .md-typeset .admonition.quote, [data-md-color-scheme='slate'] .md-typeset details.quote { border-color: var(--md-default-fg-color--lightest) !important; } .md-typeset .admonition.tip, .md-typeset details.tip { border-color: #03b803; } .md-typeset .tip>.admonition-title:before, .md-typeset .tip>summary:before { background-color: #03b803; } .md-typeset .tip>.admonition-title, .md-typeset .tip>summary { background-color: #0094001a; } .md-typeset .admonition .admonition-title, .md-typeset details:not([open])>summary { border-radius: 0 var(--component-border-radius) var(--component-border-radius) 0 !important; } .md-typeset details>summary { border-radius: 0 var(--component-border-radius) 0 0 !important; } .md-typeset .admonition.tip:focus-within, .md-typeset details.tip:focus-within { box-shadow: 0 0 0 .2rem #0094000a; } [data-md-color-scheme="slate"] .md-typeset .admonition.quote, .md-typeset details.quote { border-color: hsla(225deg, 15%, 90%, 0.24); } /* 着陆页 */ .home-cmd pre>code { padding-right: 3em; } .home-cmd .tabbed-block { position: relative; } .home-cmd .md-clipboard { position: absolute; top: auto; bottom: 20px; right: 12px; z-index: 3; } .home-cmd img { width: 560px; box-shadow: var(--md-shadow-z2); border-radius: 8px; } @media screen and (max-width: 768px) { .home-cmd .md-clipboard { bottom: 8px; right: 6px; } } .home-table { .md-typeset__scrollwrap { margin: 0 !important; } .md-typeset__table { padding: 0 !important; margin-bottom: 0 !important; table:not([class]) td { padding: .8375em 1.25em !important; } } } @media screen and (max-width: 768px) { .home-table { .md-typeset__scrollwrap { margin: 1em 0 !important; } } } /* 主题覆盖 */ .no-select img { user-select: none; -webkit-user-select: none; -webkit-user-drag: none; } .md-header { background-color: var(--navbar-background) !important; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); } .md-header__topic { user-select: none; -webkit-user-select: none; } .md-tabs { background-color: var(--navbar-background) !important; } .md-banner { color: var(--md-default-fg-color--light); background-color: hsla(240, 9%, 75%, 0.53); } [data-md-color-scheme='slate'] .md-banner { background-color: hsla(var(--md-hue), 15%, 9%, 0.83); } .admonition .tabbed-set { overflow: hidden !important; margin: 0 0 0.4em 0 !important; } .admonition details { margin-top: 0.4em !important; } .md-typeset details .tabbed-set { margin: 0 0 0.4em 0 !important; } .highlight code { border-radius: var(--component-border-radius) !important; } .highlight span.filename+pre>code { border-top-left-radius: 0 !important; border-top-right-radius: 0 !important; } .highlight span.filename { border-radius: var(--component-border-radius) var(--component-border-radius) 0 0 !important; background-color: var(--md-default-bg-color) !important; border-top: var(--md-default-fg-color--lightest) 1px solid !important; border-left: var(--md-default-fg-color--lightest) 1px solid !important; border-right: var(--md-default-fg-color--lightest) 1px solid !important; border-bottom: none !important; } .md-typeset .md-button { border-radius: 6px !important; } .md-tabs__link { font-size: 0.8rem !important; font-weight: 600 !important; } .md-typeset { font-size: 16px; } .md-typeset .emojione, .md-typeset .gemoji, .md-typeset .twemoji { height: 100%; vertical-align: -0.2em !important; } .md-typeset .middle { vertical-align: -0.35em !important; } .md-select__inner { border-radius: var(--component-border-radius); } [data-md-color-scheme='slate'] .md-select__inner { background-color: rgb(22, 22, 22) !important; } .md-select__inner .md-select__list { padding: 6px !important; font-size: .75rem !important; border-radius: var(--component-border-radius) !important; } .md-select__inner .md-select__list .md-select__item { margin: 1px; border-radius: var(--component-border-radius) !important; transition: background-color 0.2s; } .md-select__inner .md-select__list .md-select__item .md-select__link { padding-left: 12px !important; padding-right: 12px !important; } .md-select__inner .md-select__list .md-select__item:hover { background-color: var(--component-hover-color); } .md-header__button>*:first-child, .md-header__button svg { height: 24px !important; width: 24px !important; } @media screen and (min-width: 768px) { .md-header__button { border-radius: 6px; padding: 6px !important; transition: background-color 0.2s ease-in-out !important; } .md-header__button.md-logo { margin-left: .4rem !important; -webkit-user-drag: none; } .md-header__button>*:first-child, .md-header__button svg { height: 28px !important; width: 28px !important; } .md-header__button:hover { opacity: 1 !important; background-color: hsla(var(--md-hue), 0%, 0%, .07) !important; } [data-md-color-scheme='slate'] .md-header__button:hover { background-color: rgba(240, 241, 244, 0.1) !important; } .md-source__repository { border-radius: 6px !important; padding: 4px 8px 4px 48px !important; transition: all 0.2s ease-in-out !important; } .md-source__icon+.md-source__repository { height: 100%; } .md-source__repository--active:hover { background-color: hsla(var(--md-hue), 0%, 0%, .07) !important; } .md-source:hover { opacity: 1 !important; } [data-md-color-scheme='slate'] .md-source__repository--active:hover { background-color: rgba(240, 241, 244, 0.1) !important; } } .palette-icon svg { width: 26px; height: 26px; } @media screen and (max-width: 768px) { .palette-icon svg { width: 24px; height: 24px; } } .md-typeset__table .twemoji svg { fill: var(--md-default-fg-color--light) !important; } .md-tooltip, .md-tooltip2__inner { border-radius: 5px !important; } .tabbed-labels a { position: relative; transition: color 0ms !important; } .tabbed-labels a::before { content: ''; position: absolute; top: 50%; left: 50%; width: 0; height: 0; background-color: var(--component-hover-color); border-radius: 5px; transform: translate(-50%, -50%); z-index: 1; } .tabbed-button { z-index: 2; } .tabbed-labels a:hover::before { width: 100%; height: calc(100% - 8px); } .tabbed-content { padding-top: 0.4em !important; } .tabbed-content .admonition { margin: 1em 0 !important; } .md-typeset table, .md-typeset pre>code, .md-typeset .grid.cards>ul>li { border-radius: var(--component-border-radius) !important; } .md-typeset code { border-radius: 4px !important; } /* HERO */ .hero { width: 390px; max-width: 100vw; height: 160px; position: absolute; margin: 0 auto; } .hero-background { top: 50%; width: 50%; height: 80px; position: absolute; background-image: var(--hero-background-image); filter: blur(68px); transform: translate(-50%, -50%); } @media screen and (max-width: 768px) { .hero { width: calc(100% - .8rem - 40px); } } /* 赞助组件 */ .sponsor { padding-top: 1rem; margin-top: 0; border-top: none; } .sponsor-title { font-size: 1.2rem; font-weight: 550; font-feature-settings: "kern", "liga"; color: #444; font-family: var(--md-text-font-family); } [data-md-color-scheme="slate"] .sponsor-title { color: #ddd; } .sponsor-title-toc { font-weight: 550; font-feature-settings: "kern", "liga"; color: hsl(225deg 0% 46.48% / 56%); font-family: var(--md-text-font-family); } [data-md-color-scheme="slate"] .sponsor-title-toc { color: hsl(225deg 5.64% 68.32% / 56%); } .sponsor-toc { margin-top: 24px !important; border-top: 1px solid var(--md-default-fg-color--lightest) !important; } .sponsor .sponsor-label { font-size: 0.8rem; text-align: center; margin-bottom: 0.2rem; color: var(--md-default-fg-color); } .sponsor .sponsor-wrapper { width: 100%; padding: 0.5rem 0; } .sponsor .sponsor-item { display: flex; align-items: center; justify-content: center; width: 100%; text-align: center; padding: .75rem; border-radius: var(--component-border-radius); height: 80px; max-height: 80px; transition: background-color 0.2s; } .sponsor .sponsor-item:hover { background-color: var(--component-hover-color); } .sponsor .sponsor-item img { max-width: 100%; height: auto; vertical-align: middle; transition: filter 0.1s ease-in-out; } .sponsor-item-toc { margin: 0; padding: 14px !important; height: 56px !important; max-height: 56px !important; border-radius: 6px !important; box-sizing: border-box; flex: 0 0 calc(50% - 2px) !important; background-color: #f9f9f9; } [data-md-color-scheme="slate"] .sponsor-item-toc { background-color: rgb(22, 22, 22); } .sponsor-item-toc:hover { background-color: rgba(0, 0, 0, 0.08) !important; } [data-md-color-scheme="slate"] .sponsor-item-toc:hover { background-color: rgba(240, 241, 244, 0.1) !important; } .sponsor-item-toc-full-row { flex: 0 0 100% !important; } .sponsor-item-toc-full-row img { width: 50% !important; } .sponsor-item-toc img { width: 100%; object-fit: contain; filter: grayscale(1) invert(0.6); opacity: 0.7; vertical-align: middle; } [data-md-color-scheme="slate"] .sponsor-item-toc img { filter: brightness(1.3) grayscale(1); opacity: 0.75; vertical-align: middle; } .sponsor-item-toc:hover img { filter: grayscale(0%) !important; opacity: 1; } .sponsor-flex-wrapper { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; } .sponsor-flex-wrapper-toc { display: flex !important; flex-direction: row !important; flex-wrap: wrap !important; gap: 4px !important; padding: 0; width: 100%; } .sponsor-item-flex { flex: 0 1 calc(20% - 1rem); min-width: 200px; max-width: 300px; } .sponsor-item-flex img { width: 60% !important; } @media screen and (max-width: 480px) { .sponsor .sponsor-label { font-size: 1rem; } .sponsor-flex-wrapper { gap: 28px; } .sponsor-title { font-size: .8rem; } .sponsor .sponsor-item { height: 40px; padding: 2px; } .sponsor-toc { display: none; } .sponsor-item-flex { min-width: 100px; max-width: calc(33.33% - 1rem); } .sponsor-item-flex img { transform: scale(1.4); } } .icon-brand-section { margin-top: 0; text-align: center; } .icon-brand-container { display: flex; justify-content: flex-start; align-items: center; flex-wrap: wrap; gap: 2px; max-width: 100%; width: fit-content; border-radius: 6px; } .icon-brand-button { display: inline-flex; align-items: center; justify-content: center; height: 24px; padding: 0 4px; background-color: var(--md-default-bg-color); border: 1px solid transparent; border-radius: 6px; text-decoration: none; box-sizing: border-box; min-width: 60px; max-width: 80px; transition: all 0.15s ease !important; } .icon-brand-button:hover { background-color: var(--md-accent-fg-color--transparent); border-color: var(--md-accent-fg-color); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); } [data-md-color-scheme="slate"] .icon-brand-button:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); } .icon-brand-button img { max-width: 100%; max-height: 18px; object-fit: contain; vertical-align: middle; } @media screen and (max-width: 768px) { .icon-brand-container { gap: 0.75rem; } .icon-brand-button { padding: 0 8px; min-width: 60px; } .icon-brand-button img { max-height: 16px; } } @media screen and (max-width: 480px) { .icon-brand-container { gap: 0.5rem; justify-content: center; } .icon-brand-button { height: 28px; padding: 0 6px; min-width: 50px; } .icon-brand-button img { max-height: 14px; } } /* 图标动画 */ .heart { animation: heart 1000ms infinite; } @keyframes heart { 0%, 40%, 80%, 100% { transform: scale(1); } 20%, 60% { transform: scale(1.15); } } /* TDesign 组件相关 */ .t-tag .t-icon { margin-right: 0 !important; } .t-table { --td-bg-color-container: var(--md-default-bg-color) !important; } .t-table th, .t-table thead td { color: var(--md-default-fg-color); } .t-tag.t-size-l { height: var(--td-comp-size-xs); padding: 0 var(--td-comp-paddingLR-s); } .t-tag-input .t-input.t-size-l { min-height: var(--td-comp-size-m); padding: 0 var(--td-comp-paddingLR-s) 0 var(--td-comp-margin-xs); } .t-table--hoverable tbody tr:hover { background-color: rgba(0, 0, 0, 0.016) !important; } .t-table--column-fixed .t-table__cell--fixed-left { z-index: 3; background-color: var(--md-default-bg-color); } .t-table__filter-icon-wrap { color: var(--md-default-fg-color--light); } .t-table__filter-pop .t-table__filter-pop-content .t-table__filter-pop-content-inner { padding: 6px var(--td-comp-paddingLR-l); } [theme-mode="dark"] .t-table { --td-component-border: hsla(225deg, 15%, 95%, 0.12) !important; } [theme-mode="dark"] .t-tag { --td-warning-color-light: #cf6e2d48 !important; } [theme-mode="dark"] .t-table--hoverable tbody tr:hover { background-color: rgba(240, 241, 244, 0.016) !important; } /* termynal 插件 */ .termy { padding: 65px 25px 35px !important; border-radius: var(--component-border-radius) !important; } [data-termynal] { color: #000 !important; background: var(--md-code-bg-color) !important; box-shadow: var(--md-shadow-z2); font-size: 14px !important; } [data-md-color-scheme="slate"] [data-termynal] { color: #eeeeee !important; } button[data-terminal-control] { color: var(--md-typeset-a-color) !important; } [data-termynal]:after { color: #585858 !important; } [data-md-color-scheme="slate"] [data-termynal]:after { color: #a2a2a2 !important; } /* 切换主题动画 */ ::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; } .dark::view-transition-old(root) { z-index: var(--view-transition-z-index-foreground); } .dark::view-transition-new(root) { z-index: var(--view-transition-z-index-background); } ::view-transition-old(root) { z-index: var(--view-transition-z-index-background) } ::view-transition-new(root) { z-index: var(--view-transition-z-index-foreground); } ================================================ FILE: docs/theme/main.html ================================================ {% extends "base.html" %} {% block scripts %} {{ super() }} {% endblock %} {% block announce %} {{ 'If you think this project is good and helpful to you, please click the Star in the upper right corner of the repository and share it with more friends.' if i18n_page_locale == 'en' else '如果您覺得這個專案不錯對您有幫助的話,請點擊倉庫右上角的 Star 並分享給更多的朋友' if i18n_page_locale == 'zh-Hant' else '如果觉得这个项目不错对您有所帮助的话,请点击仓库右上角的 Star 并分享给更多的朋友' }}    {% endblock %} ================================================ FILE: docs/theme/partials/comments.html ================================================ {% if page.meta.comments %}

{{ lang.t("meta.comments") }}

{% if page.meta.comments_description %}
{{ page.meta.comments_description }}
{% endif %} {% endif %} ================================================ FILE: docs/theme/partials/content.html ================================================ {% include "partials/tags.html" %} {% include "partials/actions.html" %} {% if "\u003ch1" not in page.content %}

{{ page.title | d(config.site_name, true)}}

{% endif %} {{ page.content }} {% include "partials/source-file.html" %} {% include "partials/feedback.html" %} {% include "partials/comments.html" %} ================================================ FILE: docs/theme/partials/copyright.html ================================================ ================================================ FILE: docs/theme/partials/header.html ================================================ {% set class = "md-header" %} {% if "navigation.tabs.sticky" in features %} {% set class = class ~ " md-header--shadow md-header--lifted" %} {% elif "navigation.tabs" not in features %} {% set class = class ~ " md-header--shadow" %} {% endif %}
{% if "navigation.tabs.sticky" in features %} {% if "navigation.tabs" in features %} {% include "partials/tabs.html" %} {% endif %} {% endif %}
================================================ FILE: docs/theme/partials/palette.html ================================================
{% for option in config.theme.palette %} {% set scheme = option.scheme | d("default", true) %} {% set primary = option.primary | d("indigo", true) %} {% set accent = option.accent | d("indigo", true) %} {% if option.toggle %} {% endif %} {% endfor %}
================================================ FILE: docs/theme/partials/search.html ================================================
================================================ FILE: docs/theme/partials/toc.html ================================================ ================================================ FILE: docs/use/index.en.md ================================================ --- hide: - navigation - footer --- ## One-Click Command === ":material-home-city: Chinese mainland" !!! quote "" === ":linuxmirrors: Official Site (Recommended)" ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --en ``` === ":simple-github: GitHub" ``` bash bash <(curl -sSL https://raw.githubusercontent.com/SuperManito/LinuxMirrors/main/ChangeMirrors.sh) --en ``` === ":simple-gitee: Gitee" ``` bash bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) --en ``` > Real-time sync, no delay. Recommended for use in Chinese mainland network environments. === ":simple-gitcode: GitCode" ``` bash bash <(curl -sSL https://raw.gitcode.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) --en ``` > 1-hour sync delay. === ":simple-jsdelivr: jsDelivr (CDN)" ``` bash bash <(curl -sSL https://cdn.jsdelivr.net/gh/SuperManito/LinuxMirrors@main/ChangeMirrors.sh) --en ``` === ":tencent-cloud: Tencent Cloud EO (CDN)" ``` bash bash <(curl -sSL https://edgeone.linuxmirrors.cn/main.sh) --en ``` > Not recommended in Chinese mainland network environments. === ":material-earth: International Regions" !!! quote "" === ":linuxmirrors: Official Site (Recommended)" ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --en --abroad ``` === ":simple-github: GitHub" ``` bash bash <(curl -sSL https://raw.githubusercontent.com/SuperManito/LinuxMirrors/main/ChangeMirrors.sh) --en --abroad ``` === ":simple-gitee: Gitee" ``` bash bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) --en --abroad ``` > Real-time sync, no delay. Recommended for use in Chinese mainland network environments. === ":simple-gitcode: GitCode" ``` bash bash <(curl -sSL https://raw.gitcode.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) --en --abroad ``` > 1-hour sync delay. === ":simple-jsdelivr: jsDelivr (CDN)" ``` bash bash <(curl -sSL https://cdn.jsdelivr.net/gh/SuperManito/LinuxMirrors@main/ChangeMirrors.sh) --en --abroad ``` === ":tencent-cloud: Tencent Cloud EO (CDN)" ``` bash bash <(curl -sSL https://edgeone.linuxmirrors.cn/main.sh) --abroad ``` > Not recommended in Chinese mainland network environments. === ":material-library: China Education Network" !!! quote "" === ":linuxmirrors: Official Site (Recommended)" ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --en --edu ``` === ":simple-github: GitHub" ``` bash bash <(curl -sSL https://raw.githubusercontent.com/SuperManito/LinuxMirrors/main/ChangeMirrors.sh) --en --edu ``` === ":simple-gitee: Gitee" ``` bash bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) --en --edu ``` > Real-time sync, no delay. Recommended for use in Chinese mainland network environments. === ":simple-gitcode: GitCode" ``` bash bash <(curl -sSL https://raw.gitcode.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) --en --edu ``` > 1-hour sync delay. === ":simple-jsdelivr: jsDelivr (CDN)" ``` bash bash <(curl -sSL https://cdn.jsdelivr.net/gh/SuperManito/LinuxMirrors@main/ChangeMirrors.sh) --en --edu ``` === ":tencent-cloud: Tencent Cloud EO (CDN)" ``` bash bash <(curl -sSL https://edgeone.linuxmirrors.cn/main.sh) --en --edu ``` > Not recommended in Chinese mainland network environments. !!! tip "Usage Help" The tabs represent the built-in mirror site types and script sources. Please check whether your target mirror site supports your operating system before use. You can check in the [Mirror List](../mirrors/index.md). By default, the original mirror configuration will be automatically backed up. For more details, see the documentation below. If you are confused by some options during use, just press Enter all the way after selecting the mirror, which is the best practice. _It supports use in abnormal environments such as when the original system software source is damaged, missing, or invalid. There is no need to install any additional dependencies._ !!! quote "About Mirror Selection (Must Read for New Users)" If you are not familiar with these mirrors, it is recommended to use `Aliyun (high compatibility, strong availability)` or `USTC (fast speed)`. Don't worry about speed tests, the built-in mirrors generally do not differ much. This project script is an automated operation and maintenance tool. It does not subjectively rank or customize mirrors. User choice should be free, which is also to better continue the spirit of open source software.
- :material-numeric-1:{style="color: #5b84f5" .lg} __`ROOT` privileges required__ --- Please run this script using the `root` account, switching between the `sudo -i` and `su root` commands, as the commands vary depending on the system. Also, avoid directly running one-click commands such as `sudo bash <(xxx)` using `sudo`. - :material-numeric-2:{style="color: #5b84f5" .lg} __It is recommended to use a modern `SSH` client__ --- The system's GUI graphical interface terminal application may experience some unpredictable display issues. Some systems will automatically enable the SSH service; otherwise, please refer to [how to enable SSH](#how-to-enable-ssh-remote-login). - :material-numeric-3:{style="color: #5b84f5" .lg} __If running the script for the first time on a new system__ --- The script relies on `curl` to fetch content, but some systems do not preinstall this package, resulting in `Command not found` errors. See [_About Command not found_](#about-command-not-found-error) below for installation. The script itself is unrelated to `curl` or `wget` and does not download any content. - :material-numeric-4:{style="color: #5b84f5" .lg} __Interactive configuration is required during script execution__ --- Use arrow keys ++arrow-up++++arrow-down++++arrow-left++++arrow-right++ or ++w++++a++++s++++d++ to control options and press ++enter++ to confirm. If interaction is abnormal, try resizing the terminal window and avoid full screen.
### FAQ - #### About Command not found error !!! quote "" This error is caused by the system not having the `curl` package installed. Install it as follows: === "Debian-based / openKylin" ``` bash apt-get install -y curl ``` > `Debian`   `Ubuntu`   `Kali`   `Linux Mint`   `Deepin`   `Zorin OS`   `Armbian`   `Proxmox VE`   `Raspberry Pi OS`   `openKylin` For new systems, run `apt-get update` first. === "RedHat-based / openEuler / OpenCloudOS / Anolis OS" ``` bash dnf install -y curl || yum install -y curl ``` > `Red Hat Enterprise Linux`   `CentOS`   `Rocky Linux`   `AlmaLinux`   `Fedora`   `openEuler`   `OpenCloudOS`   `Anolis OS` === "openSUSE" ``` bash zypper install curl ``` === "Arch Linux / Manjaro" ``` bash pacman -S curl ``` === "Alpine Linux" ``` bash apk --no-cache add -f curl bash ncurses ``` === "Gentoo" ``` bash emerge --ask curl ``` === "NixOS" ``` bash nix-env -iA nixos.curl ``` ??? question "Can't install? (Click to see more solutions)" If your system's original mirror is invalid and you can't install `curl`, here are some emergency ways to fetch the script online: === "Download with Python" Works for most systems (except `Alpine Linux`). If `python3` is missing, try `python`. ``` bash python3 -c "import urllib.request; urllib.request.urlretrieve('https://linuxmirrors.cn/main.sh', 'main.sh')" ``` === "Download with wget" Usually, systems without `curl` also lack `wget`, so this may not work. ``` bash wget https://linuxmirrors.cn/main.sh ``` === "Download with browser" If you have GUI access, open the link in a browser to download the script. Many systems preinstall Firefox. Then run the script: === ":material-home-city: Chinese mainland" ``` bash bash main.sh --en ``` === ":material-earth: International Regions" ``` bash bash main.sh --en --abroad ``` === ":material-library: China Education Network" ``` bash bash main.sh --en --edu ``` If none of these work, copy the [source code](https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) to a new `.sh` file and run it with `bash`. - #### Backup of original mirrors !!! quote "" The script automatically backs up the original mirror configuration. The backup path is the original file or directory with `.bak` appended, e.g., `/etc/apt/sources.list => /etc/apt/sources.list.bak`. If a backup exists, you will be prompted whether to overwrite it. - #### Restore backed up mirrors ??? quote "Click to expand and view" === "Debian-based / openKylin" === "Traditional format" ``` bash cp -rf /etc/apt/sources.list.bak /etc/apt/sources.list apt-get update ``` === "DEB822 format" ``` bash system_name="$(lsb_release -is | tr '[:upper:]' '[:lower:]')" cp -rf "/etc/apt/sources.list.d/${system_name}.sources.bak" "/etc/apt/sources.list.d/${system_name}.sources" apt-get update ``` > `Debian`   `Ubuntu`   `Kali`   `Linux Mint`   `Deepin`   `Zorin OS`   `Armbian`   `Proxmox VE`   `Raspberry Pi OS`   `openKylin` === "RedHat-based / openEuler / OpenCloudOS / Anolis OS" ``` bash cp -rf /etc/yum.repos.d.bak /etc/yum.repos.d yum makecache ``` > `Red Hat Enterprise Linux`   `CentOS`   `Rocky Linux`   `AlmaLinux`   `Fedora`   `openEuler`   `OpenCloudOS`   `Anolis OS` === "openSUSE" ``` bash cp -rf /etc/zypp/repos.d.bak /etc/zypp/repos.d zypper ref ``` === "Arch Linux / Manjaro" ``` bash cp -rf /etc/pacman.d/mirrorlist.bak /etc/pacman.d/mirrorlist pacman -Sy ``` === "Alpine Linux" ``` bash cp -rf /etc/apk/repositories.bak /etc/apk/repositories apk update -f ``` === "Gentoo" ``` bash cp -rf /etc/portage/make.conf.bak /etc/portage/make.conf [ -d /etc/portage/repos.conf ] && cp -rf /etc/portage/repos.conf/gentoo.conf.bak /etc/portage/repos.conf/gentoo.conf emerge --sync --quiet ``` === "NixOS" ``` bash cp -rf /etc/nix/nix.conf.bak /etc/nix/nix.conf ``` - #### How to enable SSH remote login ??? quote "Click to expand and view" The commands and configuration steps are for reference only; please be flexible and adapt them accordingly. - Check if `SSH` service is installed ``` bash ls /etc | grep ssh ``` If this folder does not exist, SSH is not installed. Install the `openssh-server` package with your package manager. The installation command is as follows: === "Debian-based / openKylin" ``` bash apt-get install -y openssh-server ``` > `Debian`   `Ubuntu`   `Kali`   `Linux Mint`   `Deepin`   `Zorin OS`   `Armbian`   `Proxmox VE`   `Raspberry Pi OS`   `openKylin` For new systems, run `apt-get update` first. === "RedHat-based / openEuler / OpenCloudOS / Anolis OS" ``` bash dnf install -y openssh-server || yum install -y openssh-server ``` > `Red Hat Enterprise Linux`   `CentOS`   `Rocky Linux`   `AlmaLinux`   `Fedora`   `openEuler`   `OpenCloudOS`   `Anolis OS` === "openSUSE" ``` bash zypper install openssh-server ``` === "Arch Linux / Manjaro" ``` bash pacman -S openssh ``` === "Alpine Linux" ``` bash apk --no-cache add -f openssh ``` === "Gentoo" ``` bash emerge --ask --changed-use --oneshot net-misc/openssh ``` > Package names may vary across different systems. If you encounter a "package not found" error, try using wildcards `openssh*` to install it. - Configure `SSH` service ``` { .bash title="Allow root account login" } cat /etc/ssh/sshd_config | grep -Eq "^[# ]?PermitRootLogin " ; [ $? -eq 0 ] && sed -i 's/^[# ]\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config || echo -e "\nPermitRootLogin yes" >> /etc/ssh/sshd_config ``` ``` { .bash title="Enable password authentication" } cat /etc/ssh/sshd_config | grep -Eq "^[# ]?PasswordAuthentication " ; [ $? -eq 0 ] && sed -i 's/^[# ]\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config || echo -e "\nPasswordAuthentication yes" >> /etc/ssh/sshd_config ``` - Start/restart `SSH` service ``` bash for ssh_svc in sshd ssh openssh; do systemctl restart "${ssh_svc}" 2>/dev/null && break ; systemctl enable --now "${ssh_svc}" 2>/dev/null && break ; done ``` !!! tip "Friendly reminder: If you are using a public server, it is recommended to disable SSH password authentication and set up key-based login." - #### No arrow key interactive UI !!! quote "" If you see a text input instead of the new arrow key UI, install the `ncurses` or `nano` package. The new interaction relies on the `tput` command. - #### About disabled repositories !!! quote "" Many systems have multiple repositories. The script follows the system default. Disabled repositories will not be enabled after running the script, but their URLs will be updated. To enable them: === "Debian-based / openKylin" By default, `deb-src` and `proposed` are disabled. Uncomment the relevant lines in `/etc/apt/sources.list` to enable. > `Debian`   `Ubuntu`   `Kali`   `Linux Mint`   `Deepin`   `Zorin OS`   `Armbian`   `Proxmox VE`   `Raspberry Pi OS`   `openKylin` === "RedHat-based / openEuler / OpenCloudOS / Anolis OS" Some repos are disabled by default. Set `enabled=1` in the relevant repo files under `/etc/yum.repos.d`. > `Red Hat Enterprise Linux`   `CentOS`   `Rocky Linux`   `AlmaLinux`   `Fedora`   `openEuler`   `OpenCloudOS`   `Anolis OS` === "openSUSE" Some repos are disabled by default. Set `enabled=1` in the relevant repo files under `/etc/zypp/repos.d`. - #### Other ??? quote "About the script's online location" The project uses [GitHub Action](https://github.com/SuperManito/LinuxMirrors/blob/main/.github/workflows/build-docs.yml#L29) to automatically copy the source code to the docs directory after each commit for website publishing. The site is hosted on [:netlify: Netlify](https://www.netlify.com), with almost no risk of hijacking. You can also use the raw address from the code repository. This is just to explain why there are several different addresses; the default official site address is easier to remember and access. ??? quote "About mirror download speed" First, see the recommendations in the [Mirror List](../mirrors/index.md) usage help. These are based on experience, but some users still worry about speed. The network latency (`Ping`) of a mirror is not directly related to download speed. Distance does not equal experience. Some mirrors have high bandwidth but poor speed due to load strategies. There are many open source speed test scripts written in C or Python. This project is written in Bash Shell and does not depend on third-party libraries. Bash is the most common scripting language for Linux operations and is preinstalled on most distributions, so users can run it directly without installing anything. This convenience cannot be replaced by other languages. However, Bash scripts may not easily achieve accurate speed testing; using other languages for this is reinventing the wheel. ??? quote "About software source selection" Many people may wonder, "Since scripts are so convenient and highly automated, why can't we automatically select the optimal software source?" It's not that it can't be done, but that it can't be done. "Software source selection" here refers to the script automatically selecting a software source with the best experience based on the client's network environment and location. This question needs to be addressed from multiple perspectives: - Speed As explained above, in summary, the pursuit of speed isn't a universal requirement. For most people, it's simply not noticeable; it's enough to get it working. Moreover, many Linux distributions now offer good speeds without switching sources. - Regarding mirror sites themselves To give a simple example, Alibaba Cloud mirror sites were once considered the top choice due to their high speed and availability. However, as the number of users increased, their speeds became increasingly slower, sometimes even below 10 Mbps. Over time, mirror sites with large user bases may not be able to handle the high traffic, resulting in a poor user experience. Mirror sites with fewer users may eventually close, which is detrimental to the development of the entire ecosystem. - From Developer's Perspective This project aims to develop a universal repository switching script from the perspective of an operations and maintenance tool, rather than a tool that specifically addresses software repository requirements. The script's default behavior should be suitable for the majority of users. As an operations and maintenance tool, it should have a clear functional positioning. As a script, its pros and cons should be carefully considered from multiple perspectives, including scalability,and practicality. The choice of software repository should be fully vested in the user. --- ## Command Options (Advanced Usage) ``` $ bash <(curl -sSL https://linuxmirrors.cn/main.sh) --en --help Command options(name/meaning/value): --abroad Use overseas mirrors none --edu Use China education network mirrors none --source Specify mirror address (domain or IP) address --source-epel Specify EPEL repository address (domain or IP) address --source-security Specify Debian/Ubuntu security repo address (domain or IP) address --source-vault Specify CentOS/AlmaLinux vault repo address (domain or IP) address --source-portage Specify Gentoo portage repo address (domain or IP) address --source-base-system Specify Linux Mint/Raspberry Pi OS base system repo address (domain or IP) address --branch Specify mirror repository (repo name) repo name --branch-epel Specify EPEL repository (path) repo name --branch-security Specify Debian security repo (path) repo name --branch-vault Specify CentOS/AlmaLinux vault repo (path) repo name --branch-portage Specify Gentoo portage repo (path) repo name --branch-base-system Specify Linux Mint/Raspberry Pi OS base system repo (path) repo name --codename Specify Debian/openKylin codename codename --protocol Specify web protocol http or https --use-intranet-source Prefer intranet mirror address true or false --use-official-source Use official mirror of target OS true or false --use-official-source-epel Use official EPEL repo true or false --install-epel Install EPEL repository true or false --backup Backup original mirrors true or false --upgrade-software Upgrade packages true or false --clean-cache Clean cache after upgrade true or false --clean-screen Clear screen before running true or false --lang Specify the language of the script output language --only-epel Only switch EPEL repo none --ignore-backup-tips Ignore backup overwrite prompt none --print-diff Print diff before and after modification none --pure-mode Pure mode, minimal output none --help Show help menu none ``` | Name | Meaning | Value | | - | - | :-: | | `--abroad` | Use overseas mirrors | none | | `--edu` | Use China education network mirrors | none | | `--source` | Specify mirror address (domain or IP) | `address` | | `--source-epel` | Specify EPEL repository address (domain or IP) | `address` | | `--source-security` | Specify Debian/Ubuntu security repo address (domain or IP) | `address` | | `--source-vault` | Specify CentOS/AlmaLinux vault repo address (domain or IP) | `address` | | `--source-portage` | Specify Gentoo portage repo address (domain or IP) | `address` | | `--source-base-system` | Specify Linux Mint/Raspberry Pi OS base system repo address (domain or IP) | `address` | | `--branch` | Specify mirror repository (path) | `repo name` | | `--branch-epel` | Specify EPEL repository (path) | `repo name` | | `--branch-security` | Specify Debian security repo (path) | `repo name` | | `--branch-vault` | Specify CentOS/AlmaLinux vault repo (path) | `repo name` | | `--branch-portage` | Specify Gentoo portage repo (path) | `repo name` | | `--branch-base-system` | Specify Linux Mint/Raspberry Pi OS base system repo (path) | `repo name` | | `--codename` | Specify Debian/openKylin codename | `codename` | | `--protocol` | Specify web protocol | `http` or `https` | | `--use-intranet-source` | Prefer intranet mirror address | `true` or `false` | | `--use-official-source` | Use official mirror of target OS | `true` or `false` | | `--use-official-source-epel` | Use official EPEL repo | `true` or `false` | | `--install-epel` | Install EPEL repository | `true` or `false` | | `--backup` | Backup original mirrors | `true` or `false` | | `--upgrade-software` | Upgrade packages | `true` or `false` | | `--clean-cache` | Clean cache after upgrade | `true` or `false` | | `--clean-screen` | Clear screen before running | `true` or `false` | | `--lang` | Specify the language of the script output | `language id (see docs below)` | | `--only-epel` | Only switch EPEL repo | none | | `--ignore-backup-tips` | Ignore backup overwrite prompt | none | | `--print-diff` | Print diff before and after modification | none | | `--pure-mode` | Pure mode, minimal output | none | | `--help` | Show help menu | none | > Full mirror format: `:///` Below are some advanced usage examples - ### Specify mirror address ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/main.sh) --en --source mirror.example.com ``` - ### Specify mirror repository directory The repository here refers to the directory after the mirror site address, i.e., the repository directory on the mirror site. Although all are called repositories, it is easy to confuse. Main scenario: The target mirror site has a corresponding system repository but does not match the default rule in this script. ??? note "Default repo names for each OS (click to expand)" The script does not adapt to unique repo names of a single mirror site for compatibility. --8<-- "docs/use/repo-branchs.md" Example: ``` { .bash title="Use Aliyun mirror for Rocky Linux" } bash <(curl -sSL https://linuxmirrors.cn/main.sh) --en \ --source mirrors.aliyun.com \ --branch rockylinux ``` The repository directory name for Rocky Linux on Aliyun is [`rockylinux`](https://mirrors.aliyun.com/rockylinux), not the default `rocky`, but you can override the default rule with the command option. > Some systems configure multiple repos at once. See command options for details. > Since the repo path is appended to the mirror address, you can use multi-level paths, e.g., `--branch "linux/debian"` -> `https://mirrors.example.com/linux/debian` - ### Switch EPEL repo only !!! info "EPEL (Extra Packages for Enterprise Linux) is an additional repo maintained by Fedora, mainly for Red Hat-based distributions except Fedora itself. Configuring EPEL is a common need and is recommended by default." Sometimes your desired mirror does not have EPEL. You can skip EPEL during the first run and then run: ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --en --only-epel ``` For EPEL 7 (EOL), use the [`archive`](https://dl.fedoraproject.org/pub/archive/epel) repo. For overseas networks, use `--use-official-source-epel true` to use the official repo. - ### Restore official mirrors If you accidentally deleted the backup of the official mirror, use this command to restore. This skips mirror selection. ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --en --use-official-source true ``` > Some systems (e.g., `Arch Linux`) have no official mirror, so Aliyun will be used as a fallback. - ### Usage examples for specific systems - #### About CentOS EOL The script adapts to EOL CentOS 7/8 and CentOS Stream 8.
- __Chinese mainland__ --- Use the script as usual, no additional steps are required. As most mirror sites in Chinese mainland have already synchronized the [`CentOS Vault`](https://vault.centos.org) repository. - __International__ --- Use `Tencent Cloud` or `Aliyun` mirrors, or use `--use-official-source true` for the official repo.
EPEL 7 is also EOL and is supported by the script. - #### Specify GNU/Linux Debian Security repo For maximum security, use the official repo due to mirror sync delays. ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --en \ --source-security security.debian.org \ --branch-security debian-security ``` - #### Specify Debian-based codename Usually for switching system versions. Example: === "Upgrade GNU/Linux Debian to 13 "trixie"" - Change version code ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --en \ --codename trixie \ --upgrade-software false ``` - Disable the backports repository ``` bash sed -i '/backports/s/^/# /' /etc/apt/sources.list ``` - Upgrade the system ``` bash apt-get update apt-get dist-upgrade ``` - After the upgrade is complete and the system is rebooted, perform the following steps ``` bash # Clear the original software sources (If there is any non-system software source content, please back it up manually first) sed -i '1,$d' /etc/apt/sources.list # Rerun the mirror switching script bash <(curl -sSL https://linuxmirrors.cn/main.sh) --en ``` === "Switch GNU/Linux Debian to testing branch" ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --en \ --codename testing \ --upgrade-software false ``` ``` { .bash .no-copy title="If the script can't set the codename, you can manually replace it after running" } sed -i "s/$(lsb_release -cs)/your-codename/g" /etc/apt/sources.list ``` - #### Switch Ubuntu EOL version mirrors !!! info "EOL means End Of Life. Non-LTS Ubuntu versions are supported for only 9 months. Old versions are removed from the main repo and may require using the `Ubuntu Old Releases` repo." See the official [Wiki](https://documentation.ubuntu.com/project/release-team/list-of-releases/) for version support and check each mirror for `Ubuntu Old Releases` support. ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --en \ --source mirrors.ustc.edu.cn \ --branch ubuntu-old-releases ``` - #### Arch Linux use Chinese community repo This script does not support this extra repo. For reference, use: ``` bash SOURCE="https://mirrors.aliyun.com/archlinuxcn" grep -q "\[archlinuxcn\]" /etc/pacman.conf || echo -e "[archlinuxcn]\nServer = ${SOURCE}/\$arch" >>/etc/pacman.conf ``` - ### I18n (Internationalization) The script provides multi-language support. Currently, there are three built-in display languages: `简体中文`、`繁體中文`、`English`. The default is `简体中文`. - #### Specify Language ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/main.sh) --lang xxx ``` | Type | Value | | :-: | :-: | | 简体中文 | `zh-hans` `zh-cn` `zh` | | 繁體中文 | `zh-hant` `zh-tw` `zh-hk` | | English | `en` `en-us` | It can also be used directly as a command option ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --zh-hant ``` > `--en` `--en-us` `--zh` `--zh-cn` `--zh-hans` `--zh-hant` - #### Select through interaction ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --lang auto ``` - ### Unattended (Automation) To run without interaction, use at least the following options. Recommended for experienced users. ``` { .bash .no-copy title="Example Command" } bash <(curl -sSL https://linuxmirrors.cn/main.sh) --en \ --source mirror.example.com \ --protocol http \ --use-intranet-source false \ --install-epel true \ --backup true \ --upgrade-software false \ --clean-cache false \ --ignore-backup-tips ``` > If you get an "invalid option" error, check the option validity and whitespace encoding. Each option is written on a separate line for readability. - ### Pure mode This feature is introduced to facilitate the use of developers and operation and maintenance personnel. After it is enabled, the script content output will be simplified. It is recommended to use it with other command options without interaction. ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --en --pure-mode ``` !!! tip "Scrolling command logs may have unpredictable display issues, but no problems have been found so far." --- ## 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. 1. It is not recommended to modify the core logic. Keep in sync with the upstream source code. The script execution order is controlled by the `main` function and is clear. 2. You can simply remove irrelevant content, e.g., clear the mirror list arrays `mirror_list_(default|edu|abroad|extranet|intranet)`, e.g., `mirror_list_default=()` 3. To customize script output, modify the `run_start`, `run_end`, and `print_title` functions. 4. To add custom shell content, see the execution order in `main`. Insert content directly or encapsulate in a function. 5. To reduce script size, delete unnecessary content. Besides the mirror lists, you can remove some modules: 1. Keep the original structure; empty out the function bodies if not needed. 2. Remove unused OS repo content `gen_repo_files_xxx`, which takes up over 60% of the script. 3. Remove unused feature modules, e.g., `handle_command_options`, `backup_original_mirrors`, `upgrade_software`. 4. Remove unnecessary language packs, for example: `function msg_pack_en() { :; }` 6. Main configuration is controlled by unified variables, as are command options. These global variables are all uppercase and use underscores. See the table below. Declare them at the top of the script (reserved comment area) for quick customization. ??? note "Variable list (click to expand)" | Variable | Meaning | Value Type | | :-: | :-: | :-: | | `SOURCE` | Specify mirror address (domain or IP) | `address` | | `SOURCE_EPEL` | Specify EPEL repo address (domain or IP) | `address` | | `SOURCE_SECURITY` | Specify Debian/Ubuntu security repo address (domain or IP) | `address` | | `SOURCE_VAULT` | Specify CentOS/AlmaLinux vault repo address (domain or IP) | `address` | | `SOURCE_PORTAGE` | Specify Gentoo portage repo address (domain or IP) | `address` | | `SOURCE_BASE_SYSTEM` | Specify Linux Mint/Raspberry Pi OS base system repo address (domain or IP) | `address` | | `SOURCE_BRANCH` | Specify mirror repo (path) | `repo name` | | `SOURCE_EPEL_BRANCH` | Specify EPEL repo (path) | `repo name` | | `SOURCE_SECURITY_BRANCH` | Specify Debian security repo (path) | `repo name` | | `SOURCE_VAULT_BRANCH` | Specify CentOS/AlmaLinux vault repo (path) | `repo name` | | `SOURCE_PORTAGE_BRANCH` | Specify Gentoo portage repo (path) | `repo name` | | `SOURCE_BASE_SYSTEM_BRANCH` | Specify Linux Mint/Raspberry Pi OS base system repo (path) | `repo name` | | `DEBIAN_CODENAME` | Specify Debian/openKylin codename | `codename` | | `USE_INTRANET_SOURCE` | Prefer intranet mirror address | `true` or `false` | | `USE_OFFICIAL_SOURCE` | Use official mirror of target OS | `true` or `false` | | `USE_OFFICIAL_SOURCE_EPEL` | Use official EPEL repo | `true` or `false` | | `WEB_PROTOCOL` | Specify Web protocol | `http` or `https` | | `INSTALL_EPEL` | Install EPEL repository | `true` or `false` | | `ONLY_EPEL` | Only switch EPEL repo | `true` or `false` | | `BACKUP` | Backup original mirrors | `true` or `false` | | `IGNORE_BACKUP_TIPS` | Ignore backup overwrite prompt | `true` or `false` | | `UPGRADE_SOFTWARE` | Upgrade packages | `true` or `false` | | `CLEAN_CACHE` | Clean cache after upgrade | `true` or `false` | | `CLEAN_SCREEN` | Clear screen before running | `true` or `false` | | `PRINT_DIFF` | Print diff before and after modification | `true` or `false` | | `PURE_MODE` | Pure mode, minimal output | `true` or `false` | > Some variables have defaults. Unused variables do not need to be declared as empty strings. If a configuration is missing, interaction may occur. ================================================ FILE: docs/use/index.md ================================================ --- hide: - navigation - footer --- ## 一键执行命令 === ":material-home-city: 中国大陆" !!! quote "" === ":linuxmirrors: 官网 (推荐)" ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) ``` === ":simple-github: GitHub" ``` bash bash <(curl -sSL https://raw.githubusercontent.com/SuperManito/LinuxMirrors/main/ChangeMirrors.sh) ``` === ":simple-gitee: Gitee 码云 (镜像仓库)" ``` bash bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) ``` > 实时同步、无延迟,国内网络环境下推荐使用 === ":simple-gitcode: GitCode (镜像仓库)" ``` bash bash <(curl -sSL https://raw.gitcode.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) ``` > 同步存在1小时延迟 === ":simple-jsdelivr: jsDelivr (CDN)" ``` bash bash <(curl -sSL https://cdn.jsdelivr.net/gh/SuperManito/LinuxMirrors@main/ChangeMirrors.sh) ``` === ":tencent-cloud: 腾讯云 EO (CDN)" ``` bash bash <(curl -sSL https://edgeone.linuxmirrors.cn/main.sh) ``` > 不建议在国内网络环境下使用 === ":material-earth: 境外以及海外地区" !!! quote "" === ":linuxmirrors: 官网 (推荐)" ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --abroad ``` === ":simple-github: GitHub" ``` bash bash <(curl -sSL https://raw.githubusercontent.com/SuperManito/LinuxMirrors/main/ChangeMirrors.sh) --abroad ``` === ":simple-gitee: Gitee 码云 (镜像仓库)" ``` bash bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) --abroad ``` > 实时同步、无延迟,国内网络环境下推荐使用 === ":simple-gitcode: GitCode (镜像仓库)" ``` bash bash <(curl -sSL https://raw.gitcode.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) --abroad ``` > 同步存在1小时延迟 === ":simple-jsdelivr: jsDelivr (CDN)" ``` bash bash <(curl -sSL https://cdn.jsdelivr.net/gh/SuperManito/LinuxMirrors@main/ChangeMirrors.sh) --abroad ``` === ":tencent-cloud: 腾讯云 EO (CDN)" ``` bash bash <(curl -sSL https://edgeone.linuxmirrors.cn/main.sh) --abroad ``` > 不建议在国内网络环境下使用 === ":material-library: 中国大陆教育网" !!! quote "" === ":linuxmirrors: 官网 (推荐)" ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --edu ``` === ":simple-github: GitHub" ``` bash bash <(curl -sSL https://raw.githubusercontent.com/SuperManito/LinuxMirrors/main/ChangeMirrors.sh) --edu ``` === ":simple-gitee: Gitee 码云 (镜像仓库)" ``` bash bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) --edu ``` > 实时同步、无延迟,国内网络环境下推荐使用 === ":simple-gitcode: GitCode (镜像仓库)" ``` bash bash <(curl -sSL https://raw.gitcode.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) --edu ``` > 同步存在1小时延迟 === ":simple-jsdelivr: jsDelivr (CDN)" ``` bash bash <(curl -sSL https://cdn.jsdelivr.net/gh/SuperManito/LinuxMirrors@main/ChangeMirrors.sh) --edu ``` === ":tencent-cloud: 腾讯云 EO (CDN)" ``` bash bash <(curl -sSL https://edgeone.linuxmirrors.cn/main.sh) --edu ``` > 不建议在国内网络环境下使用 !!! tip "使用帮助" 选项卡分别代表脚本内置软件源(镜像站)类型和获取脚本途径,请在使用前检查目标镜像站是否支持你所使用的操作系统,可以在[软件源列表](../mirrors/index.md)中查看。 默认自动备份原有软件源内容,如需了解更多请翻阅下方文档。若使用过程中的某些选项令你疑惑不解,那么在选择软件源后一路回车即是最佳实践。 _支持在系统原有软件源损坏、缺失、无效等异常环境下使用,无需额外安装任何依赖。_ !!! quote "关于软件源的选择(新用户必读)" 如果你不了解这些镜像站那么建议使用 `阿里云 (兼容性高、可用性强)` 或 `中国科学技术大学 (速度快)`,请不要陷入测速焦虑,内置的软件源一般不会有太大的差异。 本项目脚本是一个自动化运维工具,不会对镜像站进行主观的优劣排序和定制适配,用户的选择应该是自由的,这也是为了开源软件精神能够得到更好的延续。
- :material-numeric-1:{style="color: #5b84f5" .lg} __需要 `ROOT` 权限__ --- 请使用 `root` 账户运行本脚本,切换命令为 `sudo -i` 或 `su root`,不同系统使用的命令不同。另外注意不要通过 `sudo` 直接运行一键命令例如 `sudo bash <(xxx)`。 - :material-numeric-2:{style="color: #5b84f5" .lg} __建议使用现代化的 `SSH` 客户端应用__ --- 如果系统命令行界面的中文显示乱码,将导致无法查看交互内容,此外部分系统 GUI 图形界面的终端应用可能存在一些无法预料的显示问题。部分系统会自动开启 SSH 服务,否则请参考[开启方法](#关于开启-ssh-远程登录的方法)。 - :material-numeric-3:{style="color: #5b84f5" .lg} __如果是在新装系统上首次执行脚本__ --- 当前依赖 `curl` 指令获取脚本内容,但部分操作系统未预装此软件包,将会报错 `Command not found`,安装方法详见下方 [_关于报错 Command not found_](#关于报错-command-not-found)。脚本本身与 `curl` `wget` 指令无关,不会下载任何内容。 - :material-numeric-4:{style="color: #5b84f5" .lg} __脚本运行期间需要交互选择配置__ --- 请通过方向键 ++arrow-up++++arrow-down++++arrow-left++++arrow-right++ 或 ++w++++a++++s++++d++ 控制选项并按 ++enter++ 回车键确认。如果发现交互异常请改变终端软件的窗口大小后重试,避免窗口铺满全屏。
### 常见问题 - #### 关于报错 Command not found !!! quote "" 此报错是由于系统没有安装 `curl` 软件包导致,安装命令如下 === "Debian 系 / openKylin" ``` bash apt-get install -y curl ``` > `Debian`   `Ubuntu`   `Kali`   `Linux Mint`   `Deepin`   `Zorin OS`   `Armbian`   `Proxmox VE`   `Raspberry Pi OS`   `openKylin` 新装系统需要先执行一遍更新 `apt-get update` === "RedHat 系 / openEuler / OpenCloudOS / Anolis OS" ``` bash dnf install -y curl || yum install -y curl ``` > `Red Hat Enterprise Linux`   `CentOS`   `Rocky Linux`   `AlmaLinux`   `Fedora`   `openEuler`   `OpenCloudOS`   `Anolis OS` === "openSUSE" ``` bash zypper install curl ``` === "Arch Linux / Manjaro" ``` bash pacman -S curl ``` === "Alpine Linux" ``` bash apk --no-cache add -f curl bash ncurses ``` === "Gentoo" ``` bash emerge --ask curl ``` === "NixOS" ``` bash nix-env -iA nixos.curl ``` ??? question "安装不上?(点击展开查看其它解决方法)" 假如系统原有软件源是无效的导致安装不上 `curl` 软件包,那么对于 Linux 初学者来说可能会比较麻烦,这里提供几个在线获取脚本的应急方法 === "使用 Python 下载" 适用于大部分操作系统(`Alpine Linux` 除外),`python3` 要是不存在那就再试试 `python` 指令 ``` bash python3 -c "import urllib.request; urllib.request.urlretrieve('https://linuxmirrors.cn/main.sh', 'main.sh')" ``` === "使用 wget 指令下载" 一般没有预装 `curl` 软件包的系统也不会预装 `wget` 软件包,所以大概率这个方法应该是不行的 ``` bash wget https://linuxmirrors.cn/main.sh ``` === "使用浏览器下载" 如果可以访问系统 GUI 图像界面和桌面的话那可以直接在浏览器中打开链接下载脚本,很多系统都会预装 Firefox 火狐浏览器 之后再执行脚本即可 === ":material-home-city: 中国大陆" ``` bash bash main.sh ``` === ":material-earth: 境外以及海外地区" ``` bash bash main.sh --abroad ``` === ":material-library: 中国大陆教育网" ``` bash bash main.sh --edu ``` 如果以上方法试了都不行,那就复制[源码](https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh)至本地新建任意名称的 `.sh` 脚本,粘贴源码内容后通过 `bash` 指令手动执行。 - #### 备份原有软件源 !!! quote "" 脚本会自动备份原有软件仓库配置文件,备份路径为原有文件或目录的绝对路径加上 `.bak` 后缀,例如 `/etc/apt/sources.list => /etc/apt/sources.list.bak`,当检查到已存在备份内容时会询问是否覆盖备份。 - #### 还原已备份的软件源 ??? quote "点击展开查看" === "Debian 系 / openKylin" === "传统格式" ``` bash cp -rf /etc/apt/sources.list.bak /etc/apt/sources.list apt-get update ``` === "DEB822 格式" ``` bash system_name="$(lsb_release -is | tr '[:upper:]' '[:lower:]')" cp -rf "/etc/apt/sources.list.d/${system_name}.sources.bak" "/etc/apt/sources.list.d/${system_name}.sources" apt-get update ``` > `Debian`   `Ubuntu`   `Kali`   `Linux Mint`   `Deepin`   `Zorin OS`   `Armbian`   `Proxmox VE`   `Raspberry Pi OS`   `openKylin` === "RedHat 系 / openEuler / OpenCloudOS / Anolis OS" ``` bash cp -rf /etc/yum.repos.d.bak /etc/yum.repos.d yum makecache ``` > `Red Hat Enterprise Linux`   `CentOS`   `Rocky Linux`   `AlmaLinux`   `Fedora`   `openEuler`   `OpenCloudOS`   `Anolis OS` === "openSUSE" ``` bash cp -rf /etc/zypp/repos.d.bak /etc/zypp/repos.d zypper ref ``` === "Arch Linux / Manjaro" ``` bash cp -rf /etc/pacman.d/mirrorlist.bak /etc/pacman.d/mirrorlist pacman -Sy ``` === "Alpine Linux" ``` bash cp -rf /etc/apk/repositories.bak /etc/apk/repositories apk update -f ``` === "Gentoo" ``` bash cp -rf /etc/portage/make.conf.bak /etc/portage/make.conf [ -d /etc/portage/repos.conf ] && cp -rf /etc/portage/repos.conf/gentoo.conf.bak /etc/portage/repos.conf/gentoo.conf emerge --sync --quiet ``` === "NixOS" ``` bash cp -rf /etc/nix/nix.conf.bak /etc/nix/nix.conf ``` - #### 关于开启 SSH 远程登录的方法 ??? quote "点击展开查看" 命令以及配置步骤仅供参考,注意灵活变通 - 验证是否已安装 `SSH` 服务 ``` bash ls /etc | grep ssh ``` 如果没有这个文件夹说明系统未安装 `SSH` 服务,你需要通过包管理工具安装 `openssh-server` 软件包,安装命令如下: === "Debian 系 / openKylin" ``` bash apt-get install -y openssh-server ``` > `Debian`   `Ubuntu`   `Kali`   `Linux Mint`   `Deepin`   `Zorin OS`   `Armbian`   `Proxmox VE`   `Raspberry Pi OS`   `openKylin` 新装系统需要先执行一遍更新 `apt-get update` === "RedHat 系 / openEuler / OpenCloudOS / Anolis OS" ``` bash dnf install -y openssh-server || yum install -y openssh-server ``` > `Red Hat Enterprise Linux`   `CentOS`   `Rocky Linux`   `AlmaLinux`   `Fedora`   `openEuler`   `OpenCloudOS`   `Anolis OS` === "openSUSE" ``` bash zypper install openssh-server ``` === "Arch Linux / Manjaro" ``` bash pacman -S openssh ``` === "Alpine Linux" ``` bash apk --no-cache add -f openssh ``` === "Gentoo" ``` bash emerge --ask --changed-use --oneshot net-misc/openssh ``` > 不同系统上的软件包名称有所差异,如果提示找不到该软件包可尝试使用通配符 `openssh*` 进行安装 - 配置 `SSH` 服务 ``` { .bash title="允许 root 账户登录" } cat /etc/ssh/sshd_config | grep -Eq "^[# ]?PermitRootLogin " ; [ $? -eq 0 ] && sed -i 's/^[# ]\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config || echo -e "\nPermitRootLogin yes" >> /etc/ssh/sshd_config ``` ``` { .bash title="启用密码认证" } cat /etc/ssh/sshd_config | grep -Eq "^[# ]?PasswordAuthentication " ; [ $? -eq 0 ] && sed -i 's/^[# ]\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config || echo -e "\nPasswordAuthentication yes" >> /etc/ssh/sshd_config ``` - 启动/重启 `SSH` 服务 ``` bash for ssh_svc in sshd ssh; do systemctl restart "${ssh_svc}" 2>/dev/null && break ; systemctl enable --now "${ssh_svc}" 2>/dev/null && break ; done ``` !!! tip "友情提示:如果你正在使用公网服务器,建议关闭 SSH 密码认证方式并设置密钥登录。" - #### 关于未显示方向键交互控制界面 !!! quote "" 如果发现交互界面是输入而不是新式的方向键控制,那么请自行安装 `ncurses` 或 `nano` 软件包,新式的按键交互依赖 `tput` 指令实现。 - #### 关于未启用的软件源仓库 !!! quote "" 很多系统的软件源会启用多个软件仓库配置,脚本遵循系统默认设置,默认不启用的软件源(仓库)不会在运行完本脚本后被启用,但是它们也随脚本更换了目标软件源(镜像站)地址,具体启用方法如下: === "Debian 系 / openKylin" 默认禁用了`deb-src`源码仓库和`proposed`预发布软件源,若需启用请将 `/etc/apt/sources.list` 文件中相关内容的所在行取消注释 > `Debian`   `Ubuntu`   `Kali`   `Linux Mint`   `Deepin`   `Zorin OS`   `Armbian`   `Proxmox VE`   `Raspberry Pi OS`   `openKylin` === "RedHat 系 / openEuler / OpenCloudOS / Anolis OS" 部分仓库默认没有启用,若需启用请将 `/etc/yum.repos.d` 目录下相关 repo 文件中的 `enabled` 值修改为 `1` > `Red Hat Enterprise Linux`   `CentOS`   `Rocky Linux`   `AlmaLinux`   `Fedora`   `openEuler`   `OpenCloudOS`   `Anolis OS` === "openSUSE" 部分仓库默认没有启用,若需启用请将 `/etc/zypp/repos.d` 目录下相关 repo 文件中的 `enabled` 值修改为 `1` - #### 其它 ??? quote "关于调用脚本的互联网位置" 项目利用 [GitHub Action](https://github.com/SuperManito/LinuxMirrors/blob/main/.github/workflows/build-docs.yml#L29) 在每次提交后自动拷贝源码到文档目录作为网站资源发布,网站托管于 [:netlify: Netlify](https://www.netlify.com),几乎没有被劫持的风险请放心使用。 当然你也可以使用代码托管仓库的原始地址来调用,这里只是想告诉你为什么会有几个不同的地址,默认的官网地址更易于记忆和访问。 ??? quote "关于软件源下载速度问题" 首先,在[软件源列表](../mirrors/index.md)的使用帮助处有写使用推荐,这是根据以往经验总结出来的,但总有用户在纠结软件源速度的问题。 软件源(镜像站)的网络延迟即 `Ping` 与下载速度没有太大的关联,双方地理位置间隔的远近不代表实际体验,有些镜像站下行总带宽很高但实际测速却并不理想,因为这与镜像站的负载策略有关。 网上也有很多基于 C、Python 编写的镜像站测速开源脚本,而本项目脚本基于 Bash Shell 编写且不依赖任何第三方库,Bash 是 Linux 运维中最常用的脚本语言并且绝大部分发行版都会预装,这意味着用户不需要安装任何环境就能直接运行,这种便利性是其它高级语言无法替代的,不过目前来看 Bash 脚本可能不太容易实现精准测速的功能,使用其它高级语言编写测速功能无疑是造轮子的行为。 ??? quote "关于软件源选优" 很多朋友可能都会有一个疑问:“既然脚本已经如此便捷且实现了高度自动化,为什么不能实现软件源自动选优呢?”,不是做不到而是不能。 “软件源选优” 在这里指的是脚本根据客户端的网络环境、地理位置自动选择一个体验最佳的软件源,这个问题要从多个角度来论证: - 速度方面 其实上面已经解释过了,总结来说就是追求速度不是普遍需求,对大多数人来说是无感的、能用即可,况且现在很多 Linux 发行版不需要换源就有不错的速度。 - 对于镜像站本身 举个最简单的例子,以前阿里云镜像站因为速度快、可用性高几乎被当成首选,但是随着用户越来越多导致速度变的原来越慢甚至可能不足 10 Mbps。 长此以往,那些用户多的镜像站可能无法承受过高的流量而导致体验下降,用户少的镜像站可能会最终走向关闭,这不利于整个生态的发展。 - 开发者角度 本项目站在运维工具的角度致力于开发一个通用的换源脚本,而不是一个解决软件源需求的具体化工具,要使脚本的默认行为适用于大多数用户群体。作为运维工具要有明确的功能定位,作为脚本要从扩展性、实用性等多个方面去衡量利弊,软件源的选择权应该完全交给用户。 --- ## 命令选项(高级用法) ``` $ bash <(curl -sSL https://linuxmirrors.cn/main.sh) --help 命令选项(名称/含义/值): --abroad 使用境外以及海外软件源 无 --edu 使用中国大陆教育网软件源 无 --source 指定软件源地址(域名或IP) 地址 --source-epel 指定 EPEL 附加软件包仓库的软件源地址(域名或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) 地址 --branch 指定软件源仓库(路径) 仓库名 --branch-epel 指定 EPEL 附加软件包仓库的软件源仓库(路径) 仓库名 --branch-security 指定 Debian 系统 security 仓库的软件源仓库(路径) 仓库名 --branch-vault 指定 CentOS / AlmaLinux 系统 vault 仓库的软件源仓库(路径) 仓库名 --branch-portage 指定 Gentoo 系统 portage 仓库的软件源仓库(路径) 仓库名 --branch-base-system 指定 Linux Mint / Raspberry Pi OS 底层系统的软件源仓库(路径) 仓库名 --codename 指定 Debian 系 / openKylin 操作系统的版本代号 代号名称 --protocol 指定 Web 协议 http 或 https --use-intranet-source 是否优先使用内网软件源地址 true 或 false --use-official-source 是否使用目标操作系统的官方软件源 true 或 false --use-official-source-epel 是否使用 EPEL 附加软件包的官方软件源 true 或 false --install-epel 是否安装 EPEL 附加软件包 true 或 false --backup 是否备份原有软件源 true 或 false --upgrade-software 是否更新软件包 true 或 false --clean-cache 是否在更新软件包后清理下载缓存 true 或 false --clean-screen 是否在运行前清除屏幕上的所有内容 true 或 false --lang 指定脚本输出的语言 语言 --only-epel 仅更换 EPEL 软件源模式 无 --ignore-backup-tips 忽略覆盖备份提示 无 --print-diff 打印源文件修改前后差异 无 --pure-mode 纯净模式,精简打印内容 无 --help 查看帮助菜单 无 ``` | 名称 | 含义 | 选项值 | | - | - | :-: | | `--abroad` | 使用境外以及海外软件源 | 无 | | `--edu` | 使用中国大陆教育网软件源 | 无 | | `--source` | 指定软件源地址(域名或IP) | `地址` | | `--source-epel` | 指定 EPEL 附加软件包仓库的软件源地址(域名或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) | `地址` | | `--branch` | 指定软件源仓库(路径) | `仓库名` | | `--branch-epel` | 指定 EPEL 附加软件包仓库的软件源仓库(路径) | `仓库名` | | `--branch-security` | 指定 Debian 系统 security 仓库的软件源仓库(路径) | `仓库名` | | `--branch-vault` | 指定 CentOS / AlmaLinux 系统 vault 仓库的软件源仓库(路径) | `仓库名` | | `--branch-portage` | 指定 Gentoo 系统 portage 仓库的软件源仓库(路径) | `仓库名` | | `--branch-base-system` | 指定 Linux Mint / Raspberry Pi OS 底层系统的软件源仓库(路径) | `仓库名` | | `--codename` | 指定 Debian 系 / openKylin 操作系统的版本代号 | `代号名称` | | `--protocol` | 指定 Web 协议 | `http` 或 `https` | | `--use-intranet-source` | 是否优先使用内网软件源地址 | `true` 或 `false` | | `--use-official-source` | 是否使用目标操作系统的官方软件源 | `true` 或 `false` | | `--use-official-source-epel` | 是否使用 EPEL 附加软件包的官方软件源 | `true` 或 `false` | | `--install-epel` | 是否安装 EPEL 附加软件包 | `true` 或 `false` | | `--backup` | 是否备份原有软件源 | `true` 或 `false` | | `--upgrade-software` | 是否更新软件包 | `true` 或 `false` | | `--clean-cache` | 是否在更新软件包后清理下载缓存 | `true` 或 `false` | | `--clean-screen` | 是否在运行前清除屏幕上的所有内容 | `true` 或 `false` | | `--lang` | 指定脚本输出的语言 | `语言ID(详见下方文档)` | | `--only-epel` | 仅更换 EPEL 软件源模式 | 无 | | `--ignore-backup-tips` | 忽略覆盖备份提示(即不覆盖备份) | 无 | | `--print-diff` | 是否打印源文件修改前后差异 | 无 | | `--pure-mode` | 纯净模式,精简打印内容 | 无 | | `--help` | 查看帮助菜单 | 无 | > 软件源完整格式 `://<软件源地址(域名或IP)>/<软件源仓库(路径)>` 下面是一些高级用法的举例 - ### 指定软件源地址 ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/main.sh) --source mirror.example.com ``` - ### 指定软件源仓库目录 这里描述的软件源仓库与系统软件仓库不同,指的是软件源(镜像站)地址后面的路径即镜像站的仓库目录,虽然名义上都是仓库但是非常容易混淆 主要使用场景:目标镜像站有对应的系统镜像仓库但是不符合本项目脚本关于软件源仓库设置的默认规则 ??? note "项目对于各操作系统所使用的默认仓库名称(点击展开查看)" 项目脚本为了适配大的环境不会针对某一镜像站独特的仓库名称而单独适配 --8<-- "docs/use/repo-branchs.md" 请看下面的例子 ``` { .bash title="使用阿里云镜像站的 Rocky Linux 软件源" } bash <(curl -sSL https://linuxmirrors.cn/main.sh) \ --source mirrors.aliyun.com \ --branch rockylinux ``` 阿里云镜像站的 Rocky Linux 仓库目录名称为 [`rockylinux`](https://mirrors.aliyun.com/rockylinux),不符合默认规则 `rocky`,但是可以通过命令选项绕过脚本默认规则来实现。 > 部分系统会同时配置多个仓库的软件源,具体详见命令选项 > 由于软件源仓库作用在软件源地址上因此也可以使用多级路径,例如 `--branch "linux/debian"` -> `https://mirrors.example.com/linux/debian` - ### 单独更换 EPEL 源 !!! info "EPEL (Extra Packages for Enterprise Linux) 是由 Fedora 组织维护的一个附加软件包仓库,它主要适用于除 Fedora 操作系统以外的红帽系 Linux 发行版,配置 EPEL 仓库已成为广大用户的普遍需求,建议默认安装它" 有些时候你会发现想使用的镜像站没有 EPEL 仓库,那么你可以在第一次运行脚本时不安装或更换 EPEL 源然后再单独执行下面的命令 ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --only-epel ``` 对于已经 EOL 的 EPEL 7,注意需要使用 [`archive`](https://dl.fedoraproject.org/pub/archive/epel) 仓库,境外以及海外网络环境建议通过命令选项 `--use-official-source-epel true` 使用官方源 - ### 恢复使用官方源 当你不小心删除了官方源的备份时可以使用此命令来恢复,使用此命令选项后将跳过选择软件源步骤 ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --use-official-source true ``` > 部分系统不存在官方源例如 `Arch Linux`,届时会自动更换成兼容性较高的阿里云镜像站 - ### 特定系统的使用示例 - #### 关于 CentOS 停服问题 脚本对于已经 EOL 的 CentOS 7/8、CentOS Stream 8 进行了适配
- __国内环境__ --- 正常使用脚本,没有额外操作,因为国内大部分镜像站都已同步 [`CentOS Vault`](https://vault.centos.org) 仓库 - __境外以及海外环境__ --- 建议使用 `腾讯云` 或 `阿里云` 镜像站,或者通过 `--use-official-source true` 命令选项使用官方源
另外 EPEL 7 也进入了 EOL,脚本同样对其进行了适配 - #### 指定 GNU/Linux Debian 操作系统的 Security 源 如果你想尽可能提高服务器的安全性则建议使用官方源,因为镜像同步存在延迟 ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) \ --source-security security.debian.org \ --branch-security debian-security ``` - #### 指定 Debian 系 Linux 操作系统的版本代号 大多数情况下自定义版本代号用于更换系统版本,请看下面的例子 === "升级 GNU/Linux Debian 至 13 "trixie"" - 更换版本代号 ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) \ --codename trixie \ --upgrade-software false ``` - 禁用 backports 仓库 ``` bash sed -i '/backports/s/^/# /' /etc/apt/sources.list ``` - 升级系统 ``` bash apt-get update apt-get dist-upgrade ``` - 在升级完成并重新引导系统后执行以下步骤 ``` bash # 清空原有软件源(如有非系统软件源内容请先自行手动备份) sed -i '1,$d' /etc/apt/sources.list # 重新执行换源脚本 bash <(curl -sSL https://linuxmirrors.cn/main.sh) ``` === "将 GNU/Linux Debian 的版本切换到测试分支" ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) \ --codename testing \ --upgrade-software false ``` ``` { .bash .no-copy title="若脚本无法实现指定版本代号,你也可以在执行脚本后手动替换" } sed -i "s/$(lsb_release -cs)/指定版本代号/g" /etc/apt/sources.list ``` - #### 更换 Ubuntu EOL版本软件源 !!! info "EOL 为生命周期结束的缩写(End Of Life),Ubuntu 迭代速度较快一般非LTS(长期支持)版本的生命周期只有9个月。官方会定期从主仓库移除不在生命周期内的版本仓库目录,届时可能就需要使用镜像站的 `Ubuntu Old Releases` 仓库" 具体版本支持情况详见官方 [Wiki](https://documentation.ubuntu.com/project/release-team/list-of-releases/),关于 `Ubuntu Old Releases` 仓库的支持情况详见各镜像站 ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) \ --source mirrors.ustc.edu.cn \ --branch ubuntu-old-releases ``` - #### Arch Linux 使用中文社区仓库 本项目脚本当前不支持该额外仓库,由于使用人数较少等原因暂不考虑适配,若想使用请参考下方的一键配置命令 ``` bash SOURCE="https://mirrors.aliyun.com/archlinuxcn" # 指定软件源地址 grep -q "\[archlinuxcn\]" /etc/pacman.conf || echo -e "[archlinuxcn]\nServer = ${SOURCE}/\$arch" >>/etc/pacman.conf # 一键配置命令 ``` - ### 国际化(I18n) 脚本提供多语言支持,当前内置 `简体中文`、`繁體中文`、`English` 共三种显示语言,默认为 `简体中文` - #### 指定语言 ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/main.sh) --lang xxx ``` | 类型 | 值 | | :-: | :-: | | 简体中文 | `zh-hans` `zh-cn` `zh` | | 繁體中文 | `zh-hant` `zh-tw` `zh-hk` | | English | `en` `en-us` | 也可以直接作为命令选项使用 ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --en ``` > `--en` `--en-us` `--zh` `--zh-cn` `--zh-hans` `--zh-hant` - #### 通过交互进行选择 ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --lang auto ``` - ### 无人值守(自动化) 不通过交互完成换源操作,至少需要使用如下命令选项来实现,建议熟悉后再使用 ``` { .bash .no-copy title="参考命令" } bash <(curl -sSL https://linuxmirrors.cn/main.sh) \ --source mirror.example.com \ --protocol http \ --use-intranet-source false \ --install-epel true \ --backup true \ --upgrade-software false \ --clean-cache false \ --ignore-backup-tips ``` > 如果报错 `命令选项无效` 那么请检查选项合法性以及空格字符编码,在示例中一行写一个选项是为了提高命令的可读性 - ### 纯净模式 推出该功能是为了便于开发以及运维人员使用,启用后会精简脚本内容输出,建议搭配其它命令选项无交互使用 ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --pure-mode ``` !!! tip "滚动输出的命令日志可能存在无法预料的显示问题,不过目前暂未发现异常" --- ## 精简版(Lite) 额外提供一个精简版本,是主脚本的复制,面向企业产品、开源项目使用,具有以下特性: - 单一显示语言 `English`,无 I18n 国际化功能 - 默认使用官方源,去除了交互选择内置软件源功能 - 去除了无关的打印内容 - 保留核心逻辑与命令选项设计 ``` bash bash <(curl -sSL https://linuxmirrors.cn/main-lite.sh) ``` > 请熟悉本项目后再使用,不建议新手用户使用 --- ## 定制脚本 如果你是其它项目的开发者希望通过本项目来制作专属脚本那么请参考下面提到的内容,目前已经有国内教育单位镜像站的维护者这样做了。 1. 首先不建议修改代码的底层逻辑,应尽量与本项目源码保持同步,脚本内容执行顺序由 `main` 函数控制,代码逻辑清晰 2. 你可以简单去除一些无关内容,例如将软件源列表(数组)`mirror_list_(default|edu|abroad|extranet|intranet)` 中的内容删除,例:`mirror_list_default=()` 3. 如果你想定制脚本打印内容可直接修改 `run_start` `run_end` `print_title` 这三个函数中的内容 4. 如果你想添加自定义 Shell 内容详见 `main` 函数中脚本执行顺序,可以在对应位置直接插入内容也可以封装函数后调用 5. 如果你想要缩减脚本体积那么可以删除一些不必要的内容,除了上面提到的软件源列表还有一些涉及脚本工作的部分模块内容,具体如下: 1. 首先在删除内容时应尽可能保留脚本原始结构,直接把涉及函数中的内容删除即可,使其保留为空函数 2. 可以删除一些不使用(操作系统)的软件源原始内容 `gen_repo_files_xxx`,这些内容占据了脚本 `60%` 以上的体积 3. 如果你不使用某些功能那么可以删除对应功能模块函数中的内容,`命令选项 handle_command_options`、`备份原有软件源 backup_original_mirrors`、`更新软件包 upgrade_software` 4. 移除不需要的语言包,例:`function msg_pack_en() { :; }` 6. 脚本主要功能配置是由统一的变量控制的,命令选项亦是如此,这些全局变量由全大写字母构成并遵循下划线命名法,具体变量详见如下表格,你只需要将这些变量声明在脚本头部(预留注释区域)即可快速完成定制 ??? note "变量列表(点击展开查看)" | 变量名 | 含义 | 值类型 | | :-: | :-: | :-: | | `SOURCE` | 指定软件源地址(域名或IP) | `地址` | | `SOURCE_EPEL` | 指定 EPEL 附加软件包仓库的软件源地址(域名或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) | `地址` | | `SOURCE_BRANCH` | 指定软件源仓库(路径) | `仓库名` | | `SOURCE_EPEL_BRANCH` | 指定 EPEL 附加软件包仓库的软件源仓库(路径) | `仓库名` | | `SOURCE_SECURITY_BRANCH` | 指定 Debian 系统 security 仓库的软件源仓库(路径) | `仓库名` | | `SOURCE_VAULT_BRANCH` | 指定 CentOS / AlmaLinux 系统 vault 仓库的软件源仓库(路径) | `仓库名` | | `SOURCE_PORTAGE_BRANCH` | 指定 Gentoo 系统 portage 仓库的软件源仓库(路径) | `仓库名` | | `SOURCE_BASE_SYSTEM_BRANCH` | 指定 Linux Mint / Raspberry Pi OS 底层系统的软件源仓库(路径) | `仓库名` | | `DEBIAN_CODENAME` | 指定 Debian 系 / openKylin 操作系统的版本代号 | `代号名称` | | `USE_INTRANET_SOURCE` | 是否优先使用内网软件源地址 | `true` 或 `false` | | `USE_OFFICIAL_SOURCE` | 是否使用目标操作系统的官方软件源 | `true` 或 `false` | | `USE_OFFICIAL_SOURCE_EPEL` | 是否使用 EPEL 附加软件包的官方软件源 | `true` 或 `false` | | `WEB_PROTOCOL` | 指定 Web 协议 | `http` 或 `https` | | `INSTALL_EPEL` | 是否安装 EPEL 附加软件包 | `true` 或 `false` | | `ONLY_EPEL` | 仅更换 EPEL 软件源模式 | `true` 或 `false` | | `BACKUP` | 是否备份原有软件源 | `true` 或 `false` | | `IGNORE_BACKUP_TIPS` | 忽略覆盖备份提示(即不覆盖备份) | `true` 或 `false` | | `UPGRADE_SOFTWARE` | 是否更新软件包 | `true` 或 `false` | | `CLEAN_CACHE` | 是否在更新软件包后清理下载缓存 | `true` 或 `false` | | `CLEAN_SCREEN` | 是否在运行前清除屏幕上的所有内容 | `true` 或 `false` | | `PRINT_DIFF` | 是否打印源文件修改前后差异 | `true` 或 `false` | | `PURE_MODE` | 纯净模式,精简打印内容 | `true` 或 `false` | > 部分变量存在默认值,未涉及的变量无需声明为空值(空字符串),另外如果对应功能配置不存在那么就可能会出现交互 ================================================ FILE: docs/use/index.zh-Hant.md ================================================ --- hide: - navigation - footer --- ## 一鍵執行命令 === ":material-home-city: 中國大陸" !!! quote "" === ":linuxmirrors: 官網 (推薦)" ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --zh-hant ``` === ":simple-github: GitHub" ``` bash bash <(curl -sSL https://raw.githubusercontent.com/SuperManito/LinuxMirrors/main/ChangeMirrors.sh) --zh-hant ``` === ":simple-gitee: Gitee 碼雲 (鏡像倉庫)" ``` bash bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) --zh-hant ``` > 即時同步、無延遲,中國大陸網路環境下推薦使用 === ":simple-gitcode: GitCode (鏡像倉庫)" ``` bash bash <(curl -sSL https://raw.gitcode.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) --zh-hant ``` > 同步存在1小時延遲 === ":simple-jsdelivr: jsDelivr (CDN)" ``` bash bash <(curl -sSL https://cdn.jsdelivr.net/gh/SuperManito/LinuxMirrors@main/ChangeMirrors.sh) --zh-hant ``` === ":tencent-cloud: 騰訊雲 EO (CDN)" ``` bash bash <(curl -sSL https://edgeone.linuxmirrors.cn/main.sh) --zh-hant ``` > 不建議在中國大陸網路環境下使用 === ":material-earth: 國際地區" !!! quote "" === ":linuxmirrors: 官網 (推薦)" ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --zh-hant --abroad ``` === ":simple-github: GitHub" ``` bash bash <(curl -sSL https://raw.githubusercontent.com/SuperManito/LinuxMirrors/main/ChangeMirrors.sh) --zh-hant --abroad ``` === ":simple-gitee: Gitee 碼雲 (鏡像倉庫)" ``` bash bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) --zh-hant --abroad ``` > 即時同步、無延遲,中國大陸網路環境下推薦使用 === ":simple-gitcode: GitCode (鏡像倉庫)" ``` bash bash <(curl -sSL https://raw.gitcode.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) --zh-hant --abroad ``` > 同步存在1小時延遲 === ":simple-jsdelivr: jsDelivr (CDN)" ``` bash bash <(curl -sSL https://cdn.jsdelivr.net/gh/SuperManito/LinuxMirrors@main/ChangeMirrors.sh) --zh-hant --abroad ``` === ":tencent-cloud: 騰訊雲 EO (CDN)" ``` bash bash <(curl -sSL https://edgeone.linuxmirrors.cn/main.sh) --zh-hant --abroad ``` > 不建議在中國大陸網路環境下使用 === ":material-library: 中國大陸教育網" !!! quote "" === ":linuxmirrors: 官網 (推薦)" ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --zh-hant --edu ``` === ":simple-github: GitHub" ``` bash bash <(curl -sSL https://raw.githubusercontent.com/SuperManito/LinuxMirrors/main/ChangeMirrors.sh) --zh-hant --edu ``` === ":simple-gitee: Gitee 碼雲 (鏡像倉庫)" ``` bash bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) --zh-hant --edu ``` > 即時同步、無延遲,中國大陸網路環境下推薦使用 === ":simple-gitcode: GitCode (鏡像倉庫)" ``` bash bash <(curl -sSL https://raw.gitcode.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) --zh-hant --edu ``` > 同步存在1小時延遲 === ":simple-jsdelivr: jsDelivr (CDN)" ``` bash bash <(curl -sSL https://cdn.jsdelivr.net/gh/SuperManito/LinuxMirrors@main/ChangeMirrors.sh) --zh-hant --edu ``` === ":tencent-cloud: 騰訊雲 EO (CDN)" ``` bash bash <(curl -sSL https://edgeone.linuxmirrors.cn/main.sh) --zh-hant --edu ``` > 不建議在中國大陸網路環境下使用 !!! tip "使用幫助" 選項卡分別代表腳本內建軟體源(鏡像站)類型和獲取腳本途徑,請在使用前檢查目標鏡像站是否支援你所使用的作業系統,可以在[軟體源列表](../mirrors/index.md)中查看。 預設自動備份原有軟體源內容,如需了解更多請翻閱下方文件。若使用過程中的某些選項令你疑惑不解,那麼在選擇軟體源後一路回車即是最佳實踐。 _支援在系統原有軟體源損壞、缺失、無效等異常環境下使用,無需額外安裝任何依賴。_ !!! quote "關於軟體源的選擇(新用戶必讀)" 如果你不了解這些鏡像站,那麼建議使用 `阿里雲 (相容性高、可用性強)` 或 `中國科學技術大學 (速度快)`,請不要陷入測速焦慮,內建的軟體源一般不會有太大的差異。 本專案腳本是一個自動化維運工具,不會對鏡像站進行主觀的優劣排序和客製化適配,使用者的選擇應該是自由的,這也是為了開源軟體精神能夠得到更好的延續。
- :material-numeric-1:{style="color: #5b84f5" .lg} __需要 `ROOT` 權限__ --- 請使用 `root` 帳戶執行本腳本,切換指令為 `sudo -i` 或 `su root`,不同系統使用的指令不同。另外注意不要透過 `sudo` 直接執行一鍵指令例如 `sudo bash <(xxx)`。 - :material-numeric-2:{style="color: #5b84f5" .lg} __建議使用現代化的 `SSH` 用戶端應用__ --- 如果系統命令列介面的中文顯示亂碼,將導致無法查看互動內容,此外部分系統 GUI 圖形介面的終端應用可能存在一些無法預料的顯示問題。部分系統會自動開啟 SSH 服務,否則請參考[開啟方法](#關於開啟-ssh-遠端登入的方法)。 - :material-numeric-3:{style="color: #5b84f5" .lg} __如果是在新裝系統上首次執行腳本__ --- 目前依賴 `curl` 指令取得腳本內容,但部分作業系統未預先安裝此軟體包,將會報錯 `Command not found`,安裝方法詳見下方 [_關於報錯 Command not found_](#關於報錯-command-not-found)。腳本本身與 `curl` `wget` 指令無關,不會下載任何內容。 - :material-numeric-4:{style="color: #5b84f5" .lg} __腳本運行期間需要互動選擇配置__ --- 請透過方向鍵 ++arrow-up++++arrow-down++++arrow-left++++arrow-right++ 或 ++w++++a++++s++++d++ 控制選項並按 ++enter++ 回車鍵確認。如果發現互動異常請改變終端軟體的視窗大小後重試,避免視窗鋪滿全螢幕。
### 常見問題 - #### 關於報錯 Command not found !!! quote "" 此報錯是由於系統沒有安裝 `curl` 軟體包導致,安裝命令如下 === "Debian 系 / openKylin" ``` bash apt-get install -y curl ``` > `Debian`   `Ubuntu`   `Kali`   `Linux Mint`   `Deepin`   `Zorin OS`   `Armbian`   `Proxmox VE`   `Raspberry Pi OS`   `openKylin` 新裝系統需要先執行一遍更新 `apt-get update` === "RedHat 系 / openEuler / OpenCloudOS / Anolis OS" ``` bash dnf install -y curl || yum install -y curl ``` > `Red Hat Enterprise Linux`   `CentOS`   `Rocky Linux`   `AlmaLinux`   `Fedora`   `openEuler`   `OpenCloudOS`   `Anolis OS` === "openSUSE" ``` bash zypper install curl ``` === "Arch Linux / Manjaro" ``` bash pacman -S curl ``` === "Alpine Linux" ``` bash apk --no-cache add -f curl bash ncurses ``` === "Gentoo" ``` bash emerge --ask curl ``` === "NixOS" ``` bash nix-env -iA nixos.curl ``` ??? question "安裝不上? (點擊展開查看其它解決方法)" 假如系統原有軟體源是無效的導致安裝不上 `curl` 軟體包,那麼對於 Linux 初學者來說可能會比較麻煩,這裡提供幾個在線獲取腳本的應急方法 === "使用 Python 下載" 適用於大部分作業系統(`Alpine Linux` 除外),`python3` 要是不存在那就再試試 `python` 指令 ``` bash python3 -c "import urllib.request; urllib.request.urlretrieve('https://linuxmirrors.cn/main.sh', 'main.sh')" ``` === "使用 wget 指令下載" 一般沒有預先安裝 `curl` 軟體包的系統也不會預先安裝 `wget` 軟體包,所以大機率這個方法應該是不行的 ``` bash wget https://linuxmirrors.cn/main.sh ``` === "使用瀏覽器下載" 如果可以訪問系統 ​​GUI 映像介面和桌面的話那可以直接在瀏覽器中開啟連結下載腳本,許多系統都會預先安裝 Firefox 火狐瀏覽器 之後再執行腳本即可 === ":material-home-city: 中國大陸" ``` bash bash main.sh --zh-hant ``` === ":material-earth: 國際地區" ``` bash bash main.sh --zh-hant --abroad ``` === ":material-library: 中國大陸教育網" ``` bash bash main.sh --zh-hant --edu ``` 如果以上方法試了都不行,那就複製[原始碼](https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh)至本地新建任意名稱的 `.sh` 腳本,貼上原始碼內容後透過 `bash` 指令手動執行。 - #### 備份原有軟體源 !!! quote "" 腳本會自動備份原有軟體源內容,備份路徑為原始文件或目錄的絕對路徑加上 `.bak` 後綴,例如 `/etc/apt/sources.list => /etc/apt/sources.list.bak`,檢查已存在備份內容時會詢問是否覆蓋備份。 - #### 還原已備份的軟體源 ??? quote "點擊展開查看" === "Debian 系 / openKylin" === "傳統格式" ``` bash cp -rf /etc/apt/sources.list.bak /etc/apt/sources.list apt-get update ``` === "DEB822 格式" ``` bash system_name="$(lsb_release -is | tr '[:upper:]' '[:lower:]')" cp -rf "/etc/apt/sources.list.d/${system_name}.sources.bak" "/etc/apt/sources.list.d/${system_name}.sources" apt-get update ``` > `Debian`   `Ubuntu`   `Kali`   `Linux Mint`   `Deepin`   `Zorin OS`   `Armbian`   `Proxmox VE`   `Raspberry Pi OS`   `openKylin` === "RedHat 系 / openEuler / OpenCloudOS / Anolis OS" ``` bash cp -rf /etc/yum.repos.d.bak /etc/yum.repos.d yum makecache ``` > `Red Hat Enterprise Linux`   `CentOS`   `Rocky Linux`   `AlmaLinux`   `Fedora`   `openEuler`   `OpenCloudOS`   `Anolis OS` === "openSUSE" ``` bash cp -rf /etc/zypp/repos.d.bak /etc/zypp/repos.d zypper ref ``` === "Arch Linux / Manjaro" ``` bash cp -rf /etc/pacman.d/mirrorlist.bak /etc/pacman.d/mirrorlist pacman -Sy ``` === "Alpine Linux" ``` bash cp -rf /etc/apk/repositories.bak /etc/apk/repositories apk update -f ``` === "Gentoo" ``` bash cp -rf /etc/portage/make.conf.bak /etc/portage/make.conf [ -d /etc/portage/repos.conf ] && cp -rf /etc/portage/repos.conf/gentoo.conf.bak /etc/portage/repos.conf/gentoo.conf emerge --sync --quiet ``` === "NixOS" ``` bash cp -rf /etc/nix/nix.conf.bak /etc/nix/nix.conf ``` - #### 關於開啟 SSH 遠端登入的方法 ??? quote "點擊展開查看" 指令以及設定步驟僅供參考,注意靈活變通 - 驗證是否已安裝 `SSH` 服務 ``` bash ls /etc | grep ssh ``` 如果沒有這個資料夾說明系統未安裝 `SSH` 服務,你需要透過套件管理工具安裝 `openssh-server` 軟體包,安裝指令如下: === "Debian 系 / openKylin" ``` bash apt-get install -y openssh-server ``` > `Debian`   `Ubuntu`   `Kali`   `Linux Mint`   `Deepin`   `Zorin OS`   `Armbian`   `Proxmox VE`   `Raspberry Pi OS`   `openKylin` 新裝系統需要先執行一遍更新 `apt-get update` === "RedHat 系 / openEuler / OpenCloudOS / Anolis OS" ``` bash dnf install -y openssh-server || yum install -y openssh-server ``` > `Red Hat Enterprise Linux`   `CentOS`   `Rocky Linux`   `AlmaLinux`   `Fedora`   `openEuler`   `OpenCloudOS`   `Anolis OS` === "openSUSE" ``` bash zypper install openssh-server ``` === "Arch Linux / Manjaro" ``` bash pacman -S openssh ``` === "Alpine Linux" ``` bash apk --no-cache add -f openssh ``` === "Gentoo" ``` bash emerge --ask --changed-use --oneshot net-misc/openssh ``` > 不同系統上的軟體包名稱有所差異,如果提示找不到該軟體包可嘗試使用通配符 `openssh*` 進行安裝 - 設定 `SSH` 服務 ``` { .bash title="允許 root 帳戶登入" } cat /etc/ssh/sshd_config | grep -Eq "^[# ]?PermitRootLogin " ; [ $? -eq 0 ] && sed -i 's/^[# ]\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config || echo -e "\nPermitRootLogin yes" >> /etc/ssh/sshd_config ``` ``` { .bash title="啟用密碼認證" } cat /etc/ssh/sshd_config | grep -Eq "^[# ]?PasswordAuthentication " ; [ $? -eq 0 ] && sed -i 's/^[# ]\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config || echo -e "\nPasswordAuthentication yes" >> /etc/ssh/sshd_config ``` - 啟動/重啟 `SSH` 服務 ``` bash for ssh_svc in sshd ssh openssh; do systemctl restart "${ssh_svc}" 2>/dev/null && break ; systemctl enable --now "${ssh_svc}" 2>/dev/null && break ; done ``` !!! tip "友情提示:如果你正在使用公網伺服器,建議關閉 SSH 密碼認證方式並設定金鑰登入。" - #### 關於未顯示方向鍵交互控制介面 !!! quote "" 如果發現互動介面是輸入而非新式的方向鍵控制,那麼請自行安裝 `ncurses` 或 `nano` 軟體包,新式的按鍵互動依賴 `tput` 指令實作。 - #### 關於未啟用的軟體源倉庫 !!! quote "" 許多系統的軟體源會啟用多個倉庫,腳本遵循系統預設設置,預設不啟用的軟體源(倉庫)不會在運行完本腳本後被啟用,但是它們也隨腳本更換了目標軟體源位址,具體啟用方法如下: === "Debian 系 / openKylin" 預設禁用了`deb-src`原始碼倉庫和`proposed`預發佈軟體源,若需啟用請將 `/etc/apt/sources.list` 文件中相關內容的所在行取消註釋 > `Debian`   `Ubuntu`   `Kali`   `Linux Mint`   `Deepin`   `Zorin OS`   `Armbian`   `Proxmox VE`   `Raspberry Pi OS`   `openKylin` === "RedHat 系 / openEuler / OpenCloudOS / Anolis OS" 部分倉庫預設沒有啟用,若需啟用請將 `/etc/yum.repos.d` 目錄下相關 repo 文件中的 `enabled` 值修改為 `1` > `Red Hat Enterprise Linux`   `CentOS`   `Rocky Linux`   `AlmaLinux`   `Fedora`   `openEuler`   `OpenCloudOS`   `Anolis OS` === "openSUSE" 部分倉庫預設沒有啟用,若需啟用請將 `/etc/zypp/repos.d` 目錄下相關 repo 文件中的 `enabled` 值修改為 `1` - #### 其它 ??? quote "關於呼叫腳本的互聯網位置" 專案利用 [GitHub Action](https://github.com/SuperManito/LinuxMirrors/blob/main/.github/workflows/build-docs.yml#L29) 在每次提交後自動拷貝原始碼到文件目錄作為網站資源發佈,網站託管於 [:netlify: Netlify](https://www.netlify.com),幾乎沒有使用風險。 當然你也可以使用程式碼託管倉庫的原始位址來調用,這裡只是想告訴你為什麼會有幾個不同的位址,預設的官網位址更容易記憶和訪問。 ??? quote "關於軟體源下載速度問題" 首先,在[軟體源列表](../mirrors/index.md)的使用幫助處有寫使用推薦,這是根據以往經驗總結出來的,但總有用戶在糾結軟體源速度的問題。 軟體源(鏡像站)的網路延遲即 `Ping` 與下載速度沒有太大的關聯,雙方地理位置間隔的遠近不代表實際體驗,有些鏡像站下行總頻寬很高但實際測速卻並不理想,因為這與鏡像站的負載策略有關。 網路上也有很多基於 C、Python 編寫的鏡像站測速開源腳本,而本專案腳本基於 Bash Shell 編寫且不依賴任何第三方庫,Bash 是 Linux 運維中最常用的腳本語言並且絕大部分發行版都會預裝,這意味著用戶不需要安裝任何環境就能直接運行,這種便利性是其他高級語言無法替代的,不過目前 Bash 腳本可能不太容易實現精準測速的功能,使用其它高級語言編寫測速功能無疑是造輪子的行為。 ??? quote "關於軟體源選優" 很多朋友可能都會有一個疑問:“既然腳本已經如此便捷且實現了高度自動化,為什麼不能實現軟體源自動選優呢?”,不是做不到而是不能。 「軟體源選優」 在這裡指的是腳本根據客戶端的網路環境、地理位置自動選擇一個體驗最佳的軟體源,這個問題要從多個角度來論證: - 速度方面 其實上面已經解釋過了,總結來說就是追求速度不是普遍需求,對大多數人來說是無感的、能用即可,況且現在很多 Linux 發行版不需要換源就有不錯的速度。 - 對於鏡像站本身 舉個最簡單的例子,以前阿里雲鏡像站因為速度快、可用性高幾乎被當成首選,但是隨著用戶越來越多導致速度變的原來越慢甚至可能不足 10 Mbps。 長此以往,那些用戶多的鏡像站可能無法承受過高的流量而導致體驗下降,用戶少的鏡像站可能會最終走向關閉,這不利於整個生態的發展。 - 開發者角度 本專案站在維運工具的角度致力於開發一個通用的換源腳本,而不是一個解決軟體源需求的具體化工具,要使腳本的預設行為適用於大多數使用者群體。作為維運工具要有明確的功能定位,作為腳本要從擴展性、實用性等多個方面去衡量利弊,軟體源的選擇權應該完全交給使用者。 --- ## 命令選項(進階用法) ``` $ bash <(curl -sSL https://linuxmirrors.cn/main.sh) --zh-hant --help 命令選項(名稱/含義/值): --abroad 使用境外以及海外軟體源 無 --edu 使用中國大陸教育網軟體源 無 --source 指定軟體源地址(網域名稱或IP) 位址 --source-epel 指定 EPEL 附加軟體包倉庫的軟體源地址(網域名稱或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) 位址 --branch 指定軟體源倉庫(路徑) 倉庫名稱 --branch-epel 指定 EPEL 附加軟體包倉庫的軟體源倉庫(路徑) 倉庫名稱 --branch-security 指定 Debian 系統 security 倉庫的軟體源倉庫(路徑) 倉庫名稱 --branch-vault 指定 CentOS / AlmaLinux 系統 vault 倉庫的軟體源倉庫(路徑) 倉庫名稱 --branch-portage 指定 Gentoo 系統 portage 倉庫的軟體源倉庫(路徑) 倉庫名稱 --branch-base-system 指定 Linux Mint / Raspberry Pi OS 底層系統的軟體源倉庫(路徑) 倉庫名稱 --codename 指定 Debian 系 / openKylin 系統的版本代號 代號名稱 --protocol 指定 Web 協定 http 或 https --use-intranet-source 是否優先使用內部網路軟體源位址 true 或 false --use-official-source 是否使用目標系統的官方軟體源 true 或 false --use-official-source-epel 是否使用 EPEL 附加軟體包的官方軟體源 true 或 false --install-epel 是否安裝 EPEL 附加軟體包 true 或 false --backup 是否備份原有軟體源 true 或 false --upgrade-software 是否更新軟體包 true 或 false --clean-cache 是否在更新軟體包後清理下載快取 true 或 false --clean-screen 是否在運行前清除螢幕上的所有內容 true 或 false --lang 指定腳本輸出的語言 语言 --only-epel 僅更換 EPEL 軟體源模式 無 --ignore-backup-tips 忽略覆蓋備份提示 無 --print-diff 是否列印原始文件修改前後差異 無 --pure-mode 純淨模式,精簡列印內容 無 --help 查看幫助選單 無 ``` | 名稱 | 含義 | 選項值 | | - | - | :-: | | `--abroad` | 使用境外以及海外軟體源 | 無 | | `--edu` | 使用中國大陸教育網軟體源 | 無 | | `--source` | 指定軟體源位址(網域名稱或IP) | `位址` | | `--source-epel` | 指定 EPEL 附加軟體包倉庫的軟體源位址(網域名稱或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) | `位址` | | `--branch` | 指定軟體源倉庫(路徑) | `倉庫名稱` | | `--branch-epel` | 指定 EPEL 附加軟體包倉庫的軟體源倉庫(路徑) | `倉庫名稱` | | `--branch-security` | 指定 Debian 係統 security 倉庫的軟體源倉庫(路徑) | `倉庫名稱` | | `--branch-vault` | 指定 CentOS / AlmaLinux 系統 vault 倉庫的軟體源倉庫(路徑) | `倉庫名稱` | | `--branch-portage` | 指定 Gentoo 系統 portage 倉庫的軟體源倉庫(路徑) | `倉庫名稱` | | `--branch-base-system` | 指定 Linux Mint / Raspberry Pi OS 底層系統的軟體源倉庫(路徑) | `倉庫名稱` | | `--codename` | 指定 Debian 系 / openKylin 作業系統的版本代號 | `代號名稱` | | `--protocol` | 指定 Web 協定 | `http` 或 `https` | | `--use-intranet-source` | 是否優先使用內部網路軟體源位址 | `true` 或 `false` | | `--use-official-source` | 是否使用目標作業系統的官方軟體源 | `true` 或 `false` | | `--use-official-source-epel` | 是否使用 EPEL 附加軟體包的官方軟體源 | `true` 或 `false` | | `--install-epel` | 是否安裝 EPEL 附加軟體包 | `true` 或 `false` | | `--backup` | 是否備份原有軟體源 | `true` 或 `false` | | `--upgrade-software` | 是否更新軟體套件 | `true` 或 `false` | | `--clean-cache` | 是否在更新軟體包後清理下載快取 | `true` 或 `false` | | `--clean-screen` | 是否在運行前清除螢幕上的所有內容 | `true` 或 `false` | | `--lang` | 指定腳本輸出的語言 | `語言ID(詳見下方文件)` | | `--only-epel` | 僅更換 EPEL 軟體源模式 | 無 | | `--ignore-backup-tips` | 忽略覆蓋備份提示(即不覆蓋備份) | 無 | | `--print-diff` | 是否列印原始文件修改前後差異 | 無 | | `--pure-mode` | 純淨模式,精簡列印內容 | 無 | | `--help` | 查看幫助選單 | 無 | > 軟體源完整格式 `://<軟體源位址(網域名稱或IP)>/<軟體源倉庫(路徑)>` 以下是一些進階用法的舉例 - ### 指定軟體源位址 ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/main.sh) --zh-hant --source mirror.example.com ``` - ### 指定軟體源倉庫目錄 這裡描述的軟體源倉庫與系統軟體倉庫不同,指的是軟體源(鏡像站)位址後面的路徑即鏡像站的倉庫目錄,雖然名義上都是倉庫但是非常容易混淆 主要使用情境:目標鏡像站有對應的系統鏡像倉庫但是不符合本專案腳本關於軟體源倉庫設定的預設規則 ??? note "專案對於各作業系統所使用的預設倉庫名稱(點選展開檢視)" 專案腳本為了適配大的環境不會針對某一鏡像站獨特的倉庫名稱而單獨適配 --8<-- "docs/use/repo-branchs.md" 請看下面的例子 ``` { .bash title="使用阿里雲鏡像站的 Rocky Linux 軟體源" } bash <(curl -sSL https://linuxmirrors.cn/main.sh) --zh-hant \ --source mirrors.aliyun.com \ --branch rockylinux ``` 阿里雲鏡像站的 Rocky Linux 倉庫目錄名稱為 [`rockylinux`](https://mirrors.aliyun.com/rockylinux),不符合預設規則 `rocky`,但是可以透過命令選項繞過腳本預設規則來實現。 > 部分系統會同時配置多個倉庫的軟體源,具體詳見命令選項 > 由於軟體源倉庫作用在軟體源位址上因此也可以使用多層路徑,例如 `--branch "linux/debian"` -> `https://mirrors.example.com/linux/debian` - ### 單獨更換 EPEL 源 !!! info "EPEL (Extra Packages for Enterprise Linux) 是由 Fedora 組織維護的一個附加軟體包倉庫,它主要適用於除 Fedora 作業系統以外的紅帽系 Linux 發行版,配置 EPEL 倉庫已成為廣大用戶的普遍需求,建議預設安裝它" 有些時候你會發現想使用的鏡像站沒有 EPEL 倉庫,那麼你可以在第一次運行腳本時不安裝或更換 EPEL 軟體源,然後再單獨執行下面的命令 ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --zh-hant --only-epel ``` 對於已經 EOL 的 EPEL 7,注意需要使用 [`archive`](https://dl.fedoraproject.org/pub/archive/epel) 倉庫,境外以及海外網絡環境建議通過命令選項 `--use-official-source-epel true` 使用官方源 - ### 恢復使用官方源 當你不小心刪除了官方軟體源的備份時可以使用此命令來恢復,使用此命令選項後將跳過選擇軟體源步驟 ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --zh-hant --use-official-source true ``` > 部分系統不存在官方軟體源例如 `Arch Linux`,屆時會自動更換成相容性較高的阿里雲鏡像站 - ### 特定係統的使用範例 - #### 關於 CentOS 停服問題 腳本對於已經 EOL 的 CentOS 7/8、CentOS Stream 8 進行了適配
- __中國大陸__ --- 正常使用腳本,沒有額外操作,因為大部分中國大陸鏡像站都已同步 [`CentOS Vault`](https://vault.centos.org) 倉庫 - __國際地區__ --- 建議使用 `騰訊雲` 或 `阿里雲` 鏡像站,或透過 `--use-official-source true` 命令選項使用官方軟體源
另外 EPEL 7 也進入了 EOL,腳本同樣對其進行了適配 - #### 指定 GNU/Linux Debian 作業系統的 Security 軟體源 如果你想盡可能提高伺服器的安全性建議使用官方軟體源,因為鏡像同步存在延遲 ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --zh-hant \ --source-security security.debian.org \ --branch-security debian-security ``` - #### 指定 Debian 系 Linux 作業系統的版本代號 大多數情況下自訂版本代號用於更換系統版本,請看下面的例子 === "升級 GNU/Linux Debian 至 13 "trixie"" - 更換版本代號 ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --zh-hant \ --codename trixie \ --upgrade-software false ``` - 停用 backports 倉庫 ``` bash sed -i '/backports/s/^/# /' /etc/apt/sources.list ``` - 升級系統 ``` bash apt-get update apt-get dist-upgrade ``` - 升級完成並重新引導系統後執行下列步驟 ``` bash # 清空原有軟體源(如有非系統軟體源內容請先自行手動備份) sed -i '1,$d' /etc/apt/sources.list # 重新執行換源腳本 bash <(curl -sSL https://linuxmirrors.cn/main.sh) --zh-hant ``` === "將 GNU/Linux Debian 的版本切換到測試分支" ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --zh-hant \ --codename testing \ --upgrade-software false ``` ``` { .bash .no-copy title="如果腳本無法實現指定版本代號,你也可以在執行腳本後手動替換" } sed -i "s/$(lsb_release -cs)/指定版本代號/g" /etc/apt/sources.list ``` - #### 更換 Ubuntu EOL版本軟體源 !!! info "EOL 為生命週期結束的縮寫(End Of Life),Ubuntu 迭代速度較快一般非LTS(長期支持)版本的生命週期只有9個月。官方會定期從主倉庫移除不在生命週期內的版本倉庫目錄,屆時可能就需要使用鏡像站的 `Ubuntu Old Releases` 倉庫" 具體版本支援情況詳見官方 [Wiki](https://documentation.ubuntu.com/project/release-team/list-of-releases/),關於 `Ubuntu Old Releases` 倉庫的支援情況詳見各鏡像站 ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --zh-hant \ --source mirrors.ustc.edu.cn \ --branch ubuntu-old-releases ``` - #### Arch Linux 使用中文社群倉庫 本專案腳本目前不支援此額外倉庫,因使用人數較少等原因暫不考慮適配,若想使用請參考下方的一鍵設定命令 ``` bash SOURCE="https://mirrors.aliyun.com/archlinuxcn" # 指定軟體源位址 grep -q "\[archlinuxcn\]" /etc/pacman.conf || echo -e "[archlinuxcn]\nServer = ${SOURCE}/\$arch" >>/etc/pacman.conf # 一鍵配置命令 ``` - ### 國際化(I18n) 腳本提供多語言支持,目前內建 `简体中文`、`繁體中文`、`English` 共三種顯示語言,預設為 `简体中文` - #### 指定語言 ``` { .bash .no-copy } bash <(curl -sSL https://linuxmirrors.cn/main.sh) --lang xxx ``` | 類型 | 值 | | :-: | :-: | | 简体中文 | `zh-hans` `zh-cn` `zh` | | 繁體中文 | `zh-hant` `zh-tw` `zh-hk` | | English | `en` `en-us` | 也可以直接作為指令選項使用 ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --en ``` > `--en` `--en-us` `--zh` `--zh-cn` `--zh-hans` `--zh-hant` - #### 透過互動進行選擇 ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --lang auto ``` - ### 無人值守(自動化) 不透過交互完成換源操作,至少需要使用以下命令選項來實現,建議熟悉後再使用 ``` { .bash .no-copy title="参考命令" } bash <(curl -sSL https://linuxmirrors.cn/main.sh) --zh-hant \ --source mirror.example.com \ --protocol http \ --use-intranet-source false \ --install-epel true \ --backup true \ --upgrade-software false \ --clean-cache false \ --ignore-backup-tips ``` > 如果報錯 `命令選項無效` 那麼請檢查選項合法性以及空格字元編碼,在範例中一行寫一個選項是為了提高命令的可讀性 - ### 純淨模式 推出此功能是為了方便開發以及运維人員使用,啟用後會精簡腳本內容輸出,建議搭配其它指令選項無互動使用 ``` bash bash <(curl -sSL https://linuxmirrors.cn/main.sh) --zh-hant --pure-mode ``` !!! tip "滾動輸出的命令日誌可能有無法預料的顯示問題,不過目前暫未發現異常" --- ## 精簡版(Lite) 額外提供一個精簡版本,是主腳本的複製,面向企業產品、開源專案使用,具有以下特性: - 單一顯示語言 `English`,無 I18n 國際化功能 - 預設使用官方來源,去除了互動選擇內建軟體源功能 - 去除了無關的列印內容 - 保留核心邏輯與指令選項設計 ``` bash bash <(curl -sSL https://linuxmirrors.cn/main-lite.sh) ``` > 請熟悉本項目後再使用,不建議新手使用者使用 --- ## 客製化腳本 如果你是其它專案的開發者希望透過本專案來製作專屬腳本,那麼請參考下面提到的內容,目前已經有中國大陸教育單位鏡像站的維護者這樣做了。 1. 首先不建議修改程式碼的底層邏輯,應盡量與本專案原始碼保持同步,腳本內容執行順序由 `main` 函數控制,程式碼邏輯清晰 2. 你可以簡單去除一些無關內容,例如將軟體源列表(陣列)`mirror_list_(default|edu|abroad|extranet|intranet)` 中的內容刪除,例如:`mirror_list_default=()` 3. 如果你想要自定義腳本列印內容可直接修改 `run_start` `run_end` `print_title` 這三個函數中的內容 4. 如果你想加入自定義 Shell 內容請參見 `main` 函數中腳本執行順序,可以在對應位置直接插入內容也可以封裝函數後調用 5. 如果你想要縮減腳本體積那麼可以刪除一些不必要的內容,除了上面提到的軟體源列表還有一些涉及腳本工作的部分模組內容,具體如下: 1. 首先在刪除內容時應盡可能保留腳本原始結構,直接把涉及函數中的內容刪除即可,使其保留為空函數 2. 可以刪除一些不使用(作業系統)的軟體源原始內容 `gen_repo_files_xxx`,這些內容佔據了腳本 `60%` 以上的體積 3. 如果你不使用某些功能,那麼可以刪除對應功能模組函數中的內容,`命令選項 handle_command_options`、`備份原有軟體源 backup_original_mirrors`、`更新軟體包 upgrade_software` 4. 移除不需要的語言包,例:`function msg_pack_en() { :; }` 6. 腳本主要功能配置是由統一的變量控制的,命令選項亦是如此,這些全局變量由全大寫字母構成並遵循下劃線命名法,具體變量詳見如下表格,你只需要將這些變量聲明在腳本頭部(預留註釋區域)即可快速完成定制 ??? note "變數列表(點擊展開查看)" | 名稱 | 含義 | 值型別 | | :-: | :-: | :-: | | `SOURCE` | 指定軟體源位址(網域名稱或IP) | `位址` | | `SOURCE_EPEL` | 指定 EPEL 附加軟體包倉庫的軟體源位址(網域名稱或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) | `位址` | | `SOURCE_BRANCH` | 指定軟體源倉庫(路徑) | `倉庫名稱` | | `SOURCE_EPEL_BRANCH` | 指定 EPEL 附加軟體套件倉庫的軟體源倉庫(路徑) | `倉庫名稱` | | `SOURCE_SECURITY_BRANCH` | 指定 Debian 系統 security 倉庫的軟體源倉庫(路徑) | `倉庫名稱` | | `SOURCE_VAULT_BRANCH` | 指定 CentOS / AlmaLinux 系統 vault 倉庫的軟體源倉庫(路徑) | `倉庫名稱` | | `SOURCE_PORTAGE_BRANCH` | 指定 Gentoo 系統 portage 倉庫的軟體源倉庫(路徑) | `倉庫名稱` | | `SOURCE_BASE_SYSTEM_BRANCH` | 指定 Linux Mint / Raspberry Pi OS 底層系統的軟體源倉庫(路徑) | `倉庫名稱` | | `DEBIAN_CODENAME` | 指定 Debian 系 / openKylin 作業系統的版本代號 | `代號名稱` | | `USE_INTRANET_SOURCE` | 是否優先使用內網軟體源位址 | `true` 或 `false` | | `USE_OFFICIAL_SOURCE` | 是否使用目標作業系統的官方軟體源 | `true` 或 `false` | | `USE_OFFICIAL_SOURCE_EPEL` | 是否使用 EPEL 附加軟體包的官方軟體源 | `true` 或 `false` | | `WEB_PROTOCOL` | 指定 Web 協定 | `http` 或 `https` | | `INSTALL_EPEL` | 是否安裝 EPEL 附加軟體包 | `true` 或 `false` | | `ONLY_EPEL` | 僅更換 EPEL 軟體源模式 | `true` 或 `false` | | `BACKUP` | 是否備份原有軟體源 | `true` 或 `false` | | `IGNORE_BACKUP_TIPS` | 忽略覆蓋備份提示(即不覆蓋備份) | `true` 或 `false` | | `UPGRADE_SOFTWARE` | 是否更新軟體包 | `true` 或 `false` | | `CLEAN_CACHE` | 是否在更新軟體包後清理下載快取 | `true` 或 `false` | | `CLEAN_SCREEN` | 是否在運行前清除螢幕上的所有內容 | `true` 或 `false` | | `PRINT_DIFF` | 是否列印原始檔案修改前後差異 | `true` 或 `false` | | `PURE_MODE` | 純淨模式,精簡列印內容 | `true` 或 `false` | > 部分變數存在預設值,未涉及的變數無需宣告為空值(空字串),另外如果對應功能配置不存在那麼就可能會出現交互 ================================================ FILE: docs/use/repo-branchs.md ================================================ | SYSTEM | NAMES | | --- | :---: | | Debian **Debian** | `debian` `debian-archive` | | Ubuntu **Ubuntu** | `ubuntu` `ubuntu-ports` | | Kali Linux **Kali Linux** | `kali` | | Linux Mint **Linux Mint** | `linuxmint` `ubuntu` `ubuntu-ports` `debian` | | Deepin **Deepin** | `deepin` | | Zorin OS **Zorin OS** | `ubuntu` `ubuntu-ports` | | Armbian **Armbian** | `armbian` | | Proxmox VE **Proxmox VE** | `proxmox` | | Raspberry Pi OS **Raspberry Pi OS** | `raspberrypi` `raspbian` `debian` `debian-archive` | | Red Hat Enterprise Linux **Red Hat Enterprise Linux** :material-information-outline:{ title="9 use CentOS Stream, 7~8 use CentOS" } | `centos` `centos-stream` `centos-altarch` `centos-vault` | | Fedora **Fedora** | `fedora` `fedora-archive` | | CentOS **CentOS** | `centos` `centos-stream` `centos-altarch` `centos-vault` | | Rocky Linux **Rocky Linux** | `rocky` | | AlmaLinux **AlmaLinux** | `almalinux` `almalinux-vault` | | Oracle Linux **Oracle Linux** | `centos-stream` | | openEuler **openEuler** | `openeuler` | | OpenCloudOS **OpenCloudOS** | `opencloudos` | | openKylin **openKylin** | `openkylin` | | Anolis OS **Anolis OS** | `anolis` | | openSUSE **openSUSE** | `opensuse` | | Arch Linux **Arch Linux** | `archlinux` `archlinuxarm` | | Manjaro **Manjaro** | `manjaro` | | EndeavourOS **EndeavourOS** | `endeavouros` | | Alpine Linux **Alpine Linux** | `alpine` | | Gentoo **Gentoo** | `gentoo` `gentoo-portage` | | NixOS **NixOS** | `nix-channels` | ================================================ FILE: docs/use/sitemap.en.xml ================================================ ================================================ FILE: docs/use/sitemap.xml ================================================ ================================================ FILE: docs/use/sitemap.zh-Hant.xml ================================================ ================================================ FILE: giscus.json ================================================ { "defaultCommentOrder": "newest" } ================================================ FILE: locales/docker/en.sh ================================================ MESSAGE_CONTENTS=( ['start.welcome']='Docker installation & mirror switcher' ['start.runtimeEnv']='Runtime Env' ['start.dateTime']='System Time' ['end.moreInfo']='Script execution completed, visit our website for more tutorials' ['end.sponsorAds']='[Sponsor Ads]' ['error.cmd.options.needConfirm']='Please confirm and re-enter' ['error.cmd.options.needSpecify']='Please specify {} after this option' ['error.cmd.options.invalid']='Command option {} is invalid, {}!' ['error.cmd.options.validAddress']='a valid address' ['error.cmd.options.sourceAddress']='mirror address' ['error.cmd.options.registryAddress']='registry mirror address' ['error.cmd.options.sourceRepository']='mirror repository' ['error.cmd.options.validVersion']='a valid version number' ['error.cmd.options.ceRepositoryVersion']='Docker CE mirror repository version' ['error.cmd.options.version']='version number' ['error.cmd.options.codename']='version codename' ['error.cmd.options.boolean']=' true or false ' ['error.cmd.options.protocol']=' http or https ' ['error.cmd.options.needProtocol']=' Web protocol(http/https)' ['error.cmd.options.validLangKey']='A valid language ID ' ['error.cmd.options.langKey']='language ID ' ['error.unsupportSystem1']='Unsupported operating system ({})' ['error.unsupportSystem2']='Unsupported operating system ({}), please install manually with commands:' ['error.unknownSystem']='Unknown system' ['error.unsupportX86_32']='Docker Engine does not support installation on x86_32 architecture!' ['error.unknownArch']='Unknown system architecture: {}' ['error.unsupportS390x']='Please refer to RHEL distribution announcement for s390x support' ['error.input']='Input error, {}!' ['error.needRoot']='Insufficient privileges, please run this script as root. Switch command: {}' ['error.sync']='{} failed. Please fix system software sources (package repositories) so the {} package manager is available!' ['error.downloadGPG']='GPG key download failed, please check network or switch Docker CE mirror and retry!' ['error.queryVersionFailed']='Failed to query Docker Engine version list!' ['error.designatedVersion']='Specified Docker Engine version does not exist or is not supported for installation!' ['error.invalidVersion']='Please enter a valid version number!' ['error.reEnter']='Input error, please re-enter!' ['error.installDockerEngineFailed']='Docker Engine installation failed!' ['error.installPackageFailed']='Package {} installation failed, please install manually and rerun script!' ['error.defaultBehavior.https']='Using HTTPS protocol by default' ['error.defaultBehavior.noClose']='Not closing by default' ['error.defaultBehavior.installLatest']='Installing latest version by default' ['error.defaultBehavior.noOverwrite']='Not overwriting by default' ['error.defaultBehavior.noUseIntranetSource']='Not using intranet address by default' ['warn.usedIntranetSource']='Switched to intranet-only address, use only in specific environments!' ['warn.needValidNumberIndex']='Please enter a valid number index!' ['warn.needInputNumberIndex']='Please enter a number index!' ['warn.needManuallyDeleteConfig']='Please manually delete {} configuration in {} and restart service {}' ['tip.skipInstallDockerEngine']='Detected Docker Engine is already installed with latest version, skipping installation' ['info.backuped.dockerConfig']='Original Docker config file has been backed up' ['interaction.source.type.public']='Public' ['interaction.source.type.intranet']='Intranet' ['interaction.source.type.select']='Please select network address (access method) for Docker CE mirror:' ['interaction.source.type.usePublicAddress']='Use public network address for Docker CE mirror by default, continue' ['interaction.source.dockerCE.select']='Please select the Docker CE mirror you want to use:' ['interaction.source.dockerCE.selectAndInput']='Please select and enter the Docker CE mirror you want to use' ['interaction.source.dockerRegistry.select']='Please select the Docker Registry mirror you want to use:' ['interaction.source.dockerRegistry.selectAndInput']='Please select and enter the Docker Registry mirror you want to use' ['interaction.protocol.select']='Please select network protocol for Docker CE mirror:' ['interaction.protocol.useHttp']='Use HTTP protocol for Docker CE mirror' ['interaction.firewall.close']='Close system firewall and SELinux' ['interaction.install.selectVersion']='Please select the version you want to install:' ['interaction.install.selectedVersion']='Specified installation version:' ['interaction.install.selectedTitle']='Please select the version to install, e.g.: {}' ['interaction.install.inputVersion']='Based on the list above, please select and enter the specific version you want to install:' ['interaction.install.latestVersion']='Install latest version of Docker Engine' ['interaction.backup.skipOverwrite']='Detected existing backup of Docker config file, skip overwriting backup' ['interaction.common.tip']='Tip' ['interaction.common.operationCanceled']='Operation canceled' ['interaction.common.yes']='Yes' ['interaction.common.no']='No' ['work.installDependents']='Install environment packages' ['work.installDockerEngine']='Install Docker Engine' ['source.sync.text1']='Update APT package index' ['source.sync.text2']='Generate mirror cache' ['result.install.failed']='Installation failed' ['result.install.checkSourceFile']='Check source file:' ['result.install.manuallyExecCmd']='Please try manually executing installation command: {}' ['result.install.notRunning']='Detected Docker service startup error, try running this script again' ['result.install.manuallyRun']='Please execute {} command to try starting or investigate error cause' ['result.registry.success']='Registry mirror replaced successfully' ['result.registry.dockerEngineNotExsit']='Docker Engine is not installed yet, please remove {} command option and rerun script!' ['commands.help']='Command options(name/meaning/value): --source Specify Docker CE mirror address (domain or IP) address --source-registry Specify Docker Registry mirror address (domain or IP) address --branch Specify Docker CE mirror repository (path) repo name --branch-version Specify Docker CE mirror repository version version --designated-version Specify Docker Engine installation version version --codename Specify Debian-based OS codename codename --protocol Specify Web protocol for Docker CE mirror http or https --use-intranet-source Prefer intranet Docker CE mirror address true or false --install-latest Whether to install the latest Docker Engine true or false --close-firewall Whether to disable the firewall true or false --clean-screen Whether to clear the screen before running true or false --lang Specify the language of the script output language --only-registry Only switch registry mirror mode none --ignore-backup-tips Ignore backup overwrite prompt (do not backup) none --pure-mode Pure mode, minimal output none --help Show help menu none Issue Report {}' ['mirrors.dockerCE.0']='Alibaba Cloud' ['mirrors.dockerCE.1']='Tencent Cloud' ['mirrors.dockerCE.2']='Huawei Cloud' ['mirrors.dockerCE.3']='China Mobile Cloud' ['mirrors.dockerCE.4']='NetEase' ['mirrors.dockerCE.5']='Volcengine' ['mirrors.dockerCE.6']='Microsoft Azure China' ['mirrors.dockerCE.7']='Tsinghua University' ['mirrors.dockerCE.8']='Peking University' ['mirrors.dockerCE.9']='Zhejiang University' ['mirrors.dockerCE.10']='Nanjing University' ['mirrors.dockerCE.11']='Shanghai Jiao Tong University' ['mirrors.dockerCE.12']='Chongqing University of Posts and Telecommunications' ['mirrors.dockerCE.13']='University of Science and Technology of China' ['mirrors.dockerCE.14']='Institute of Software, Chinese Academy of Sciences' ['mirrors.dockerCE.15']='Official Source' ['mirrors.registry.0']='Millisecond Mirror (recommended)' ['mirrors.registry.1']='Docker Proxy' ['mirrors.registry.2']='DaoCloud' ['mirrors.registry.3']='1Panel Mirror' ['mirrors.registry.4']='Alibaba Cloud (Hangzhou)' ['mirrors.registry.5']='Alibaba Cloud (Shanghai)' ['mirrors.registry.6']='Alibaba Cloud (Qingdao)' ['mirrors.registry.7']='Alibaba Cloud (Beijing)' ['mirrors.registry.8']='Alibaba Cloud (Zhangjiakou)' ['mirrors.registry.9']='Alibaba Cloud (Hohhot)' ['mirrors.registry.10']='Alibaba Cloud (Ulanqab)' ['mirrors.registry.11']='Alibaba Cloud (Shenzhen)' ['mirrors.registry.12']='Alibaba Cloud (Heyuan)' ['mirrors.registry.13']='Alibaba Cloud (Guangzhou)' ['mirrors.registry.14']='Alibaba Cloud (Chengdu)' ['mirrors.registry.15']='Alibaba Cloud (Hong Kong)' ['mirrors.registry.16']='Alibaba Cloud (Japan - Tokyo)' ['mirrors.registry.17']='Alibaba Cloud (Singapore)' ['mirrors.registry.18']='Alibaba Cloud (Malaysia - Kuala Lumpur)' ['mirrors.registry.19']='Alibaba Cloud (Indonesia - Jakarta)' ['mirrors.registry.20']='Alibaba Cloud (Germany - Frankfurt)' ['mirrors.registry.21']='Alibaba Cloud (UK - London)' ['mirrors.registry.22']='Alibaba Cloud (US West - Silicon Valley)' ['mirrors.registry.23']='Alibaba Cloud (US East - Virginia)' ['mirrors.registry.24']='Alibaba Cloud (UAE - Dubai)' ['mirrors.registry.25']='Tencent Cloud' ['mirrors.registry.26']='Google Cloud (North America)' ['mirrors.registry.27']='Google Cloud (Asia)' ['mirrors.registry.28']='Google Cloud (Europe)' ['mirrors.registry.29']='Official Docker Hub' ) ================================================ FILE: locales/docker/zh-hans.sh ================================================ MESSAGE_CONTENTS=( ['start.welcome']='欢迎使用 Docker Engine 安装与换源脚本' ['start.runtimeEnv']='运行环境' ['start.dateTime']='系统时间' ['end.moreInfo']='脚本运行完毕,更多使用教程详见官网' ['end.sponsorAds']='【赞助商广告】' ['error.cmd.options.needConfirm']='请确认后重新输入' ['error.cmd.options.needSpecify']='请在该选项后指定{}' ['error.cmd.options.invalid']='命令选项 {} 无效,{}!' ['error.cmd.options.validAddress']='有效的地址' ['error.cmd.options.sourceAddress']='软件源地址' ['error.cmd.options.registryAddress']='镜像仓库地址' ['error.cmd.options.sourceRepository']='软件源仓库' ['error.cmd.options.validVersion']='有效的版本号' ['error.cmd.options.ceRepositoryVersion']='Docker CE 软件源仓库的版本号' ['error.cmd.options.version']='版本号' ['error.cmd.options.codename']='版本代号' ['error.cmd.options.boolean']=' true 或 false ' ['error.cmd.options.protocol']=' http 或 https ' ['error.cmd.options.needProtocol']=' Web 协议(http/https)' ['error.cmd.options.validLangKey']='有效的语言 ID ' ['error.cmd.options.langKey']='语言 ' ['error.unsupportSystem1']='不支持当前操作系统({})' ['error.unsupportSystem2']='不支持当前操作系统({}),请参考如下命令自行安装:' ['error.unknownSystem']='未知系统' ['error.unsupportX86_32']='Docker Engine 不支持安装在 x86_32 架构的环境上!' ['error.unknownArch']='未知的系统架构:{}' ['error.unsupportS390x']='请查阅 RHEL 发行版声明以了解 s390x 支持' ['error.input']='输入错误,{}!' ['error.needRoot']='权限不足,请切换至 root 账户后运行本脚本,切换命令 {}' ['error.sync']='{}出错,请先解决系统原有软件源错误以确保 {} 软件包管理工具可用!' ['error.downloadGPG']='GPG 密钥下载失败,请检查网络或更换 Docker CE 软件源后重试!' ['error.queryVersionFailed']='查询 Docker Engine 版本列表失败!' ['error.designatedVersion']='指定的 Docker Engine 版本不存在或不支持安装!' ['error.invalidVersion']='请输入正确的版本号!' ['error.reEnter']='输入错误请重新输入!' ['error.installDockerEngineFailed']='安装 Docker Engine 失败!' ['error.installPackageFailed']='软件包 {} 安装失败,请自行安装后重新运行脚本!' ['error.defaultBehavior.https']='默认使用 HTTPS 协议' ['error.defaultBehavior.noClose']='默认不关闭' ['error.defaultBehavior.installLatest']='默认安装最新版本' ['error.defaultBehavior.noOverwrite']='默认不覆盖' ['error.defaultBehavior.noUseIntranetSource']='默认不使用内网地址' ['warn.usedIntranetSource']='已切换至内网专用地址,仅限在特定环境下使用!' ['warn.needValidNumberIndex']='请输入有效的数字序号!' ['warn.needInputNumberIndex']='请输入数字序号!' ['warn.needManuallyDeleteConfig']='请自行删除 {} 中的 {} 配置并重启服务 {}' ['tip.skipInstallDockerEngine']='检测到系统已安装 Docker Engine 且是最新版本,跳过安装' ['info.backuped.dockerConfig']='已备份原有 Docker 配置文件' ['interaction.source.type.public']='公网' ['interaction.source.type.intranet']='内网' ['interaction.source.type.select']='请选择 Docker CE 源的网络地址(访问方式):' ['interaction.source.type.usePublicAddress']='默认使用 Docker CE 源的公网地址,是否继续' ['interaction.source.dockerCE.select']='请选择你想使用的 Docker CE 源:' ['interaction.source.dockerCE.selectAndInput']='请选择并输入你想使用的 Docker CE 源' ['interaction.source.dockerRegistry.select']='请选择你想使用的 Docker Registry 源:' ['interaction.source.dockerRegistry.selectAndInput']='请选择并输入你想使用的 Docker Registry 源' ['interaction.protocol.select']='请选择 Docker CE 软件源的网络协议:' ['interaction.protocol.useHttp']='Docker CE 软件源是否使用 HTTP 协议' ['interaction.firewall.close']='是否关闭系统防火墙和 SELinux ' ['interaction.install.selectVersion']='请选择你想安装的版本:' ['interaction.install.selectedVersion']='指定安装版本:' ['interaction.install.selectedTitle']='请选择你要安装的版本,如:{}' ['interaction.install.inputVersion']='请根据上面的列表,选择并输入你想要安装的具体版本号:' ['interaction.install.latestVersion']='Docker Engine 是否安装最新版本' ['interaction.backup.skipOverwrite']='检测到已备份的 Docker 配置文件,是否跳过覆盖备份' ['interaction.common.tip']='提示' ['interaction.common.operationCanceled']='操作已取消' ['interaction.common.yes']='是' ['interaction.common.no']='否' ['work.installDependents']='安装环境软件包' ['work.installDockerEngine']='安装 Docker Engine' ['source.sync.text1']='更新软件源' ['source.sync.text2']='生成软件源缓存' ['result.install.failed']='安装失败' ['result.install.checkSourceFile']='检查源文件:' ['result.install.manuallyExecCmd']='请尝试手动执行安装命令:{}' ['result.install.notRunning']='检测到 Docker 服务启动异常,可尝试再次执行本脚本重试' ['result.install.manuallyRun']='请执行 {} 命令尝试启动或自行查询错误原因' ['result.registry.success']='已更换镜像仓库' ['result.registry.dockerEngineNotExsit']='当前尚未安装 Docker Engine,请取消设置 {} 命令选项后重新执行脚本!' ['commands.help']='命令选项(名称/含义/值): --source 指定 Docker CE 软件源地址(域名或IP) 地址 --source-registry 指定 Docker 镜像仓库地址(域名或IP) 地址 --branch 指定 Docker CE 软件源仓库(路径) 仓库名 --branch-version 指定 Docker CE 软件源仓库版本 版本号 --designated-version 指定 Docker Engine 安装版本 版本号 --codename 指定 Debian 系操作系统的版本代号 代号名称 --protocol 指定 Docker CE 软件源的 Web 协议 http 或 https --use-intranet-source 是否优先使用内网 Docker CE 软件源地址 true 或 false --install-latest 是否安装最新版本的 Docker Engine true 或 false --close-firewall 是否关闭防火墙 true 或 false --clean-screen 是否在运行前清除屏幕上的所有内容 true 或 false --lang 指定脚本使用的语言 ID 语言 --only-registry 仅更换镜像仓库模式 无 --ignore-backup-tips 忽略覆盖备份提示 无 --pure-mode 纯净模式,精简打印内容 无 --help 查看帮助菜单 无 问题报告 {}' ['mirrors.dockerCE.0']='阿里云' ['mirrors.dockerCE.1']='腾讯云' ['mirrors.dockerCE.2']='华为云' ['mirrors.dockerCE.3']='移动云' ['mirrors.dockerCE.4']='网易' ['mirrors.dockerCE.5']='火山引擎' ['mirrors.dockerCE.6']='微软 Azure 中国' ['mirrors.dockerCE.7']='清华大学' ['mirrors.dockerCE.8']='北京大学' ['mirrors.dockerCE.9']='浙江大学' ['mirrors.dockerCE.10']='南京大学' ['mirrors.dockerCE.11']='上海交通大学' ['mirrors.dockerCE.12']='重庆邮电大学' ['mirrors.dockerCE.13']='中国科学技术大学' ['mirrors.dockerCE.14']='中国科学院软件研究所' ['mirrors.dockerCE.15']='官方源' ['mirrors.registry.0']='毫秒镜像(推荐)' ['mirrors.registry.1']='Docker Proxy' ['mirrors.registry.2']='DaoCloud 道客' ['mirrors.registry.3']='1Panel 镜像' ['mirrors.registry.4']='阿里云(杭州)' ['mirrors.registry.5']='阿里云(上海)' ['mirrors.registry.6']='阿里云(青岛)' ['mirrors.registry.7']='阿里云(北京)' ['mirrors.registry.8']='阿里云(张家口)' ['mirrors.registry.9']='阿里云(呼和浩特)' ['mirrors.registry.10']='阿里云(乌兰察布)' ['mirrors.registry.11']='阿里云(深圳)' ['mirrors.registry.12']='阿里云(河源)' ['mirrors.registry.13']='阿里云(广州)' ['mirrors.registry.14']='阿里云(成都)' ['mirrors.registry.15']='阿里云(香港)' ['mirrors.registry.16']='阿里云(日本-东京)' ['mirrors.registry.17']='阿里云(新加坡)' ['mirrors.registry.18']='阿里云(马来西亚-吉隆坡)' ['mirrors.registry.19']='阿里云(印度尼西亚-雅加达)' ['mirrors.registry.20']='阿里云(德国-法兰克福)' ['mirrors.registry.21']='阿里云(英国-伦敦)' ['mirrors.registry.22']='阿里云(美国西部-硅谷)' ['mirrors.registry.23']='阿里云(美国东部-弗吉尼亚)' ['mirrors.registry.24']='阿里云(阿联酋-迪拜)' ['mirrors.registry.25']='腾讯云' ['mirrors.registry.26']='谷歌云(北美)' ['mirrors.registry.27']='谷歌云(亚洲)' ['mirrors.registry.28']='谷歌云(欧洲)' ['mirrors.registry.29']='官方 Docker Hub' ) ================================================ FILE: locales/docker/zh-hant.sh ================================================ MESSAGE_CONTENTS=( ['start.welcome']='歡迎使用 Docker Engine 安裝與換源腳本' ['start.runtimeEnv']='執行環境' ['start.dateTime']='系統時間' ['end.moreInfo']='腳本執行完畢,更多使用教學詳見官網' ['end.sponsorAds']='【贊助商廣告】' ['error.cmd.options.needConfirm']='請確認後重新輸入' ['error.cmd.options.needSpecify']='請在該選項後指定{}' ['error.cmd.options.invalid']='命令選項 {} 無效,{}!' ['error.cmd.options.validAddress']='有效的位址' ['error.cmd.options.sourceAddress']='軟體源位址' ['error.cmd.options.registryAddress']='映象倉庫位址' ['error.cmd.options.sourceRepository']='軟體源倉庫' ['error.cmd.options.validVersion']='有效的版本號' ['error.cmd.options.ceRepositoryVersion']='Docker CE 軟體源倉庫的版本號' ['error.cmd.options.version']='版本號' ['error.cmd.options.codename']='版本代號' ['error.cmd.options.boolean']=' true 或 false ' ['error.cmd.options.protocol']=' http 或 https ' ['error.cmd.options.needProtocol']=' Web 協定(http/https)' ['error.cmd.options.validLangKey']='有效的語言 ID ' ['error.cmd.options.langKey']='語言 ID ' ['error.unsupportSystem1']='不支援當前作業系統({})' ['error.unsupportSystem2']='不支援當前作業系統({}),請參考如下命令自行安裝:\n\n{}' ['error.unknownSystem']='未知系統' ['error.unsupportX86_32']='Docker Engine 不支援安裝在 x86_32 架構的環境上!' ['error.unknownArch']='未知的系統架構:{}' ['error.unsupportS390x']='請查閱 RHEL 發行版宣告以瞭解 s390x 支援' ['error.input']='輸入錯誤,{}!' ['error.needRoot']='權限不足,請切換至 root 帳戶後執行本腳本,切換指令 {}' ['error.sync']='{}出錯,請先解決系統原有軟體源錯誤以確保 {} 軟體包管理工具可用!' ['error.downloadGPG']='GPG 金鑰下載失敗,請檢查網路或更換 Docker CE 軟體源後重試!' ['error.queryVersionFailed']='查詢 Docker Engine 版本清單失敗!' ['error.designatedVersion']='指定的 Docker Engine 版本不存在或不支援安裝!' ['error.invalidVersion']='請輸入正確的版本號!' ['error.reEnter']='輸入錯誤請重新輸入!' ['error.installDockerEngineFailed']='安裝 Docker Engine 失敗!' ['error.installPackageFailed']='軟體包 {} 安裝失敗,請自行安裝後重新執行腳本!' ['error.defaultBehavior.https']='預設使用 HTTPS 協定' ['error.defaultBehavior.noClose']='預設不關閉' ['error.defaultBehavior.installLatest']='預設安裝最新版本' ['error.defaultBehavior.noOverwrite']='預設不覆寫' ['error.defaultBehavior.noUseIntranetSource']='預設不使用內網位址' ['warn.usedIntranetSource']='已切換至內網專用位址,僅限在特定環境下使用!' ['warn.needValidNumberIndex']='請輸入有效的數字序號!' ['warn.needInputNumberIndex']='請輸入數字序號!' ['warn.needManuallyDeleteConfig']='請自行刪除 {} 中的 {} 設定並重新啟動服務 {}' ['tip.skipInstallDockerEngine']='偵測到系統已安裝 Docker Engine 且是最新版本,跳過安裝' ['info.backuped.dockerConfig']='已備份原有 Docker 設定檔' ['interaction.source.type.public']='公網' ['interaction.source.type.intranet']='內網' ['interaction.source.type.select']='請選擇 Docker CE 源的網路位址(存取方式):' ['interaction.source.type.usePublicAddress']='預設使用 Docker CE 源的公網位址,是否繼續' ['interaction.source.dockerCE.select']='請選擇你想使用的 Docker CE 源:' ['interaction.source.dockerCE.selectAndInput']='請選擇並輸入你想使用的 Docker CE 源' ['interaction.source.dockerRegistry.select']='請選擇你想使用的 Docker Registry 源:' ['interaction.source.dockerRegistry.selectAndInput']='請選擇並輸入你想使用的 Docker Registry 源' ['interaction.protocol.select']='請選擇 Docker CE 軟體源的網路協定:' ['interaction.protocol.useHttp']='Docker CE 軟體源是否使用 HTTP 協定' ['interaction.firewall.close']='是否關閉系統防火牆和 SELinux ' ['interaction.install.selectVersion']='請選擇你想安裝的版本:' ['interaction.install.selectedVersion']='指定安裝版本:' ['interaction.install.selectedTitle']='請選擇你要安裝的版本,如:{}' ['interaction.install.inputVersion']='請根據上面的清單,選擇並輸入你想要安裝的具體版本號:' ['interaction.install.latestVersion']='Docker Engine 是否安裝最新版本' ['interaction.backup.skipOverwrite']='偵測到已備份的 Docker 設定檔,是否跳過覆寫備份' ['interaction.common.tip']='提示' ['interaction.common.operationCanceled']='操作已取消' ['interaction.common.yes']='是' ['interaction.common.no']='否' ['work.installDependents']='安裝環境軟體包' ['work.installDockerEngine']='安裝 Docker Engine' ['source.sync.text1']='更新軟體源' ['source.sync.text2']='產生軟體源快取' ['result.install.failed']='安裝失敗' ['result.install.checkSourceFile']='檢查源檔案:' ['result.install.manuallyExecCmd']='請嘗試手動執行安裝命令:{}' ['result.install.notRunning']='偵測到 Docker 服務啟動異常,可嘗試再次執行本腳本重試' ['result.install.manuallyRun']='請執行 {} 命令嘗試啟動或自行查詢錯誤原因' ['result.registry.success']='已更換映象倉庫' ['result.registry.dockerEngineNotExsit']='目前尚未安裝 Docker Engine,請取消設定 {} 命令選項後重新執行腳本!' ['commands.help']='命令選項(名稱/含義/值): --source 指定 Docker CE 軟體源位址(網域名稱或IP) 位址 --source-registry 指定 Docker 映像倉庫位址 (網域名稱或IP) 位址 --branch 指定 Docker CE 軟體源倉庫 (路徑) 倉庫名稱 --branch-version 指定 Docker CE 軟體源倉庫版本 版本號 --designated-version 指定 Docker Engine 安裝版本 版本號 --codename 指定 Debian 係作業系統的版本代號 代號名稱 --protocol 指定 Docker CE 源的 Web 協定 http 或 https --use-intranet-source 是否優先使用內部網路 Docker CE 軟體源位址 true 或 false --install-latest 是否安裝最新版本的 Docker Engine true 或 false --close-firewall 是否關閉防火牆 true 或 false --clean-screen 是否在運行前清除螢幕上的所有內容 true 或 false --lang 指定腳本輸出的語言 语言 --only-registry 僅更換映像倉庫模式 無 --ignore-backup-tips 忽略覆蓋備份提示 無 --pure-mode 純淨模式,精簡列印內容 無 --help 查看幫助選單 無 問題報告 {}' ['mirrors.dockerCE.0']='阿里雲' ['mirrors.dockerCE.1']='騰訊雲' ['mirrors.dockerCE.2']='華為雲' ['mirrors.dockerCE.3']='移動雲' ['mirrors.dockerCE.4']='網易' ['mirrors.dockerCE.5']='火山引擎' ['mirrors.dockerCE.6']='微軟 Azure 中國' ['mirrors.dockerCE.7']='清華大學' ['mirrors.dockerCE.8']='北京大學' ['mirrors.dockerCE.9']='浙江大學' ['mirrors.dockerCE.10']='南京大學' ['mirrors.dockerCE.11']='上海交通大學' ['mirrors.dockerCE.12']='重慶郵電大學' ['mirrors.dockerCE.13']='中國科學技術大學' ['mirrors.dockerCE.14']='中國科學院軟體研究所' ['mirrors.dockerCE.15']='官方源' ['mirrors.registry.0']='毫秒鏡像(推薦)' ['mirrors.registry.1']='Docker Proxy' ['mirrors.registry.2']='DaoCloud 道客' ['mirrors.registry.3']='1Panel 鏡像' ['mirrors.registry.4']='阿里雲(杭州)' ['mirrors.registry.5']='阿里雲(上海)' ['mirrors.registry.6']='阿里雲(青島)' ['mirrors.registry.7']='阿里雲(北京)' ['mirrors.registry.8']='阿里雲(張家口)' ['mirrors.registry.9']='阿里雲(呼和浩特)' ['mirrors.registry.10']='阿里雲(烏蘭察布)' ['mirrors.registry.11']='阿里雲(深圳)' ['mirrors.registry.12']='阿里雲(河源)' ['mirrors.registry.13']='阿里雲(廣州)' ['mirrors.registry.14']='阿里雲(成都)' ['mirrors.registry.15']='阿里雲(香港)' ['mirrors.registry.16']='阿里雲(日本-東京)' ['mirrors.registry.17']='阿里雲(新加坡)' ['mirrors.registry.18']='阿里雲(馬來西亞-吉隆坡)' ['mirrors.registry.19']='阿里雲(印度尼西亞-雅加達)' ['mirrors.registry.20']='阿里雲(德國-法蘭克福)' ['mirrors.registry.21']='阿里雲(英國-倫敦)' ['mirrors.registry.22']='阿里雲(美國西部-矽谷)' ['mirrors.registry.23']='阿里雲(美國東部-弗吉尼亞)' ['mirrors.registry.24']='阿里雲(阿聯酋-迪拜)' ['mirrors.registry.25']='騰訊雲' ['mirrors.registry.26']='谷歌雲(北美)' ['mirrors.registry.27']='谷歌雲(亞洲)' ['mirrors.registry.28']='谷歌雲(歐洲)' ['mirrors.registry.29']='官方 Docker Hub' ) ================================================ FILE: locales/linux/en.sh ================================================ MESSAGE_CONTENTS=( ['start.welcome']=' GNU/Linux mirror switching script' ['start.runtimeEnv']='Runtime Env' ['start.dateTime']='System Time' ['end.moreInfo']='Script execution completed, visit our website for more tutorials' ['end.sponsorAds']='[Sponsor Ads]' ['error.cmd.options.needConfirm']='Please confirm and re-enter' ['error.cmd.options.needSpecify']='Please specify {} after this option' ['error.cmd.options.invalid']='Command option {} is invalid, {}!' ['error.cmd.options.validAddress']='a valid address' ['error.cmd.options.sourceAddress']='mirror address' ['error.cmd.options.sourceRepository']='mirror repository' ['error.cmd.options.codename']='version codename' ['error.cmd.options.boolean']=' true or false ' ['error.cmd.options.protocol']=' http or https ' ['error.cmd.options.needProtocol']=' Web protocol(http/https)' ['error.cmd.options.validLangKey']='A valid language ID ' ['error.cmd.options.langKey']='language ID ' ['error.cmd.options.unsupportTwoSourceMode']='Two mirror modes cannot be used at the same time. Please retry!' ['error.cmd.options.unsupportCodename']='The current system does not support specifying a codename. Please retry!' ['error.cmd.options.unsupportEPEL']='The current system cannot install the EPEL add-on package. Please retry!' ['error.unsupportSystem']='The operating system ({}) is not supported. Check the supported list on the website!' ['error.unsupportVersion']='The current system version is not supported' ['error.unknownSystem']='Unknown system' ['error.unknownVersion']='System version unknown' ['error.input']='Input error, {}!' ['error.needRoot']='Insufficient privileges, please run this script as root. Switch command: {}' ['error.defaultBehavior.https']='HTTPS is used by default' ['error.defaultBehavior.noReplace']='No replacement by default' ['error.defaultBehavior.noOverwrite']='No overwrite by default' ['error.defaultBehavior.noUpdate']='No update by default' ['error.defaultBehavior.noClean']='No cleanup by default' ['error.defaultBehavior.noUseIntranetSource']='Intranet mirrors are disabled by default' ['warn.usedIntranetSource']='Switched to an intranet-only mirror. Use only in the intended environment!' ['warn.unstableDebian']='Detected system version {} which may cause unpredictable issues.' ['warn.EPEL7']='Extra Packages for Enterprise Linux 7 reached end-of-life and was moved to the archive!' ['warn.needValidNumberIndex']='Please enter a valid number index!' ['warn.needInputNumberIndex']='Please enter a number index!' ['info.backuped.sourceFile']='Backed up existing {} source file' ['tip.EPEL7']="Some mirrors don't sync that archive. If errors occur, verify the target mirror provides it." ['interaction.source.type.public']='Public' ['interaction.source.type.intranet']='Intranet' ['interaction.source.type.select']='Please select network address (access method) for mirror:' ['interaction.source.type.usePublicAddress']='Use public network address for mirror by default, continue' ['interaction.source.select']='Please select the mirror you want to use:' ['interaction.source.selectAndInput']='Please select and enter the mirror you want to use' ['interaction.protocol.select']='Please select network protocol for mirror:' ['interaction.protocol.useHttp']='Use HTTP protocol for mirror' ['interaction.epel.skipReplace']='EPEL already installed. Replace/overwrite mirror' ['interaction.epel.install']='Install EPEL add-on package' ['interaction.backup.skipOverwrite.sourceFile']='A backup of {} already exists. Skip overwriting' ['interaction.upgrade.skip']='Skip upgrading packages' ['interaction.cache.autoClean']='Clean download cache after upgrading packages' ['interaction.common.tip']='Tip' ['interaction.common.operationCanceled']='Operation canceled' ['interaction.common.yes']='Yes' ['interaction.common.no']='No' ['work.upgradeSoftware']='Upgrading packages' ['work.installEPELPackage']='Installing epel-release package...' ['source.sync.text1']='Update APT package index' ['source.sync.text2']='Generate mirror cache' ['source.sync.text3']='Refreshing mirrors' ['source.sync.text4']='Synchronizing mirrors' ['source.sync.text5']='Updating binary cache and channels' ['source.comment.disabledSourceCode']='Source code mirrors are disabled by default for speed. Uncomment to enable' ['source.comment.securitySource']='Security updates' ['source.comment.proposedSource']='Proposed repository (not recommended)' ['source.changeResult.success']='Mirror switching complete' ['source.changeResult.fail']='Mirror switching complete, but {} failed' ['source.changeResult.tipTitle']='Run the script again with the same mirror. If {} still fails, consider:' ['source.changeResult.tip1']='Connectivity issues: unstable network, blocked access, or mirror-side firewall rules' ['source.changeResult.tip2']='Mirror issues: test the mirror manually at {}' ['source.changeResult.tip2.1']='If a file is missing, the mirror might still be syncing' ['source.changeResult.tip2.2']='If a path is missing, the mirror may not provide this system repository' ['source.changeResult.tip2.3']='Try another mirror. Syncing mirrors may temporarily serve broken content' ['source.changeResult.tip3']='Original mirrors failing: fix unrelated mirror errors and rerun the script' ['commands.help']='Command options(name/meaning/value): --abroad Use overseas mirrors none --edu Use China education network mirrors none --source Specify mirror address (domain or IP) address --source-epel Specify EPEL repository address (domain or IP) address --source-security Specify Debian/Ubuntu security repo address (domain or IP) address --source-vault Specify CentOS/AlmaLinux vault repo address (domain or IP) address --source-portage Specify Gentoo portage repo address (domain or IP) address --source-base-system Specify Linux Mint/Raspberry Pi OS base system repo address (domain or IP) address --branch Specify mirror repository (repo name) repo name --branch-epel Specify EPEL repository (path) repo name --branch-security Specify Debian security repo (path) repo name --branch-vault Specify CentOS/AlmaLinux vault repo (path) repo name --branch-portage Specify Gentoo portage repo (path) repo name --branch-base-system Specify Linux Mint/Raspberry Pi OS base system repo (path) repo name --codename Specify Debian/openKylin codename codename --protocol Specify web protocol http or https --use-intranet-source Prefer intranet mirror address true or false --use-official-source Use official mirror of target OS true or false --use-official-source-epel Use official EPEL repo true or false --install-epel Install EPEL repository true or false --backup Backup original mirrors true or false --upgrade-software Upgrade packages true or false --clean-cache Clean cache after upgrade true or false --clean-screen Clear screen before running true or false --lang Specify the language of the script output language --only-epel Only switch EPEL repo none --ignore-backup-tips Ignore backup overwrite prompt none --print-diff Print diff before and after modification none --pure-mode Pure mode, minimal output none --help Show help menu none Issue Report {}' ['mirrors.default.0']='Alibaba Cloud' ['mirrors.default.1']='Tencent Cloud' ['mirrors.default.2']='Huawei Cloud' ['mirrors.default.3']='China Mobile Cloud' ['mirrors.default.4']='China Telecom Cloud' ['mirrors.default.5']='NetEase' ['mirrors.default.6']='Volcengine' ['mirrors.default.7']='Tsinghua University' ['mirrors.default.8']='Peking University' ['mirrors.default.9']='Zhejiang University' ['mirrors.default.10']='Nanjing University' ['mirrors.default.11']='Lanzhou University' ['mirrors.default.12']='Shanghai Jiao Tong University' ['mirrors.default.13']='Chongqing University of Posts and Telecommunications' ['mirrors.default.14']='University of Science and Technology of China' ['mirrors.default.15']='Institute of Software, Chinese Academy of Sciences' ['mirrors.default.16']='Official Source' ['mirrors.edu.0']='Peking University' ['mirrors.edu.1']='Beijing Jiaotong University' ['mirrors.edu.2']='Beijing Foreign Studies University' ['mirrors.edu.3']='Beijing University of Posts and Telecommunications' ['mirrors.edu.4']='Chongqing University' ['mirrors.edu.5']='Chongqing University of Posts and Telecommunications' ['mirrors.edu.6']='Dalian Neusoft University of Information' ['mirrors.edu.7']='University of Electronic Science and Technology of China' ['mirrors.edu.8']='South China Agricultural University' ['mirrors.edu.9']='Huazhong University of Science and Technology' ['mirrors.edu.10']='Jilin University' ['mirrors.edu.11']='Jingchu University of Technology' ['mirrors.edu.12']='Jiangxi University of Science and Technology' ['mirrors.edu.13']='Lanzhou University' ['mirrors.edu.14']='Nanjing University' ['mirrors.edu.15']='Nanjing Tech University' ['mirrors.edu.16']='Nanjing University of Posts and Telecommunications' ['mirrors.edu.17']='Southern University of Science and Technology' ['mirrors.edu.18']='Nanyang Institute of Technology' ['mirrors.edu.19']='Qilu University of Technology' ['mirrors.edu.20']='Tsinghua University' ['mirrors.edu.21']='Shandong University' ['mirrors.edu.22']='ShanghaiTech University' ['mirrors.edu.23']='Shanghai Jiao Tong University (Siyuan)' ['mirrors.edu.24']='Shanghai Jiao Tong University (Zhiyuan)' ['mirrors.edu.25']='Wuchang Shouyi University' ['mirrors.edu.26']="Xi'an Jiaotong University" ['mirrors.edu.27']='Northwest A&F University' ['mirrors.edu.28']='Zhejiang University' ['mirrors.edu.29']='University of Science and Technology of China' ['mirrors.edu.30']='Official Source' ['mirrors.abroad.0']='AS · xTom · Hong Kong' ['mirrors.abroad.1']='AS · 01Link · Hong Kong' ['mirrors.abroad.2']='AS · National University of Singapore (NUS) · Singapore' ['mirrors.abroad.3']='AS · SG.GS · Singapore' ['mirrors.abroad.4']='AS · xTom · Singapore' ['mirrors.abroad.5']='AS · NCHC Free Software Lab · Taiwan' ['mirrors.abroad.6']='AS · OSS Planet · Taiwan' ['mirrors.abroad.7']='AS · National Yang Ming Chiao Tung University · Taiwan' ['mirrors.abroad.8']='AS · Tamkang University · Taiwan' ['mirrors.abroad.9']='AS · Taiwan Digital Streaming · Taiwan' ['mirrors.abroad.10']='AS · AniGil Linux Archive · Korea' ['mirrors.abroad.11']='AS · ICSCoE (Industrial Cyber Security Center of Excellence) · Japan' ['mirrors.abroad.12']='AS · JAIST (Japan Advanced Institute of Science and Technology) · Japan' ['mirrors.abroad.13']='AS · Yamagata University · Japan' ['mirrors.abroad.14']='AS · xTom · Japan' ['mirrors.abroad.15']='AS · GB Network Solutions · Malaysia' ['mirrors.abroad.16']='AS · Khon Kaen University · Thailand' ['mirrors.abroad.17']='EU · Vorboss Ltd · United Kiongdom' ['mirrors.abroad.18']='EU · QuickHost · United Kiongdom' ['mirrors.abroad.19']='EU · dogado · Germany' ['mirrors.abroad.20']='EU · xTom · Germany' ['mirrors.abroad.21']='EU · RWTH Aachen University · Germany' ['mirrors.abroad.22']='EU · Dresden University (AG DSN) · Germany' ['mirrors.abroad.23']='EU · CCIN2P3 · France' ['mirrors.abroad.24']='EU · Ircam · France' ['mirrors.abroad.25']='EU · Crans · France' ['mirrors.abroad.26']='EU · CRIHAN · France' ['mirrors.abroad.27']='EU · xTom · Netherlands' ['mirrors.abroad.28']='EU · DataPacket · Netherlands' ['mirrors.abroad.29']='EU · Linux Kernel · Netherlands' ['mirrors.abroad.30']='EU · xTom · Estonia' ['mirrors.abroad.31']='EU · netsite · Denmark' ['mirrors.abroad.32']='EU · Dotsrc · Denmark' ['mirrors.abroad.33']='EU · Academic Computer Club · Sweden' ['mirrors.abroad.34']='EU · Lysator · Sweden' ['mirrors.abroad.35']='EU · Yandex · Russia' ['mirrors.abroad.36']='EU · ia64 · Russia' ['mirrors.abroad.37']='EU · Truenetwork · Russia' ['mirrors.abroad.38']='EU · Belgian Research Network · Belgium' ['mirrors.abroad.39']='EU · University of Crete Computer Center · Greece' ['mirrors.abroad.40']='EU · Masaryk University Faculty of Informatics · Czech' ['mirrors.abroad.41']='EU · Czech Technical University Student Club (Silicon Hill) · Czech' ['mirrors.abroad.42']='EU · Vodafone · Czech' ['mirrors.abroad.43']='EU · CZ.NIC · Czech' ['mirrors.abroad.44']='EU · ETH Zurich · Switzerland' ['mirrors.abroad.45']='NA · Linux Kernel · United States' ['mirrors.abroad.46']='NA · MIT · United States' ['mirrors.abroad.47']='NA · Princeton University Department of Mathematics · United States' ['mirrors.abroad.48']='NA · Oregon State University Open Source Lab · United States' ['mirrors.abroad.49']='NA · Fremont Cabal Internet Exchange(FCIX) · United States' ['mirrors.abroad.50']='NA · xTom · United States' ['mirrors.abroad.51']='NA · Steadfast · United States' ['mirrors.abroad.52']='NA · University of British Columbia · Canada' ['mirrors.abroad.53']='NA · GoCodeIT · Canada' ['mirrors.abroad.54']='NA · Switch · Canada' ['mirrors.abroad.55']='SA · PoP-SC · Brazil' ['mirrors.abroad.56']='SA · State University of Ponta Grossa · Brazil' ['mirrors.abroad.57']='SA · UFSCar · Brazil' ['mirrors.abroad.58']='SA · Sysarmy Community · Argentina' ['mirrors.abroad.59']='OC · Fremont Cabal Internet Exchange(FCIX) · Australia' ['mirrors.abroad.60']='OC · AARNet · Australia' ['mirrors.abroad.61']='OC · DataMossa · Australia' ['mirrors.abroad.62']='OC · Amaze · Australia' ['mirrors.abroad.63']='OC · xTom · Australia' ['mirrors.abroad.64']='OC · Over the Wire · Australia' ['mirrors.abroad.65']='OC · Free Software Mirror Group · New Zealand' ['mirrors.abroad.66']='AF · Liquid Telecom · Kenya' ['mirrors.abroad.67']='AF · Dimension Data · South Africa' ['mirrors.abroad.68']='Official Source' ) ================================================ FILE: locales/linux/zh-hans.sh ================================================ MESSAGE_CONTENTS=( ['start.welcome']='欢迎使用 GNU/Linux 更换系统软件源脚本' ['start.runtimeEnv']='运行环境' ['start.dateTime']='系统时间' ['end.moreInfo']='脚本运行完毕,更多使用教程详见官网' ['end.sponsorAds']='【赞助商广告】' ['error.cmd.options.needConfirm']='请确认后重新输入' ['error.cmd.options.needSpecify']='请在该选项后指定{}' ['error.cmd.options.invalid']='命令选项 {} 无效,{}!' ['error.cmd.options.validAddress']='有效的地址' ['error.cmd.options.sourceAddress']='软件源地址' ['error.cmd.options.sourceRepository']='软件源仓库' ['error.cmd.options.codename']='版本代号' ['error.cmd.options.boolean']=' true 或 false ' ['error.cmd.options.protocol']=' http 或 https ' ['error.cmd.options.needProtocol']=' Web 协议(http/https)' ['error.cmd.options.validLangKey']='有效的语言 ID ' ['error.cmd.options.langKey']='语言 ' ['error.cmd.options.unsupportTwoSourceMode']='不可同时使用两种软件源模式,请确认后重试!' ['error.cmd.options.unsupportCodename']='当前系统不支持使用指定版本代号命令选项,请确认后重试!' ['error.cmd.options.unsupportEPEL']='当前系统不支持安装 EPEL 附加软件包,请确认后重试!' ['error.unsupportSystem']='不支持当前操作系统({}),请前往官网查看支持列表!' ['error.unsupportVersion']='不支持当前系统版本' ['error.unknownSystem']='未知系统' ['error.unknownVersion']='系统版本未知' ['error.input']='输入错误,{}!' ['error.needRoot']='权限不足,请切换至 root 账户后运行本脚本,切换命令 {}' ['error.defaultBehavior.https']='默认使用 HTTPS 协议' ['error.defaultBehavior.noReplace']='默认不更换' ['error.defaultBehavior.noOverwrite']='默认不覆盖' ['error.defaultBehavior.noUpdate']='默认不更新' ['error.defaultBehavior.noClean']='默认不清理' ['error.defaultBehavior.noUseIntranetSource']='默认不使用内网地址' ['warn.usedIntranetSource']='已切换至内网专用地址,仅限在特定环境下使用!' ['warn.unstableDebian']='检测到当前系统为 {} 版本,可能会产生一些无法预料的问题。' ['warn.EPEL7']='Extra Packages for Enterprise Linux 7 已结束生命周期并被官方移至归档库!' ['warn.needValidNumberIndex']='请输入有效的数字序号!' ['warn.needInputNumberIndex']='请输入数字序号!' ['info.backuped.sourceFile']='已备份原有 {} 源文件' ['tip.EPEL7']='目前部分镜像站没有同步该归档仓库,若换源后出现错误那么请先检查目标镜像站是否支持该仓库。' ['interaction.source.type.public']='公网' ['interaction.source.type.intranet']='内网' ['interaction.source.type.select']='请选择软件源的网络地址(访问方式):' ['interaction.source.type.usePublicAddress']='默认使用软件源的公网地址,是否继续' ['interaction.source.select']='请选择你想使用的软件源:' ['interaction.source.selectAndInput']='请选择并输入你想使用的软件源' ['interaction.protocol.select']='请选择软件源网络协议:' ['interaction.protocol.useHttp']='软件源是否使用 HTTP 协议' ['interaction.epel.skipReplace']='检测到系统已安装 EPEL 附加软件包,是否替换/覆盖软件源' ['interaction.epel.install']='是否安装 EPEL 附加软件包' ['interaction.backup.skipOverwrite.sourceFile']='检测到系统存在已备份的 {} 源文件,是否跳过覆盖备份' ['interaction.upgrade.skip']='是否跳过更新软件包' ['interaction.cache.autoClean']='在更新软件包后,是否自动清理下载缓存' ['interaction.common.tip']='提示' ['interaction.common.operationCanceled']='操作已取消' ['interaction.common.yes']='是' ['interaction.common.no']='否' ['work.upgradeSoftware']='更新软件包' ['work.installEPELPackage']='安装 epel-release 软件包...' ['source.sync.text1']='更新软件源' ['source.sync.text2']='生成软件源缓存' ['source.sync.text3']='刷新软件源' ['source.sync.text4']='同步软件源' ['source.sync.text5']='更新二进制缓存与频道源' ['source.comment.disabledSourceCode']='默认禁用源码镜像以提高更新速度,如需启用请自行取消注释' ['source.comment.securitySource']='安全更新软件源' ['source.comment.proposedSource']='预发布软件源(不建议启用)' ['source.changeResult.success']='软件源更换完毕' ['source.changeResult.fail']='软件源更换完毕,但{}失败' ['source.changeResult.tipTitle']='请再次执行脚本并更换相同软件源后进行尝试,若仍然{}失败那么可能由以下原因导致:' ['source.changeResult.tip1']='网络连通性问题:例如连接异常、由地区影响的网络间歇式中断、禁止外部访问、软件源网站防火墙阻断等' ['source.changeResult.tip2']='目标软件源异常:请手动前往软件源(镜像站)地址进行验证:{}' ['source.changeResult.tip2.1']='若报错内容是提示某个文件不存在那么有可能是软件源的问题,多常见于正在同步中的软件源仓库' ['source.changeResult.tip2.2']='若报错内容是目录(path)不存在也有可能是目标软件源不存在当前系统镜像仓库,即不支持当前系统' ['source.changeResult.tip2.3']='建议更换其它镜像站进行尝试,少数情况下软件源若处于同步中状态则可能会出现文件同步错误问题' ['source.changeResult.tip3']='原有软件源报错:请先排除系统原有的其它软件源报错,因为脚本不会干预这些无关的软件源配置,解决后重新运行脚本即可' ['commands.help']='命令选项(名称/含义/值): --abroad 使用境外以及海外软件源 无 --edu 使用中国大陆教育网软件源 无 --source 指定软件源地址(域名或IP) 地址 --source-epel 指定 EPEL 附加软件包仓库的软件源地址(域名或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) 地址 --branch 指定软件源仓库(路径) 仓库名 --branch-epel 指定 EPEL 附加软件包仓库的软件源仓库(路径) 仓库名 --branch-security 指定 Debian 系统 security 仓库的软件源仓库(路径) 仓库名 --branch-vault 指定 CentOS / AlmaLinux 系统 vault 仓库的软件源仓库(路径) 仓库名 --branch-portage 指定 Gentoo 系统 portage 仓库的软件源仓库(路径) 仓库名 --branch-base-system 指定 Linux Mint / Raspberry Pi OS 底层系统的软件源仓库(路径) 仓库名 --codename 指定 Debian 系 / openKylin 操作系统的版本代号 代号名称 --protocol 指定 Web 协议 http 或 https --use-intranet-source 是否优先使用内网软件源地址 true 或 false --use-official-source 是否使用目标操作系统的官方软件源 true 或 false --use-official-source-epel 是否使用 EPEL 附加软件包的官方软件源 true 或 false --install-epel 是否安装 EPEL 附加软件包 true 或 false --backup 是否备份原有软件源 true 或 false --upgrade-software 是否更新软件包 true 或 false --clean-cache 是否在更新软件包后清理下载缓存 true 或 false --clean-screen 是否在运行前清除屏幕上的所有内容 true 或 false --lang 指定脚本输出的语言 语言 --only-epel 仅更换 EPEL 软件源模式 无 --ignore-backup-tips 忽略覆盖备份提示 无 --print-diff 打印源文件修改前后差异 无 --pure-mode 纯净模式,精简打印内容 无 --help 查看帮助菜单 无 问题报告 {}' ['mirrors.default.0']='阿里云' ['mirrors.default.1']='腾讯云' ['mirrors.default.2']='华为云' ['mirrors.default.3']='移动云' ['mirrors.default.4']='天翼云' ['mirrors.default.5']='网易' ['mirrors.default.6']='火山引擎' ['mirrors.default.7']='清华大学' ['mirrors.default.8']='北京大学' ['mirrors.default.9']='浙江大学' ['mirrors.default.10']='南京大学' ['mirrors.default.11']='兰州大学' ['mirrors.default.12']='上海交通大学' ['mirrors.default.13']='重庆邮电大学' ['mirrors.default.14']='中国科学技术大学' ['mirrors.default.15']='中国科学院软件研究所' ['mirrors.default.16']='官方源' ['mirrors.edu.0']='北京大学' ['mirrors.edu.1']='北京交通大学' ['mirrors.edu.2']='北京外国语大学' ['mirrors.edu.3']='北京邮电大学' ['mirrors.edu.4']='重庆大学' ['mirrors.edu.5']='重庆邮电大学' ['mirrors.edu.6']='大连东软信息学院' ['mirrors.edu.7']='电子科技大学' ['mirrors.edu.8']='华南农业大学' ['mirrors.edu.9']='华中科技大学' ['mirrors.edu.10']='吉林大学' ['mirrors.edu.11']='荆楚理工学院' ['mirrors.edu.12']='江西理工大学' ['mirrors.edu.13']='兰州大学' ['mirrors.edu.14']='南京大学' ['mirrors.edu.15']='南京工业大学' ['mirrors.edu.16']='南京邮电大学' ['mirrors.edu.17']='南方科技大学' ['mirrors.edu.18']='南阳理工学院' ['mirrors.edu.19']='齐鲁工业大学' ['mirrors.edu.20']='清华大学' ['mirrors.edu.21']='山东大学' ['mirrors.edu.22']='上海科技大学' ['mirrors.edu.23']='上海交通大学(思源)' ['mirrors.edu.24']='上海交通大学(致远)' ['mirrors.edu.25']='武昌首义学院' ['mirrors.edu.26']='西安交通大学' ['mirrors.edu.27']='西北农林科技大学' ['mirrors.edu.28']='浙江大学' ['mirrors.edu.29']='中国科学技术大学' ['mirrors.edu.30']='官方源' ['mirrors.abroad.0']='亚洲 · xTom · 香港' ['mirrors.abroad.1']='亚洲 · 01Link · 香港' ['mirrors.abroad.2']='亚洲 · 新加坡国立大学(NUS) · 新加坡' ['mirrors.abroad.3']='亚洲 · SG.GS · 新加坡' ['mirrors.abroad.4']='亚洲 · xTom · 新加坡' ['mirrors.abroad.5']='亚洲 · 自由软件实验室(NCHC) · 台湾' ['mirrors.abroad.6']='亚洲 · OSS Planet · 台湾' ['mirrors.abroad.7']='亚洲 · 国立阳明交通大学 · 台湾' ['mirrors.abroad.8']='亚洲 · 淡江大学 · 台湾' ['mirrors.abroad.9']='亚洲 · Taiwan Digital Streaming · 台湾' ['mirrors.abroad.10']='亚洲 · AniGil Linux Archive · 韩国' ['mirrors.abroad.11']='亚洲 · 工业网络安全中心(ICSCoE) · 日本' ['mirrors.abroad.12']='亚洲 · 北陆先端科学技术大学院大学(JAIST) · 日本' ['mirrors.abroad.13']='亚洲 · 山形大学 · 日本' ['mirrors.abroad.14']='亚洲 · xTom · 日本' ['mirrors.abroad.15']='亚洲 · GB Network Solutions · 马来西亚' ['mirrors.abroad.16']='亚洲 · 孔敬大学 · 泰国' ['mirrors.abroad.17']='欧洲 · Vorboss Ltd · 英国' ['mirrors.abroad.18']='欧洲 · QuickHost · 英国' ['mirrors.abroad.19']='欧洲 · dogado · 德国' ['mirrors.abroad.20']='欧洲 · xTom · 德国' ['mirrors.abroad.21']='欧洲 · 亚琛工业大学(RWTH Aachen) · 德国' ['mirrors.abroad.22']='欧洲 · 德累斯顿大学(AG DSN) · 德国' ['mirrors.abroad.23']='欧洲 · CCIN2P3 · 法国' ['mirrors.abroad.24']='欧洲 · Ircam · 法国' ['mirrors.abroad.25']='欧洲 · Crans · 法国' ['mirrors.abroad.26']='欧洲 · CRIHAN · 法国' ['mirrors.abroad.27']='欧洲 · xTom · 荷兰' ['mirrors.abroad.28']='欧洲 · DataPacket · 荷兰' ['mirrors.abroad.29']='欧洲 · Linux Kernel · 荷兰' ['mirrors.abroad.30']='欧洲 · xTom · 爱沙尼亚' ['mirrors.abroad.31']='欧洲 · netsite · 丹麦' ['mirrors.abroad.32']='欧洲 · Dotsrc · 丹麦' ['mirrors.abroad.33']='欧洲 · Academic Computer Club · 瑞典' ['mirrors.abroad.34']='欧洲 · Lysator · 瑞典' ['mirrors.abroad.35']='欧洲 · Yandex · 俄罗斯' ['mirrors.abroad.36']='欧洲 · ia64 · 俄罗斯' ['mirrors.abroad.37']='欧洲 · Truenetwork · 俄罗斯' ['mirrors.abroad.38']='欧洲 · Belgian Research Network · 比利时' ['mirrors.abroad.39']='欧洲 · 克里特大学计算机中心 · 希腊' ['mirrors.abroad.40']='欧洲 · 马萨里克大学信息学院 · 捷克' ['mirrors.abroad.41']='欧洲 · 捷克理工大学学生会俱乐部(Silicon Hill) · 捷克' ['mirrors.abroad.42']='欧洲 · Vodafone · 捷克' ['mirrors.abroad.43']='欧洲 · CZ.NIC · 捷克' ['mirrors.abroad.44']='欧洲 · 苏黎世联邦理工学院 · 瑞士' ['mirrors.abroad.45']='北美 · Linux Kernel · 美国' ['mirrors.abroad.46']='北美 · 麻省理工学院(MIT) · 美国' ['mirrors.abroad.47']='北美 · 普林斯顿大学数学系 · 美国' ['mirrors.abroad.48']='北美 · 俄勒冈州立大学开源实验室 · 美国' ['mirrors.abroad.49']='北美 · Fremont Cabal Internet Exchange(FCIX) · 美国' ['mirrors.abroad.50']='北美 · xTom · 美国' ['mirrors.abroad.51']='北美 · Steadfast · 美国' ['mirrors.abroad.52']='北美 · 不列颠哥伦比亚大学 · 加拿大' ['mirrors.abroad.53']='北美 · GoCodeIT · 加拿大' ['mirrors.abroad.54']='北美 · Switch · 加拿大' ['mirrors.abroad.55']='南美 · PoP-SC · 巴西' ['mirrors.abroad.56']='南美 · 蓬塔格罗萨州立大学 · 巴西' ['mirrors.abroad.57']='南美 · UFSCar · 巴西' ['mirrors.abroad.58']='南美 · Sysarmy Community · 阿根廷' ['mirrors.abroad.59']='大洋 · Fremont Cabal Internet Exchange(FCIX) · 澳大利亚' ['mirrors.abroad.60']='大洋 · AARNet · 澳大利亚' ['mirrors.abroad.61']='大洋 · DataMossa · 澳大利亚' ['mirrors.abroad.62']='大洋 · Amaze · 澳大利亚' ['mirrors.abroad.63']='大洋 · xTom · 澳大利亚' ['mirrors.abroad.64']='大洋 · Over the Wire · 澳大利亚' ['mirrors.abroad.65']='大洋 · Free Software Mirror Group · 新西兰' ['mirrors.abroad.66']='非洲 · Liquid Telecom · 肯尼亚' ['mirrors.abroad.67']='非洲 · Dimension Data · 南非' ['mirrors.abroad.68']='官方源' ) ================================================ FILE: locales/linux/zh-hant.sh ================================================ MESSAGE_CONTENTS=( ['start.welcome']='歡迎使用 GNU/Linux 更換系統軟體源腳本' ['start.runtimeEnv']='執行環境' ['start.dateTime']='系統時間' ['end.moreInfo']='腳本執行完畢,更多使用教學詳見官網' ['end.sponsorAds']='【贊助商廣告】' ['error.cmd.options.needConfirm']='請確認後重新輸入' ['error.cmd.options.needSpecify']='請在該選項後指定{}' ['error.cmd.options.invalid']='命令選項 {} 無效,{}!' ['error.cmd.options.invalid']='命令選項 {} 無效,{}!' ['error.cmd.options.validAddress']='有效的地址' ['error.cmd.options.sourceAddress']='軟體源地址' ['error.cmd.options.sourceRepository']='軟體源倉庫' ['error.cmd.options.codename']='版本代號' ['error.cmd.options.boolean']=' true 或 false ' ['error.cmd.options.protocol']=' http 或 https ' ['error.cmd.options.needProtocol']=' Web 協定(http/https)' ['error.cmd.options.validLangKey']='有效的語言 ID ' ['error.cmd.options.langKey']='語言 ID ' ['error.cmd.options.unsupportTwoSourceMode']='不可同時使用兩種軟體源模式,請確認後重試!' ['error.cmd.options.unsupportCodename']='當前系統不支援使用指定版本代號命令選項,請確認後重試!' ['error.cmd.options.unsupportEPEL']='當前系統不支援安裝 EPEL 附加軟體包,請確認後重試!' ['error.unsupportSystem']='不支援當前系統({}),請前往官網查看支援清單!' ['error.unsupportVersion']='不支援當前系統版本' ['error.unknownSystem']='未知系統' ['error.unknownVersion']='系統版本未知' ['error.input']='輸入錯誤,{}!' ['error.needRoot']='權限不足,請切換至 root 帳戶後執行本腳本,切換指令 {}' ['error.defaultBehavior.https']='預設使用 HTTPS 協定' ['error.defaultBehavior.noReplace']='預設不更換' ['error.defaultBehavior.noOverwrite']='預設不覆蓋' ['error.defaultBehavior.noUpdate']='預設不更新' ['error.defaultBehavior.noClean']='預設不清理' ['error.defaultBehavior.noUseIntranetSource']='預設不使用內網地址' ['warn.usedIntranetSource']='已切換至內網專用地址,僅限在特定環境下使用!' ['warn.unstableDebian']='偵測到當前系統為 {} 版本,可能會產生一些無法預料的問題。' ['warn.EPEL7']='Extra Packages for Enterprise Linux 7 已結束生命週期並被官方移至封存庫!' ['warn.needValidNumberIndex']='請輸入有效的數字序號!' ['warn.needInputNumberIndex']='請輸入數字序號!' ['info.backuped.sourceFile']='已備份原有 {} 源檔案' ['tip.EPEL7']='目前部分鏡像站尚未同步該封存倉庫,若換源後出現錯誤請先檢查目標鏡像站是否支援該倉庫。' ['interaction.source.type.public']='外網' ['interaction.source.type.intranet']='內網' ['interaction.source.type.select']='請選擇軟體源的網路地址(存取方式):' ['interaction.source.type.usePublicAddress']='預設使用軟體源的外網地址,是否繼續' ['interaction.source.select']='請選擇你想使用的軟體源:' ['interaction.source.selectAndInput']='請選擇並輸入你想使用的軟體源' ['interaction.protocol.select']='請選擇軟體源網路協定:' ['interaction.protocol.useHttp']='軟體源是否使用 HTTP 协议' ['interaction.epel.skipReplace']='偵測到系統已安裝 EPEL 附加軟體包,是否替換/覆蓋軟體源' ['interaction.epel.install']='是否安裝 EPEL 附加軟體包' ['interaction.backup.skipOverwrite.sourceFile']='偵測到系統存在已備份的 {} 源檔案,是否跳過覆蓋備份' ['interaction.upgrade.skip']='是否跳過更新軟體包' ['interaction.cache.autoClean']='在更新軟體包後,是否自動清理下載快取' ['interaction.common.tip']='提示' ['interaction.common.operationCanceled']='操作已取消' ['interaction.common.yes']='是' ['interaction.common.no']='否' ['work.upgradeSoftware']='更新軟體包' ['work.installEPELPackage']='正在安裝 epel-release 套件...' ['source.sync.text1']='更新軟體源' ['source.sync.text2']='產生軟體源快取' ['source.sync.text3']='重新整理軟體源' ['source.sync.text4']='同步軟體源' ['source.sync.text5']='更新二進位快取與頻道來源' ['source.comment.disabledSourceCode']='預設停用原始碼鏡像以提升更新速度,如需啟用請自行取消註解' ['source.comment.securitySource']='安全更新軟體源' ['source.comment.proposedSource']='預發布軟體源(不建議啟用)' ['source.changeResult.success']='軟體源更換完畢' ['source.changeResult.fail']='軟體源更換完畢,但{}失敗' ['source.changeResult.tipTitle']='請再次執行腳本並更換相同軟體源後重試,若仍然{}失敗則可能由下列原因造成:' ['source.changeResult.tip1']='網路連通性問題:例如連線異常、地域因素造成的網路間歇中斷、禁止外部存取、軟體源站台防火牆阻斷等' ['source.changeResult.tip2']='目標軟體源異常:請手動前往軟體源(鏡像站)地址進行驗證:{}' ['source.changeResult.tip2.1']='若錯誤內容是提示某個檔案不存在,可能是軟體源的問題,常見於鏡像站同步期間' ['source.changeResult.tip2.2']='若錯誤內容是目錄不存在,也可能代表目標軟體源不含當前系統的鏡像倉庫,即不支援當前系統' ['source.changeResult.tip2.3']='建議更換其他鏡像站再試,少數情況下軟體源若處於同步中狀態則可能會出現檔案同步錯誤' ['source.changeResult.tip3']='原有軟體源報錯:請先排除系統其他軟體源的錯誤,因為腳本不會處理無關的軟體源配置,解決後重新執行腳本即可' ['commands.help']='命令選項(名稱/含義/值): --abroad 使用境外以及海外軟體源 無 --edu 使用中國大陸教育網軟體源 無 --source 指定軟體源地址(網域名稱或IP) 位址 --source-epel 指定 EPEL 附加軟體包倉庫的軟體源地址(網域名稱或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) 位址 --branch 指定軟體源倉庫(路徑) 倉庫名稱 --branch-epel 指定 EPEL 附加軟體包倉庫的軟體源倉庫(路徑) 倉庫名稱 --branch-security 指定 Debian 系統 security 倉庫的軟體源倉庫(路徑) 倉庫名稱 --branch-vault 指定 CentOS / AlmaLinux 系統 vault 倉庫的軟體源倉庫(路徑) 倉庫名稱 --branch-portage 指定 Gentoo 系統 portage 倉庫的軟體源倉庫(路徑) 倉庫名稱 --branch-base-system 指定 Linux Mint / Raspberry Pi OS 底層系統的軟體源倉庫(路徑) 倉庫名稱 --codename 指定 Debian 系 / openKylin 系統的版本代號 代號名稱 --protocol 指定 Web 協定 http 或 https --use-intranet-source 是否優先使用內部網路軟體源位址 true 或 false --use-official-source 是否使用目標系統的官方軟體源 true 或 false --use-official-source-epel 是否使用 EPEL 附加軟體包的官方軟體源 true 或 false --install-epel 是否安裝 EPEL 附加軟體包 true 或 false --backup 是否備份原有軟體源 true 或 false --upgrade-software 是否更新軟體包 true 或 false --clean-cache 是否在更新軟體包後清理下載快取 true 或 false --clean-screen 是否在運行前清除螢幕上的所有內容 true 或 false --lang 指定腳本輸出的語言 语言 --only-epel 僅更換 EPEL 軟體源模式 無 --ignore-backup-tips 忽略覆蓋備份提示 無 --print-diff 是否列印原始文件修改前後差異 無 --pure-mode 純淨模式,精簡列印內容 無 --help 查看幫助選單 無 問題報告 {}' ['mirrors.default.0']='阿里雲' ['mirrors.default.1']='騰訊雲' ['mirrors.default.2']='華為雲' ['mirrors.default.3']='移動雲' ['mirrors.default.4']='天翼雲' ['mirrors.default.5']='網易' ['mirrors.default.6']='火山引擎' ['mirrors.default.7']='清華大學' ['mirrors.default.8']='北京大學' ['mirrors.default.9']='浙江大學' ['mirrors.default.10']='南京大學' ['mirrors.default.11']='蘭州大學' ['mirrors.default.12']='上海交通大學' ['mirrors.default.13']='重慶郵電大學' ['mirrors.default.14']='中國科學技術大學' ['mirrors.default.15']='中國科學院軟件研究所' ['mirrors.default.16']='官方源' ['mirrors.edu.0']='北京大學' ['mirrors.edu.1']='北京交通大學' ['mirrors.edu.2']='北京外國語大學' ['mirrors.edu.3']='北京郵電大學' ['mirrors.edu.4']='重慶大學' ['mirrors.edu.5']='重慶郵電大學' ['mirrors.edu.6']='大連東軟信息學院' ['mirrors.edu.7']='電子科技大學' ['mirrors.edu.8']='華南農業大學' ['mirrors.edu.9']='華中科技大學' ['mirrors.edu.10']='吉林大學' ['mirrors.edu.11']='荊楚理工學院' ['mirrors.edu.12']='江西理工大學' ['mirrors.edu.13']='蘭州大學' ['mirrors.edu.14']='南京大學' ['mirrors.edu.15']='南京工業大學' ['mirrors.edu.16']='南京郵電大學' ['mirrors.edu.17']='南方科技大學' ['mirrors.edu.18']='南陽理工學院' ['mirrors.edu.19']='齊魯工業大學' ['mirrors.edu.20']='清華大學' ['mirrors.edu.21']='山東大學' ['mirrors.edu.22']='上海科技大學' ['mirrors.edu.23']='上海交通大學(思源)' ['mirrors.edu.24']='上海交通大學(致遠)' ['mirrors.edu.25']='武昌首義學院' ['mirrors.edu.26']='西安交通大學' ['mirrors.edu.27']='西北農林科技大學' ['mirrors.edu.28']='浙江大學' ['mirrors.edu.29']='中國科學技術大學' ['mirrors.edu.30']='官方源' ['mirrors.abroad.0']='亞洲 · xTom · 香港' ['mirrors.abroad.1']='亞洲 · 01Link · 香港' ['mirrors.abroad.2']='亞洲 · 新加坡國立大學(NUS) · 新加坡' ['mirrors.abroad.3']='亞洲 · SG.GS · 新加坡' ['mirrors.abroad.4']='亞洲 · xTom · 新加坡' ['mirrors.abroad.5']='亞洲 · 自由軟體實驗室(NCHC) · 臺灣' ['mirrors.abroad.6']='亞洲 · OSS Planet · 臺灣' ['mirrors.abroad.7']='亞洲 · 國立陽明交通大學 · 臺灣' ['mirrors.abroad.8']='亞洲 · 淡江大學 · 臺灣' ['mirrors.abroad.9']='亞洲 · Taiwan Digital Streaming · 臺灣' ['mirrors.abroad.10']='亞洲 · AniGil Linux Archive · 韓國' ['mirrors.abroad.11']='亞洲 · 工業網路安全中心(ICSCoE) · 日本' ['mirrors.abroad.12']='亞洲 · 北陸先端科學技術大學院大學(JAIST) · 日本' ['mirrors.abroad.13']='亞洲 · 山形大學 · 日本' ['mirrors.abroad.14']='亞洲 · xTom · 日本' ['mirrors.abroad.15']='亞洲 · GB Network Solutions · 馬來西亞' ['mirrors.abroad.16']='亞洲 · 孔敬大學 · 泰國' ['mirrors.abroad.17']='歐洲 · Vorboss Ltd · 英國' ['mirrors.abroad.18']='歐洲 · QuickHost · 英國' ['mirrors.abroad.19']='歐洲 · dogado · 德國' ['mirrors.abroad.20']='歐洲 · xTom · 德國' ['mirrors.abroad.21']='歐洲 · 亞琛工業大學(RWTH Aachen) · 德國' ['mirrors.abroad.22']='歐洲 · 德勒斯登大學(AG DSN) · 德國' ['mirrors.abroad.23']='歐洲 · CCIN2P3 · 法國' ['mirrors.abroad.24']='歐洲 · Ircam · 法國' ['mirrors.abroad.25']='歐洲 · Crans · 法國' ['mirrors.abroad.26']='歐洲 · CRIHAN · 法國' ['mirrors.abroad.27']='歐洲 · xTom · 荷蘭' ['mirrors.abroad.28']='歐洲 · DataPacket · 荷蘭' ['mirrors.abroad.29']='歐洲 · Linux Kernel · 荷蘭' ['mirrors.abroad.30']='歐洲 · xTom · 愛沙尼亞' ['mirrors.abroad.31']='歐洲 · netsite · 丹麥' ['mirrors.abroad.32']='歐洲 · Dotsrc · 丹麥' ['mirrors.abroad.33']='歐洲 · Academic Computer Club · 瑞典' ['mirrors.abroad.34']='歐洲 · Lysator · 瑞典' ['mirrors.abroad.35']='歐洲 · Yandex · 俄羅斯' ['mirrors.abroad.36']='歐洲 · ia64 · 俄羅斯' ['mirrors.abroad.37']='歐洲 · Truenetwork · 俄羅斯' ['mirrors.abroad.38']='歐洲 · Belgian Research Network · 比利時' ['mirrors.abroad.39']='歐洲 · 克里特大學計算機中心 · 希臘' ['mirrors.abroad.40']='歐洲 · 馬薩里克大學信息學院 · 捷克' ['mirrors.abroad.41']='歐洲 · 捷克理工大學學生會俱樂部(Silicon Hill) · 捷克' ['mirrors.abroad.42']='歐洲 · Vodafone · 捷克' ['mirrors.abroad.43']='歐洲 · CZ.NIC · 捷克' ['mirrors.abroad.44']='歐洲 · 蘇黎世聯邦理工學院 · 瑞士' ['mirrors.abroad.45']='北美 · Linux Kernel · 美國' ['mirrors.abroad.46']='北美 · 麻省理工學院(MIT) · 美國' ['mirrors.abroad.47']='北美 · 普林斯頓大學數學系 · 美國' ['mirrors.abroad.48']='北美 · 俄勒岡州立大學開源實驗室 · 美國' ['mirrors.abroad.49']='北美 · Fremont Cabal Internet Exchange(FCIX) · 美國' ['mirrors.abroad.50']='北美 · xTom · 美國' ['mirrors.abroad.51']='北美 · Steadfast · 美國' ['mirrors.abroad.52']='北美 · 不列顛哥倫比亞大學 · 加拿大' ['mirrors.abroad.53']='北美 · GoCodeIT · 加拿大' ['mirrors.abroad.54']='北美 · Switch · 加拿大' ['mirrors.abroad.55']='南美 · PoP-SC · 巴西' ['mirrors.abroad.56']='南美 · 蓬塔格羅薩州立大學 · 巴西' ['mirrors.abroad.57']='南美 · UFSCar · 巴西' ['mirrors.abroad.58']='南美 · Sysarmy Community · 阿根廷' ['mirrors.abroad.59']='大洋 · Fremont Cabal Internet Exchange(FCIX) · 澳大利亞' ['mirrors.abroad.60']='大洋 · AARNet · 澳大利亞' ['mirrors.abroad.61']='大洋 · DataMossa · 澳大利亞' ['mirrors.abroad.62']='大洋 · Amaze · 澳大利亞' ['mirrors.abroad.63']='大洋 · xTom · 澳大利亞' ['mirrors.abroad.64']='大洋 · Over the Wire · 澳大利亞' ['mirrors.abroad.65']='大洋 · Free Software Mirror Group · 紐西蘭' ['mirrors.abroad.66']='非洲 · Liquid Telecom · 肯亞' ['mirrors.abroad.67']='非洲 · Dimension Data · 南非' ['mirrors.abroad.68']='官方源' ) ================================================ FILE: mkdocs.yml ================================================ site_name: LinuxMirrors repo_name: LinuxMirrors repo_url: https://github.com/SuperManito/LinuxMirrors edit_uri: edit/main/docs/ copyright: 'Copyright © 2026 SuperManito' nav: - "介绍": index.md - "使用方法": use/index.md - "软件源列表": mirrors/index.md - "容器工具": other/index.md - "更新日志": changelog/index.md - "社区": community/index.md - "赞助": sponsor/index.md extra_javascript: - https://unpkg.com/vue/dist/vue.global.prod.js - https://unpkg.com/tdesign-vue-next/dist/tdesign.min.js - assets/js/modules/tdesign-theme.js - assets/js/components/orama-ui/config.js - assets/js/components/orama-ui/index.js - assets/js/useThemeTransition.js - assets/js/common.js - assets/js/component.js - assets/js/components/mirrors-table/data.js - assets/js/components/mirrors-table/index.js extra_css: - https://unpkg.com/tdesign-vue-next/dist/tdesign.min.css - assets/css/orama-ui.css - stylesheets/extra.css theme: logo: assets/images/brand/svg/logo-light.svg name: material custom_dir: docs/theme language: zh favicon: assets/favicon.ico font: false icon: repo: simple/github edit: material/file-document-edit-outline view: material/file-eye-outline admonition: note: octicons/tag-16 abstract: octicons/checklist-16 info: octicons/info-16 tip: fontawesome/regular/lightbulb success: octicons/check-16 question: octicons/question-16 warning: octicons/alert-16 danger: octicons/zap-16 bug: octicons/bug-16 example: octicons/beaker-16 quote: octicons/quote-16 palette: - media: "(prefers-color-scheme)" scheme: system toggle: icon: material/brightness-auto name: 跟随系统 - media: "(prefers-color-scheme: light)" scheme: default primary: white accent: blue toggle: icon: octicons/sun-16 name: 亮色模式 - media: "(prefers-color-scheme: dark)" scheme: slate primary: black accent: blue toggle: icon: octicons/moon-16 name: 暗黑模式 features: - header.autohide - navigation.top - navigation.tabs - navigation.path # - navigation.instant - navigation.instant.progress - navigation.indexes - navigation.footer - navigation.prune - navigation.tracking - navigation.sections - content.tooltips - content.code.copy - content.code.annotate - search.suggest - search.highlight - search.share - announce.dismiss extra: generator: false homepage: https://linuxmirrors.cn social: - icon: simple/github link: https://github.com/SuperManito/LinuxMirrors name: GitHub - icon: simple/gitee link: https://gitee.com/SuperManito/LinuxMirrors name: Gitee - icon: simple/gitcode link: https://gitcode.com/SuperManito/LinuxMirrors name: GitCode analytics: provider: google property: G-WG7T40F7YP markdown_extensions: - toc: permalink: "#" permalink_title: 链接 toc_depth: 3 slugify: !!python/object/apply:pymdownx.slugs.slugify kwds: case: lower - abbr - tables - def_list - attr_list - footnotes - md_in_html - admonition - pymdownx.details - pymdownx.betterem - pymdownx.snippets - pymdownx.inlinehilite - pymdownx.superfences - pymdownx.critic - pymdownx.caret - pymdownx.keys - pymdownx.mark - pymdownx.tilde - pymdownx.tasklist: custom_checkbox: true - pymdownx.emoji: emoji_index: !!python/name:material.extensions.emoji.twemoji emoji_generator: !!python/name:material.extensions.emoji.to_svg options: custom_icons: - docs/assets/images/icon/custom - pymdownx.highlight: anchor_linenums: true use_pygments: true - pymdownx.tabbed: alternate_style: true slugify: !!python/object/apply:pymdownx.slugs.slugify kwds: case: lower - pymdownx.tasklist: custom_checkbox: true plugins: - i18n: docs_structure: suffix languages: - locale: zh default: true name: 简体中文 - locale: zh-Hant name: 繁體中文 nav_translations: "介绍": 介紹 "使用方法": 使用方法 "软件源列表": 軟體源列表 "容器工具": 容器工具 "更新日志": 更新日誌 "社区": 社群 "赞助": 贊助 build: true theme: palette: - media: "(prefers-color-scheme)" toggle: name: 跟隨系統 - media: "(prefers-color-scheme: light)" toggle: name: 亮色模式 - media: "(prefers-color-scheme: dark)" toggle: name: 暗黑模式 - locale: en name: English nav_translations: "介绍": Introduction "使用方法": Use "软件源列表": Mirrors List "容器工具": Container Tools "更新日志": Changelog "社区": Community "赞助": Sponsor build: true theme: palette: - media: "(prefers-color-scheme)" toggle: name: Follow System - media: "(prefers-color-scheme: light)" toggle: name: Light Mode - media: "(prefers-color-scheme: dark)" toggle: name: Dark Mode - search: # lang: en separator: '[\s\-,:!=\[\]()"/]+|(?!\b)(?=[A-Z][a-z])|\.(?!\d)|&[lg]t;' - tags - termynal # - minify: # minify_js: true # minify_css: true # htmlmin_opts: # remove_comments: true # cache_safe: false # js_files: # - assets/js/useThemeTransition.js # - assets/js/common.js # - assets/js/component.js # - assets/js/components/mirrors-table/data.js # - assets/js/components/mirrors-table/index.js ================================================ FILE: netlify.toml ================================================ [[headers]] for = "/*.js" [headers.values] Cache-Control = "public, max-age=31536000, must-revalidate" [[headers]] for = "/*.css" [headers.values] Cache-Control = "public, max-age=31536000, must-revalidate" [[headers]] for = "/*.png" [headers.values] Cache-Control = "public, max-age=31536000, must-revalidate" ================================================ FILE: requirements.txt ================================================ mkdocs-material==9.7.4 mkdocs-glightbox==0.5.2 mkdocs-exclude-search==0.6.6 # mkdocs-minify-plugin==0.8.0 mkdocs-static-i18n==1.3.0 termynal==0.13.1