Full Code of SuperManito/LinuxMirrors for AI

main 9d4be510b336 cached
97 files
1.3 MB
400.9k tokens
36 symbols
1 requests
Download .txt
Showing preview only (1,343K chars total). Download the full file or copy to clipboard to get everything.
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
================================================
<!-- 这是隐藏的信息

请在创建此 Issue 前排除软件源(镜像站)故障等非本项目脚本自身问题,建议先尝试重新运行脚本并检查网络连接。

在提交前请阅读下面的内容:

⚠️如果方便的话请优先在 GitHub 官方仓库提交 Issue!
⚠️如果在使用过程中遇到问题需要帮助,请严格按照模板提交反馈!
⚠️如果是意见与建议类问题则不需要使用此模板,自行清除所有模板内容!

⚠️请_完整_填写以下模板描述问题,否则反馈将会被系统关闭。
⚠️请_完整_填写以下模板描述问题,否则反馈将会被系统关闭。
⚠️请_完整_填写以下模板描述问题,否则反馈将会被系统关闭。
(重要的事情说三遍😉)

点击编辑器上方的 Preview 图标可预览效果

-->

<!-- 👆这样括起来的信息将被隐藏,填写时注意不要写在里面。 -->

## 1. 操作系统
<!-- 将中括号内的 "空格" 替换为 "x" ,即为选中,例:" - [x] 是 " -->
- [ ] `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. 处理器架构
<!-- 将中括号内的 "空格" 替换为 "x" ,即为选中,例:" - [x] 否 " -->
- [ ] `x86_64` `x86_32`
- [ ] `arm64` `arm/v8` `arm/v7` `arm/v6`
- [ ] `ppc64le` `s390x`
- [ ] `其它`

## 3. 系统详细信息
<!-- 请执行命令 "cat /etc/os-release",并将输出结果粘贴在下方 -->
```

```

## 4. 环境信息
<!-- 请执行命令 "uname -a",并将输出结果粘贴在下方 -->
```

