From bdb11426c62aa6e7f10ad44ae76bd9f7458bed6b Mon Sep 17 00:00:00 2001 From: Super Manito <68613938+SuperManito@users.noreply.github.com> Date: Tue, 16 Jun 2026 19:19:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=80=82=E9=85=8D=20Void=20L?= =?UTF-8?q?inux=20=E6=93=8D=E4=BD=9C=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.en-US.md | 4 ++ CHANGELOG.md | 4 ++ CHANGELOG.zh-Hant.md | 4 ++ ChangeMirrors.sh | 67 +++++++++++++++--- ChangeMirrorsLite.sh | 67 +++++++++++++++--- README.en-US.md | 4 ++ README.md | 4 ++ README.zh-Hant.md | 4 ++ docs/assets/images/icon/void-linux.png | Bin 0 -> 5800 bytes .../js/components/mirrors-table/data.js | 32 ++++++++- .../js/components/mirrors-table/index.js | 4 +- docs/changelog/index.en.md | 4 ++ docs/changelog/index.md | 4 ++ docs/changelog/index.zh-Hant.md | 4 ++ docs/index.en.md | 3 +- docs/index.md | 3 +- docs/index.zh-Hant.md | 3 +- docs/use/repo-branchs.md | 3 +- 18 files changed, 192 insertions(+), 26 deletions(-) create mode 100644 docs/assets/images/icon/void-linux.png diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 38ddbd4..c15fb6d 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -1,3 +1,7 @@ +2026-06-16 + +* Added support for Void Linux + 2026-01-04 * Added support for EndeavourOS [#30310f5](https://github.com/SuperManito/LinuxMirrors/commit/30310f5508b1943b647b54834dd60c206d9fb366) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cdaf2e..d09305b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +2026-06-16 + +* 新增适配 Void Linux 操作系统 + 2026-01-04 * 新增适配 EndeavourOS 操作系统 [#30310f5](https://github.com/SuperManito/LinuxMirrors/commit/30310f5508b1943b647b54834dd60c206d9fb366) diff --git a/CHANGELOG.zh-Hant.md b/CHANGELOG.zh-Hant.md index 1cd5fdc..9f450ae 100644 --- a/CHANGELOG.zh-Hant.md +++ b/CHANGELOG.zh-Hant.md @@ -1,3 +1,7 @@ +2026-06-16 + +* 新增適配 Void Linux 作業系統 + 2026-01-04 * 新增適配 EndeavourOS 作業系統 [#30310f5](https://github.com/SuperManito/LinuxMirrors/commit/30310f5508b1943b647b54834dd60c206d9fb366) diff --git a/ChangeMirrors.sh b/ChangeMirrors.sh index f0e548d..62e00c4 100755 --- a/ChangeMirrors.sh +++ b/ChangeMirrors.sh @@ -1,6 +1,6 @@ #!/bin/bash ## Author: SuperManito -## Modified: 2026-06-08 +## Modified: 2026-06-16 ## License: MIT ## GitHub: https://github.com/SuperManito/LinuxMirrors ## Website: https://linuxmirrors.cn @@ -214,6 +214,7 @@ SYSTEM_MANJARO="Manjaro" SYSTEM_ALPINE="Alpine" SYSTEM_GENTOO="Gentoo" SYSTEM_NIXOS="NixOS" +SYSTEM_VOID="Void" ## 定义系统版本文件 File_LinuxRelease=/etc/os-release @@ -245,6 +246,8 @@ Dir_ZYppRepos=/etc/zypp/repos.d Dir_ZYppReposBackup=$Dir_ZYppRepos.bak Dir_GentooReposConf=/etc/portage/repos.conf Dir_NixConfig=/etc/nix +Dir_XbpsRepos=/etc/xbps.d +Dir_XbpsReposBackup=$Dir_XbpsRepos.bak File_AptSourceList=/etc/apt/sources.list File_AptSourceListBackup=$File_AptSourceList.bak File_DebianSources=$Dir_AptAdditionalSources/debian.sources @@ -834,6 +837,8 @@ function collect_system_info() { SYSTEM_FACTIONS="${SYSTEM_OPENSUSE}" elif [[ "${SYSTEM_NAME}" == *"NixOS"* ]]; then SYSTEM_FACTIONS="${SYSTEM_NIXOS}" + elif [[ "${SYSTEM_ID}" == "void" ]]; then + SYSTEM_FACTIONS="${SYSTEM_VOID}" else unsupport_system_error "$(msg "error.unknownSystem")" fi @@ -978,7 +983,7 @@ function collect_system_info() { ;; # 理论全部支持或不作判断 "${SYSTEM_KALI}" | "${SYSTEM_DEEPIN}" | "${SYSTEM_ZORIN}" | "${SYSTEM_RASPBERRY_PI_OS}" | "${SYSTEM_OPENKYLIN}") ;; - "${SYSTEM_ARCH}" | "${SYSTEM_MANJARO}" | "${SYSTEM_ALPINE}" | "${SYSTEM_GENTOO}" | "${SYSTEM_NIXOS}") ;; + "${SYSTEM_ARCH}" | "${SYSTEM_MANJARO}" | "${SYSTEM_ALPINE}" | "${SYSTEM_GENTOO}" | "${SYSTEM_NIXOS}" | "${SYSTEM_VOID}") ;; *) unsupport_system_error "$(msg "error.unknownVersion")" ;; @@ -1104,6 +1109,9 @@ function collect_system_info() { "${SYSTEM_NIXOS}") SOURCE_BRANCH="nix-channels" ;; + "${SYSTEM_VOID}") + SOURCE_BRANCH="voidlinux" + ;; esac fi ## 定义软件源更新文字 @@ -1117,7 +1125,7 @@ function collect_system_info() { "${SYSTEM_OPENSUSE}") SYNC_MIRROR_TEXT="$(msg "source.sync.text3")" ;; - "${SYSTEM_ARCH}" | "${SYSTEM_GENTOO}") + "${SYSTEM_ARCH}" | "${SYSTEM_GENTOO}" | "${SYSTEM_VOID}") SYNC_MIRROR_TEXT="$(msg "source.sync.text4")" ;; "${SYSTEM_NIXOS}") @@ -1519,20 +1527,21 @@ function backup_original_mirrors() { function backup_dir() { local target_dir=$1 local backup_dir=$2 + local file_type="${3:-repo}" [ -d "${target_dir}" ] || mkdir -p "${target_dir}" [ -d "${backup_dir}" ] || mkdir -p "${backup_dir}" - ## 判断是否存在 repo 源文件 - ls "${target_dir}" | grep '\.repo$' -q + ## 判断是否存在软件源文件 + ls "${target_dir}" | grep "\.${file_type}$" -q if [ $? -ne 0 ]; then return fi - ## 判断是否存在已备份的 repo 源文件 - ls "${backup_dir}" | grep '\.repo$' -q + ## 判断是否存在已备份的软件源文件 + ls "${backup_dir}" | grep "\.${file_type}$" -q if [ $? -eq 0 ]; then if [[ "${IGNORE_BACKUP_TIPS}" != "false" ]]; then return fi - local ask_text="$(msg "interaction.backup.skipOverwrite.sourceFile" "repo")?" + local ask_text="$(msg "interaction.backup.skipOverwrite.sourceFile" "${file_type}")?" if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then echo '' interactive_select_boolean "${BOLD}${ask_text}${PLAIN}" @@ -1561,7 +1570,7 @@ function backup_original_mirrors() { echo '' cp -rvf $target_dir/* "${backup_dir}" 2>&1 BACKED_UP="true" - echo -e "\n$COMPLETE $(msg "info.backuped.sourceFile" "repo")" + echo -e "\n$COMPLETE $(msg "info.backuped.sourceFile" "${file_type}")" sleep 1s fi } @@ -1647,6 +1656,10 @@ function backup_original_mirrors() { # /etc/nix/nix.conf backup_file $File_NixConf $File_NixConfBackup "nix.conf" ;; + "${SYSTEM_VOID}") + # /etc/xbps.d + backup_dir $Dir_XbpsRepos $Dir_XbpsReposBackup "conf" + ;; esac fi } @@ -1825,6 +1838,13 @@ function remove_original_mirrors() { "${SYSTEM_GENTOO}") clear_file $File_GentooReposConf ;; + "${SYSTEM_VOID}") + if [ ! -d "${Dir_XbpsRepos}" ]; then + mkdir -p "${Dir_XbpsRepos}" + return + fi + rm -rf $Dir_XbpsRepos/*-repository-*.conf + ;; esac } @@ -1914,6 +1934,9 @@ function change_mirrors_main() { "${SYSTEM_NIXOS}") diff_file $File_NixConfBackup $File_NixConf ;; + "${SYSTEM_VOID}") + diff_dir $Dir_XbpsReposBackup $Dir_XbpsRepos + ;; esac fi } @@ -1955,6 +1978,9 @@ function change_mirrors_main() { "${SYSTEM_NIXOS}") change_mirrors_NixOS ;; + "${SYSTEM_VOID}") + change_mirrors_Void + ;; esac ## 比较差异 if [[ "${PRINT_DIFF}" == "true" ]]; then @@ -1986,6 +2012,9 @@ function change_mirrors_main() { commands+=("nix-store --verify") commands+=("nix-channel --update") ;; + "${SYSTEM_VOID}") + commands+=("xbps-install -S") + ;; esac if [[ "${PURE_MODE}" == "true" ]]; then local exec_cmd="" @@ -2108,6 +2137,9 @@ function upgrade_software() { "${SYSTEM_NIXOS}") commands+=("nixos-rebuild switch") ;; + "${SYSTEM_VOID}") + commands+=("xbps-install -yu") + ;; esac if [[ "${PURE_MODE}" == "true" ]]; then local exec_cmd="" @@ -2155,6 +2187,9 @@ function upgrade_software() { "${SYSTEM_NIXOS}") nix-collect-garbage -d >/dev/null 2>&1 ;; + "${SYSTEM_VOID}") + xbps-remove -O >/dev/null 2>&1 + ;; esac } @@ -3261,6 +3296,20 @@ function change_mirrors_NixOS() { nix-channel --update >/dev/null 2>&1 } +## 更换 Void Linux 软件源 +function change_mirrors_Void() { + [ -d "${Dir_XbpsRepos}" ] || mkdir -p $Dir_XbpsRepos + cp -rvf /usr/share/xbps.d/*-repository-*.conf $Dir_XbpsRepos + ## 使用官方源 + [[ "${USE_OFFICIAL_SOURCE}" == "true" ]] && return + + ## 修改源 + cd $Dir_XbpsRepos + sed -e "s|https://repo-default.voidlinux.org|${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}|g" \ + -i \ + *-repository-*.conf +} + ## EPEL (Extra Packages for Enterprise Linux) 附加软件包 - 安装或更换软件源 function change_mirrors_or_install_EPEL() { if [[ "${INSTALL_EPEL}" != "true" ]]; then diff --git a/ChangeMirrorsLite.sh b/ChangeMirrorsLite.sh index 9b19b65..f1e90e5 100755 --- a/ChangeMirrorsLite.sh +++ b/ChangeMirrorsLite.sh @@ -1,6 +1,6 @@ #!/bin/bash ## Author: SuperManito -## Modified: 2026-06-08 +## Modified: 2026-06-16 ## License: MIT ## GitHub: https://github.com/SuperManito/LinuxMirrors ## Website: https://linuxmirrors.cn @@ -42,6 +42,7 @@ SYSTEM_MANJARO="Manjaro" SYSTEM_ALPINE="Alpine" SYSTEM_GENTOO="Gentoo" SYSTEM_NIXOS="NixOS" +SYSTEM_VOID="Void" ## 定义系统版本文件 File_LinuxRelease=/etc/os-release @@ -73,6 +74,8 @@ Dir_ZYppRepos=/etc/zypp/repos.d Dir_ZYppReposBackup=$Dir_ZYppRepos.bak Dir_GentooReposConf=/etc/portage/repos.conf Dir_NixConfig=/etc/nix +Dir_XbpsRepos=/etc/xbps.d +Dir_XbpsReposBackup=$Dir_XbpsRepos.bak File_AptSourceList=/etc/apt/sources.list File_AptSourceListBackup=$File_AptSourceList.bak File_DebianSources=$Dir_AptAdditionalSources/debian.sources @@ -523,6 +526,8 @@ function collect_system_info() { SYSTEM_FACTIONS="${SYSTEM_OPENSUSE}" elif [[ "${SYSTEM_NAME}" == *"NixOS"* ]]; then SYSTEM_FACTIONS="${SYSTEM_NIXOS}" + elif [[ "${SYSTEM_ID}" == "void" ]]; then + SYSTEM_FACTIONS="${SYSTEM_VOID}" else unsupport_system_error "$(msg "error.unknownSystem")" fi @@ -667,7 +672,7 @@ function collect_system_info() { ;; # 理论全部支持或不作判断 "${SYSTEM_KALI}" | "${SYSTEM_DEEPIN}" | "${SYSTEM_ZORIN}" | "${SYSTEM_RASPBERRY_PI_OS}" | "${SYSTEM_OPENKYLIN}") ;; - "${SYSTEM_ARCH}" | "${SYSTEM_MANJARO}" | "${SYSTEM_ALPINE}" | "${SYSTEM_GENTOO}" | "${SYSTEM_NIXOS}") ;; + "${SYSTEM_ARCH}" | "${SYSTEM_MANJARO}" | "${SYSTEM_ALPINE}" | "${SYSTEM_GENTOO}" | "${SYSTEM_NIXOS}" | "${SYSTEM_VOID}") ;; *) unsupport_system_error "$(msg "error.unknownVersion")" ;; @@ -793,6 +798,9 @@ function collect_system_info() { "${SYSTEM_NIXOS}") SOURCE_BRANCH="nix-channels" ;; + "${SYSTEM_VOID}") + SOURCE_BRANCH="voidlinux" + ;; esac fi ## 定义软件源更新文字 @@ -806,7 +814,7 @@ function collect_system_info() { "${SYSTEM_OPENSUSE}") SYNC_MIRROR_TEXT="$(msg "source.sync.text3")" ;; - "${SYSTEM_ARCH}" | "${SYSTEM_GENTOO}") + "${SYSTEM_ARCH}" | "${SYSTEM_GENTOO}" | "${SYSTEM_VOID}") SYNC_MIRROR_TEXT="$(msg "source.sync.text4")" ;; "${SYSTEM_NIXOS}") @@ -901,20 +909,21 @@ function backup_original_mirrors() { function backup_dir() { local target_dir=$1 local backup_dir=$2 + local file_type="${3:-repo}" [ -d "${target_dir}" ] || mkdir -p "${target_dir}" [ -d "${backup_dir}" ] || mkdir -p "${backup_dir}" - ## 判断是否存在 repo 源文件 - ls "${target_dir}" | grep '\.repo$' -q + ## 判断是否存在软件源文件 + ls "${target_dir}" | grep "\.${file_type}$" -q if [ $? -ne 0 ]; then return fi - ## 判断是否存在已备份的 repo 源文件 - ls "${backup_dir}" | grep '\.repo$' -q + ## 判断是否存在已备份的软件源文件 + ls "${backup_dir}" | grep "\.${file_type}$" -q if [ $? -eq 0 ]; then if [[ "${IGNORE_BACKUP_TIPS}" != "false" ]]; then return fi - local ask_text="$(msg "interaction.backup.skipOverwrite.sourceFile" "repo")?" + local ask_text="$(msg "interaction.backup.skipOverwrite.sourceFile" "${file_type}")?" if [[ "${CAN_USE_ADVANCED_INTERACTIVE_SELECTION}" == "true" ]]; then echo '' interactive_select_boolean "${BOLD}${ask_text}${PLAIN}" @@ -943,7 +952,7 @@ function backup_original_mirrors() { echo '' cp -rvf $target_dir/* "${backup_dir}" 2>&1 BACKED_UP="true" - echo -e "\n$COMPLETE $(msg "info.backuped.sourceFile" "repo")" + echo -e "\n$COMPLETE $(msg "info.backuped.sourceFile" "${file_type}")" sleep 1s fi } @@ -1029,6 +1038,10 @@ function backup_original_mirrors() { # /etc/nix/nix.conf backup_file $File_NixConf $File_NixConfBackup "nix.conf" ;; + "${SYSTEM_VOID}") + # /etc/xbps.d + backup_dir $Dir_XbpsRepos $Dir_XbpsReposBackup "conf" + ;; esac fi } @@ -1207,6 +1220,13 @@ function remove_original_mirrors() { "${SYSTEM_GENTOO}") clear_file $File_GentooReposConf ;; + "${SYSTEM_VOID}") + if [ ! -d "${Dir_XbpsRepos}" ]; then + mkdir -p "${Dir_XbpsRepos}" + return + fi + rm -rf $Dir_XbpsRepos/*-repository-*.conf + ;; esac } @@ -1296,6 +1316,9 @@ function change_mirrors_main() { "${SYSTEM_NIXOS}") diff_file $File_NixConfBackup $File_NixConf ;; + "${SYSTEM_VOID}") + diff_dir $Dir_XbpsReposBackup $Dir_XbpsRepos + ;; esac fi } @@ -1337,6 +1360,9 @@ function change_mirrors_main() { "${SYSTEM_NIXOS}") change_mirrors_NixOS ;; + "${SYSTEM_VOID}") + change_mirrors_Void + ;; esac ## 比较差异 if [[ "${PRINT_DIFF}" == "true" ]]; then @@ -1368,6 +1394,9 @@ function change_mirrors_main() { commands+=("nix-store --verify") commands+=("nix-channel --update") ;; + "${SYSTEM_VOID}") + commands+=("xbps-install -S") + ;; esac if [[ "${PURE_MODE}" == "true" ]]; then local exec_cmd="" @@ -1490,6 +1519,9 @@ function upgrade_software() { "${SYSTEM_NIXOS}") commands+=("nixos-rebuild switch") ;; + "${SYSTEM_VOID}") + commands+=("xbps-install -yu") + ;; esac if [[ "${PURE_MODE}" == "true" ]]; then local exec_cmd="" @@ -1537,6 +1569,9 @@ function upgrade_software() { "${SYSTEM_NIXOS}") nix-collect-garbage -d >/dev/null 2>&1 ;; + "${SYSTEM_VOID}") + xbps-remove -O >/dev/null 2>&1 + ;; esac } @@ -2643,6 +2678,20 @@ function change_mirrors_NixOS() { nix-channel --update >/dev/null 2>&1 } +## 更换 Void Linux 软件源 +function change_mirrors_Void() { + [ -d "${Dir_XbpsRepos}" ] || mkdir -p $Dir_XbpsRepos + cp -rvf /usr/share/xbps.d/*-repository-*.conf $Dir_XbpsRepos + ## 使用官方源 + [[ "${USE_OFFICIAL_SOURCE}" == "true" ]] && return + + ## 修改源 + cd $Dir_XbpsRepos + sed -e "s|https://repo-default.voidlinux.org|${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}|g" \ + -i \ + *-repository-*.conf +} + ## EPEL (Extra Packages for Enterprise Linux) 附加软件包 - 安装或更换软件源 function change_mirrors_or_install_EPEL() { if [[ "${INSTALL_EPEL}" != "true" ]]; then diff --git a/README.en-US.md b/README.en-US.md index b45ea4f..17bbd05 100644 --- a/README.en-US.md +++ b/README.en-US.md @@ -129,6 +129,10 @@
diff --git a/README.md b/README.md index b1a5fe8..23c082a 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,10 @@
diff --git a/README.zh-Hant.md b/README.zh-Hant.md index 04644b2..b19471b 100644 --- a/README.zh-Hant.md +++ b/README.zh-Hant.md @@ -129,6 +129,10 @@
diff --git a/docs/assets/images/icon/void-linux.png b/docs/assets/images/icon/void-linux.png
new file mode 100644
index 0000000000000000000000000000000000000000..fd3ec045d08445cdd73c7413e01a89754827593f
GIT binary patch
literal 5800
zcmV;Z7FX$sP)
**Alpine Linux** | _v3 / edge_ |
| **Gentoo** | _all_ |
|
**NixOS** | _19~25_ |
+|
**Void Linux** | _all_ |
diff --git a/docs/index.md b/docs/index.md
index 2211449..6557988 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -54,7 +54,7 @@ hide:
---
- 已适配 `26+` 操作系统,涵盖各类版本,精准识别系统类型
+ 已适配 `27+` 操作系统,涵盖各类版本,精准识别系统类型
脚本兼容性高,不支持的系统会有相应提示并无操作跳出
- :material-vector-triangle:{ .lg .middle } __多元软件源适配__
@@ -131,6 +131,7 @@ hide:
|
**Alpine Linux** | _v3 / edge_ |
| **Gentoo** | _all_ |
|
**NixOS** | _19~25_ |
+|
**Void Linux** | _all_ |
diff --git a/docs/index.zh-Hant.md b/docs/index.zh-Hant.md
index cfc2131..1b2c728 100644
--- a/docs/index.zh-Hant.md
+++ b/docs/index.zh-Hant.md
@@ -54,7 +54,7 @@ hide:
---
- 已適配 `26+` 作業系統,涵蓋各類版本,精準辨識系統類型
+ 已適配 `27+` 作業系統,涵蓋各類版本,精準辨識系統類型
腳本相容性高,不支援的系統會有對應提示並無操作跳出
- :material-vector-triangle:{ .lg .middle } __多元軟體源適配__
@@ -131,6 +131,7 @@ hide:
|
**Alpine Linux** | _v3 / edge_ |
| **Gentoo** | _all_ |
|
**NixOS** | _19~25_ |
+|
**Void Linux** | _all_ |
diff --git a/docs/use/repo-branchs.md b/docs/use/repo-branchs.md
index 747ec70..9b8a663 100644
--- a/docs/use/repo-branchs.md
+++ b/docs/use/repo-branchs.md
@@ -25,4 +25,5 @@
|
**EndeavourOS** | `endeavouros` |
|
**Alpine Linux** | `alpine` |
| **Gentoo** | `gentoo` `gentoo-portage` |
-|
**NixOS** | `nix-channels` |
\ No newline at end of file
+|
**NixOS** | `nix-channels` |
+|
**Void Linux** | `voidlinux` |
\ No newline at end of file