```

## 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
<https://www.contributor-covenant.org/version/2/1/code_of_conduct/>.

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
<https://www.contributor-covenant.org/faq/>. Translations are available at
<https://www.contributor-covenant.org/translations/>.


================================================
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_<XXX> SOURCE_<XXX>_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
Download .txt
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
Download .txt
SYMBOL INDEX (36 symbols across 8 files)

FILE: docs/assets/js/common.js
  function debounce (line 6) | function debounce(func, wait) {

FILE: docs/assets/js/components/mirrors-table/data.js
  method filterMethod (line 730) | filterMethod(value, row) {

FILE: docs/assets/js/components/mirrors-table/index.js
  method data (line 143) | data() {
  method created (line 156) | created() {
  method isMobile (line 167) | isMobile() {
  method localeFlags (line 170) | localeFlags() {
  method startTitle (line 177) | startTitle() {
  method globalConfig (line 181) | globalConfig() {
  method selectPlaceholder (line 239) | selectPlaceholder() {
  method rowSelectPlaceholder (line 243) | rowSelectPlaceholder() {
  method rowFilterOptions (line 247) | rowFilterOptions() {
  method rowFilterOptionsRendered (line 253) | rowFilterOptionsRendered() {
  method statusLabels (line 256) | statusLabels() {
  method showSupported (line 264) | showSupported() {
  method showUnsupported (line 267) | showUnsupported() {
  method showIncompatible (line 270) | showIncompatible() {
  method filterOptions (line 273) | filterOptions() {
  method dataChange (line 278) | dataChange(data) {
  method onFilterChange (line 288) | onFilterChange() {
  method onRowFilterChange (line 292) | onRowFilterChange() {
  method getMirrorSiteBranchUrl (line 301) | getMirrorSiteBranchUrl(domain, branchName) {
  method _mapOptionForRow (line 304) | _mapOptionForRow(opt) {
  method _mapOptionForFilter (line 319) | _mapOptionForFilter(opt) {
  method onCellStatusChange (line 337) | onCellStatusChange() {
  method onTableFilterChange (line 341) | onTableFilterChange(filters) {
  method _updateColumns (line 348) | _updateColumns() {
  method _updateRows (line 356) | _updateRows() {
  method _computeFilteredData (line 361) | _computeFilteredData() {
  method _flattenFilterKeys (line 394) | _flattenFilterKeys(options) {

FILE: docs/assets/js/components/orama-ui/config.js
  function getOramaSearchBoxConfig (line 80) | function getOramaSearchBoxConfig() {
  function localizationOramaSearchBox (line 140) | function localizationOramaSearchBox(searchBox) {

FILE: docs/assets/js/components/orama-ui/index-native.js
  function loadOramaWebComponent (line 1) | function loadOramaWebComponent() {

FILE: docs/assets/js/components/orama-ui/index.js
  function loadOramaWebComponent (line 1) | function loadOramaWebComponent() {

FILE: docs/assets/js/modules/tdesign-theme.js
  function updateTDesignGlobalTheme (line 2) | function updateTDesignGlobalTheme() {
  function setupThemeObserver (line 13) | function setupThemeObserver() {

FILE: docs/assets/js/useThemeTransition.js
  function useThemeTransition (line 1) | function useThemeTransition() {
Condensed preview — 97 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,389K chars).
[
  {
    "path": ".gitee/issue_template.md",
    "chars": 1286,
    "preview": "<!-- 这是隐藏的信息\n\n请在创建此 Issue 前排除软件源(镜像站)故障等非本项目脚本自身问题,建议先尝试重新运行脚本并检查网络连接。\n\n在提交前请阅读下面的内容:\n\n⚠️如果方便的话请优先在 GitHub 官方仓库提交 Issue!"
  },
  {
    "path": ".github/CONTRIBUTING.md",
    "chars": 1447,
    "preview": "# 参与共建\n\n这篇指南会指导你如何为 LinuxMirrors 贡献自己的一份力量,请你在提 issue 或者 pull request 之前花几分钟来阅读一遍这篇指南。\n\n## 行为准则\n\n我们有一份 [行为准则](https://gi"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug.yml",
    "chars": 1871,
    "preview": "name: 🐞 上报错误\ndescription: Report bug\nlabels: [\"bug\"]\nbody:\n  - type: dropdown\n    id: script_type\n    attributes:\n      "
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "chars": 27,
    "preview": "blank_issues_enabled: false"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature.yml",
    "chars": 192,
    "preview": "name: 💡 功能请求与建议\ndescription: Feature request\nlabels: [\"enhancement\"]\nbody:\n  - type: textarea\n    id: content\n    attrib"
  },
  {
    "path": ".github/workflows/auto-sync.yml",
    "chars": 732,
    "preview": "name: Sync to mirror repo\non:\n  push:\n    branches:\n      - main\njobs:\n  repo-sync:\n    env:\n      dst_key: ${{ secrets."
  },
  {
    "path": ".github/workflows/build-docs.yml",
    "chars": 1055,
    "preview": "name: Build docs website\non:\n  push:\n    branches:\n      - master\n      - main\npermissions:\n  contents: write\njobs:\n  de"
  },
  {
    "path": ".gitignore",
    "chars": 228,
    "preview": ".DS_Store\nsite/\ndist/\nnode_modules\n\n# local env files\n.env.local\n.env.*.local\n\n# Log files\nnpm-debug.log*\nyarn-debug.log"
  },
  {
    "path": "CHANGELOG.en-US.md",
    "chars": 3083,
    "preview": "2026-01-04\n\n* Added support for EndeavourOS [#30310f5](https://github.com/SuperManito/LinuxMirrors/commit/30310f5508b194"
  },
  {
    "path": "CHANGELOG.md",
    "chars": 2795,
    "preview": "2026-01-04\n\n* 新增适配 EndeavourOS 操作系统 [#30310f5](https://github.com/SuperManito/LinuxMirrors/commit/30310f5508b1943b647b54"
  },
  {
    "path": "CHANGELOG.zh-Hant.md",
    "chars": 2797,
    "preview": "2026-01-04\n\n* 新增適配 EndeavourOS 作業系統 [#30310f5](https://github.com/SuperManito/LinuxMirrors/commit/30310f5508b1943b647b54"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "chars": 5243,
    "preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nWe as members, contributors, and leaders pledge to make participa"
  },
  {
    "path": "ChangeMirrors.sh",
    "chars": 327412,
    "preview": "#!/bin/bash\n## Author: SuperManito\n## Modified: 2026-03-04\n## License: MIT\n## GitHub: https://github.com/SuperManito/Lin"
  },
  {
    "path": "ChangeMirrorsLite.sh",
    "chars": 271166,
    "preview": "#!/bin/bash\n## Author: SuperManito\n## Modified: 2026-03-04\n## License: MIT\n## GitHub: https://github.com/SuperManito/Lin"
  },
  {
    "path": "DockerInstallation.sh",
    "chars": 108568,
    "preview": "#!/bin/bash\n## Author: SuperManito\n## Modified: 2026-01-19\n## License: MIT\n## GitHub: https://github.com/SuperManito/Lin"
  },
  {
    "path": "DockerInstallationLite.sh",
    "chars": 69411,
    "preview": "#!/bin/bash\n## Author: SuperManito\n## Modified: 2026-01-19\n## License: MIT\n## GitHub: https://github.com/SuperManito/Lin"
  },
  {
    "path": "LICENSE",
    "chars": 1068,
    "preview": "MIT License\n\nCopyright (c) 2026 SuperManito\n\nPermission is hereby granted, free of charge, to any person obtaining a cop"
  },
  {
    "path": "README.en-US.md",
    "chars": 12059,
    "preview": "<div align=\"center\">\n<picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"/docs/assets/images/brand/dark/3"
  },
  {
    "path": "README.md",
    "chars": 11555,
    "preview": "<div align=\"center\">\n<picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"/docs/assets/images/brand/dark/3"
  },
  {
    "path": "README.zh-Hant.md",
    "chars": 11615,
    "preview": "<div align=\"center\">\n<picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"/docs/assets/images/brand/dark/3"
  },
  {
    "path": "SECURITY.md",
    "chars": 520,
    "preview": "# Security Policy\n\n## Supported Versions\n\nUse this section to tell people about which versions of your project are\ncurre"
  },
  {
    "path": "docs/assets/css/orama-ui.css",
    "chars": 5550,
    "preview": ".orama-ui {\n    -webkit-font-smoothing: antialiased;\n    -moz-osx-font-smoothing: grayscale;\n    font-family: var(--md-t"
  },
  {
    "path": "docs/assets/js/common.js",
    "chars": 5449,
    "preview": "const __p = typeof window !== 'undefined' && window.location && window.location.pathname ? window.location.pathname : ''"
  },
  {
    "path": "docs/assets/js/component.js",
    "chars": 171,
    "preview": "// 使用 mkdocs-material 与第三方 JavaScript 库集成的方法\ndocument$.subscribe(function () {\n    ComponentSystem.reinitializeAll()\n   "
  },
  {
    "path": "docs/assets/js/components/mirrors-table/data.js",
    "chars": 25404,
    "preview": "// 表格数据\nconst mirrorsTableData = [\n    {\n        name: __isZhHant ? '阿里雲' : __isEn ? 'Alibaba Cloud' : '阿里云',\n        of"
  },
  {
    "path": "docs/assets/js/components/mirrors-table/index.js",
    "chars": 23813,
    "preview": "ComponentSystem.register('mirrors-table', {\n    template: `\n<div>\n    <t-config-provider :global-config=\"globalConfig\">\n"
  },
  {
    "path": "docs/assets/js/components/orama-ui/config.js",
    "chars": 9934,
    "preview": "const OramaI18nData = {\n    'zh-Hans': {\n        suggestions: ['如何使用', '支持哪些系统'],\n        askAiText: '询问 AI',\n        se"
  },
  {
    "path": "docs/assets/js/components/orama-ui/index-native.js",
    "chars": 1997,
    "preview": "function loadOramaWebComponent() {\n    const searchBox = document.querySelector('orama-search-box')\n    if (searchBox) {"
  },
  {
    "path": "docs/assets/js/components/orama-ui/index.js",
    "chars": 1049,
    "preview": "function loadOramaWebComponent() {\n    const searchBox = document.querySelector('orama-search-box')\n    if (searchBox) {"
  },
  {
    "path": "docs/assets/js/modules/tdesign-theme.js",
    "chars": 952,
    "preview": "// 更新 TDesign 主题\nfunction updateTDesignGlobalTheme() {\n    const scheme = document.querySelector('[data-md-color-scheme]"
  },
  {
    "path": "docs/assets/js/useThemeTransition.js",
    "chars": 3978,
    "preview": "function useThemeTransition() {\n    // 更新过渡样式变量\n    function updateViewTransitionVariables(isDarkTheme) {\n        docume"
  },
  {
    "path": "docs/changelog/index.en.md",
    "chars": 3264,
    "preview": "---\nhide:\n  - navigation\n  - footer\nsearch:\n  exclude: true\n---\n\n### `2026-01-04`\n\n  * Added support for EndeavourOS [#3"
  },
  {
    "path": "docs/changelog/index.md",
    "chars": 2978,
    "preview": "---\nhide:\n  - navigation\n  - footer\nsearch:\n  exclude: true\n---\n\n### `2026-01-04`\n\n  * 新增适配 EndeavourOS 操作系统 [#30310f5]("
  },
  {
    "path": "docs/changelog/index.zh-Hant.md",
    "chars": 2978,
    "preview": "---\nhide:\n  - navigation\n  - footer\nsearch:\n  exclude: true\n---\n\n### `2026-01-04`\n\n  * 新增適配 EndeavourOS 作業系統 [#30310f5]("
  },
  {
    "path": "docs/changelog/sitemap.en.xml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "docs/changelog/sitemap.xml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "docs/changelog/sitemap.zh-Hant.xml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "docs/community/index.en.md",
    "chars": 216,
    "preview": "---\ncomments: true\ncomments_description: Please ensure that the discussion content is relevant to the project and do not"
  },
  {
    "path": "docs/community/index.md",
    "chars": 112,
    "preview": "---\ncomments: true\ncomments_description: 请确保讨论内容与项目的相关性,不得发布广告等违规内容\nhide:\n  - navigation\n  - toc\n  - footer\n---\n"
  },
  {
    "path": "docs/community/index.zh-Hant.md",
    "chars": 112,
    "preview": "---\ncomments: true\ncomments_description: 請確保討論內容與專案的相關性,不得發布廣告等違規內容\nhide:\n  - navigation\n  - toc\n  - footer\n---\n"
  },
  {
    "path": "docs/community/sitemap.en.xml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "docs/community/sitemap.xml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "docs/community/sitemap.zh-Hant.xml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "docs/index.en.md",
    "chars": 12057,
    "preview": "---\ntitle: One-Click Script Makes Mirror Switching Easier\ndescription: GNU/Linux mirror switching script & Docker instal"
  },
  {
    "path": "docs/index.md",
    "chars": 10349,
    "preview": "---\ntitle: 一键脚本使换源更简单\ndescription: GNU/Linux 更换系统软件源脚本及 Docker 安装与换源脚本\ncomments: true\nglightbox: false\ncomments_descript"
  },
  {
    "path": "docs/index.zh-Hant.md",
    "chars": 10316,
    "preview": "---\ntitle: 一鍵腳本讓換源更簡單\ndescription: GNU/Linux 更換系統軟體源腳本及 Docker 安裝與換源腳本\ncomments: true\nglightbox: false\ncomments_descript"
  },
  {
    "path": "docs/mirrors/index.en.md",
    "chars": 28978,
    "preview": "---\nhide:\n  - navigation\n  - toc\n  - feedback\n  - footer\nsearch:\n  exclude: true\n---\n\n## Chinese Mainland :flag-CN:\n\n<di"
  },
  {
    "path": "docs/mirrors/index.md",
    "chars": 23918,
    "preview": "---\nhide:\n  - navigation\n  - toc\n  - feedback\n  - footer\nsearch:\n  exclude: true\n---\n\n## 中国大陆 :flag-CN:\n\n<div id=\"mirror"
  },
  {
    "path": "docs/mirrors/index.zh-Hant.md",
    "chars": 23907,
    "preview": "---\nhide:\n  - navigation\n  - toc\n  - feedback\n  - footer\nsearch:\n  exclude: true\n---\n\n## 中國大陸 :flag-CN:\n\n<div id=\"mirror"
  },
  {
    "path": "docs/mirrors/sitemap.en.xml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "docs/mirrors/sitemap.xml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "docs/mirrors/sitemap.zh-Hant.xml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "docs/other/example1.md",
    "chars": 2612,
    "preview": "``` bash\n# !/bin/bash\nfunction install_docker() {\n    if command -v docker &>/dev/null; then\n        return\n    fi\n\n    "
  },
  {
    "path": "docs/other/example2.md",
    "chars": 573,
    "preview": "``` bash\n# !/bin/bash\nfunction install_docker() {\n    if command -v docker &>/dev/null; then\n        return\n    fi\n\n    "
  },
  {
    "path": "docs/other/index.en.md",
    "chars": 27513,
    "preview": "---\nhide:\n  - navigation\n  - footer\n---\n\n# :simple-docker:{style=\"color: #1d63ed\"} Docker Installation & Registry Mirror"
  },
  {
    "path": "docs/other/index.md",
    "chars": 20284,
    "preview": "---\nhide:\n  - navigation\n  - footer\n---\n\n# :simple-docker:{style=\"color: #1d63ed\"} Docker 安装与换源脚本\n\n## 一键执行命令\n\n=== \"安装\"\n\n"
  },
  {
    "path": "docs/other/index.zh-Hant.md",
    "chars": 21081,
    "preview": "---\nhide:\n  - navigation\n  - footer\n---\n\n# :simple-docker:{style=\"color: #1d63ed\"} Docker 安裝與換源腳本\n\n## 一鍵執行命令\n\n=== \"安裝\"\n\n"
  },
  {
    "path": "docs/other/sitemap.en.xml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "docs/other/sitemap.xml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "docs/other/sitemap.zh-Hant.xml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "docs/sitemap.en.xml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "docs/sitemap.xml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "docs/sitemap.zh-Hant.xml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "docs/sponsor/index.en.md",
    "chars": 787,
    "preview": "---\nhide:\n  - navigation\n  - toc\n  - footer\n---\n\n--8<-- \"docs/sponsor/main.html\"\n\n#\n\n<figure style=\"margin: 0 auto\" mark"
  },
  {
    "path": "docs/sponsor/index.md",
    "chars": 713,
    "preview": "---\nhide:\n  - navigation\n  - toc\n  - footer\n---\n\n--8<-- \"docs/sponsor/main.html\"\n\n#\n\n<figure style=\"margin: 0 auto\" mark"
  },
  {
    "path": "docs/sponsor/index.zh-Hant.md",
    "chars": 726,
    "preview": "---\nhide:\n  - navigation\n  - toc\n  - feedback\n  - footer\n---\n\n--8<-- \"docs/sponsor/main.html\"\n\n#\n\n<figure style=\"margin:"
  },
  {
    "path": "docs/sponsor/main.html",
    "chars": 8548,
    "preview": "<div class=\"sponsor\">\n  <div class=\"sponsor-label\">\n    <strong class=\"sponsor-text-1\"></strong>\n  </div>\n  <div class=\""
  },
  {
    "path": "docs/sponsor/sitemap.en.xml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "docs/sponsor/sitemap.xml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "docs/sponsor/sitemap.zh-Hant.xml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "docs/stylesheets/extra.css",
    "chars": 17784,
    "preview": ":root {\n    --md-text-font: system-ui, -apple-system, 'Roboto', 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', 'S"
  },
  {
    "path": "docs/theme/main.html",
    "chars": 1207,
    "preview": "{% extends \"base.html\" %}\n\n{% block scripts %}\n  <script type=\"module\" src=\"https://unpkg.com/@orama/wc-components@lates"
  },
  {
    "path": "docs/theme/partials/comments.html",
    "chars": 1759,
    "preview": "{% if page.meta.comments %}\n  <h2 id=\"__comments\">{{ lang.t(\"meta.comments\") }}</h2>\n  {% if page.meta.comments_descript"
  },
  {
    "path": "docs/theme/partials/content.html",
    "chars": 380,
    "preview": "{% include \"partials/tags.html\" %}\n\n{% include \"partials/actions.html\" %}\n\n{% if \"\\u003ch1\" not in page.content %}\n  <h1"
  },
  {
    "path": "docs/theme/partials/copyright.html",
    "chars": 649,
    "preview": "<div class=\"md-copyright\">\n  <div class=\"md-copyright__highlight\">\n    {% if config.copyright %}\n      {{ config.copyrig"
  },
  {
    "path": "docs/theme/partials/header.html",
    "chars": 2624,
    "preview": "{% set class = \"md-header\" %}\n{% if \"navigation.tabs.sticky\" in features %}\n  {% set class = class ~ \" md-header--shadow"
  },
  {
    "path": "docs/theme/partials/palette.html",
    "chars": 1148,
    "preview": "<form class=\"md-header__option\" data-md-component=\"palette\">\n  {% for option in config.theme.palette %}\n    {% set schem"
  },
  {
    "path": "docs/theme/partials/search.html",
    "chars": 4137,
    "preview": "<a class=\"md-header__button md-icon coze-icon-wrapper\" href=\"https://www.coze.cn/store/agent/7503197985959428108?bot_id="
  },
  {
    "path": "docs/theme/partials/toc.html",
    "chars": 9658,
    "preview": "<nav class=\"md-nav md-nav--secondary\" aria-label=\"{{ title }}\">\n  {% set toc = page.toc %} {% set first = toc | first %}"
  },
  {
    "path": "docs/use/index.en.md",
    "chars": 38609,
    "preview": "---\nhide:\n  - navigation\n  - footer\n---\n\n## One-Click Command\n\n=== \":material-home-city: Chinese mainland\"\n\n    !!! quot"
  },
  {
    "path": "docs/use/index.md",
    "chars": 27970,
    "preview": "---\nhide:\n  - navigation\n  - footer\n---\n\n## 一键执行命令\n\n=== \":material-home-city: 中国大陆\"\n\n    !!! quote \"\"\n\n        === \":lin"
  },
  {
    "path": "docs/use/index.zh-Hant.md",
    "chars": 28450,
    "preview": "---\nhide:\n  - navigation\n  - footer\n---\n\n## 一鍵執行命令\n\n=== \":material-home-city: 中國大陸\"\n\n    !!! quote \"\"\n\n        === \":lin"
  },
  {
    "path": "docs/use/repo-branchs.md",
    "chars": 7290,
    "preview": "| SYSTEM | NAMES |\n| --- | :---: |\n| <a href=\"https://www.debian.org\" title=\"https://www.debian.org\" target=\"_blank\" rel"
  },
  {
    "path": "docs/use/sitemap.en.xml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "docs/use/sitemap.xml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "docs/use/sitemap.zh-Hant.xml",
    "chars": 1,
    "preview": "\n"
  },
  {
    "path": "giscus.json",
    "chars": 39,
    "preview": "{\n    \"defaultCommentOrder\": \"newest\"\n}"
  },
  {
    "path": "locales/docker/en.sh",
    "chars": 10320,
    "preview": "MESSAGE_CONTENTS=(\n    ['start.welcome']='Docker installation & mirror switcher'\n    ['start.runtimeEnv']='Runtime Env'\n"
  },
  {
    "path": "locales/docker/zh-hans.sh",
    "chars": 7198,
    "preview": "MESSAGE_CONTENTS=(\n    ['start.welcome']='欢迎使用 Docker Engine 安装与换源脚本'\n    ['start.runtimeEnv']='运行环境'\n    ['start.dateTi"
  },
  {
    "path": "locales/docker/zh-hant.sh",
    "chars": 7220,
    "preview": "MESSAGE_CONTENTS=(\n    ['start.welcome']='歡迎使用 Docker Engine 安裝與換源腳本'\n    ['start.runtimeEnv']='執行環境'\n    ['start.dateTi"
  },
  {
    "path": "locales/linux/en.sh",
    "chars": 16019,
    "preview": "MESSAGE_CONTENTS=(\n    ['start.welcome']='  GNU/Linux mirror switching script'\n    ['start.runtimeEnv']='Runtime Env'\n  "
  },
  {
    "path": "locales/linux/zh-hans.sh",
    "chars": 11787,
    "preview": "MESSAGE_CONTENTS=(\n    ['start.welcome']='欢迎使用 GNU/Linux 更换系统软件源脚本'\n    ['start.runtimeEnv']='运行环境'\n    ['start.dateTime"
  },
  {
    "path": "locales/linux/zh-hant.sh",
    "chars": 11931,
    "preview": "MESSAGE_CONTENTS=(\n    ['start.welcome']='歡迎使用 GNU/Linux 更換系統軟體源腳本'\n    ['start.runtimeEnv']='執行環境'\n    ['start.dateTime"
  },
  {
    "path": "mkdocs.yml",
    "chars": 6017,
    "preview": "site_name: LinuxMirrors\nrepo_name: LinuxMirrors\nrepo_url: https://github.com/SuperManito/LinuxMirrors\nedit_uri: edit/mai"
  },
  {
    "path": "netlify.toml",
    "chars": 337,
    "preview": "[[headers]]\n  for = \"/*.js\"\n  [headers.values]\n    Cache-Control = \"public, max-age=31536000, must-revalidate\"\n\n[[header"
  },
  {
    "path": "requirements.txt",
    "chars": 148,
    "preview": "mkdocs-material==9.7.4\nmkdocs-glightbox==0.5.2\nmkdocs-exclude-search==0.6.6\n# mkdocs-minify-plugin==0.8.0\nmkdocs-static-"
  }
]

// ... and 1 more files (download for full content)

About this extraction

This page contains the full source code of the SuperManito/LinuxMirrors GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 97 files (1.3 MB), approximately 400.9k tokens, and a symbol index with 36 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!