From e8c0085c47e3316ba68d476dab82fdb0d0a9af4d Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Tue, 27 May 2025 18:43:09 +0800 Subject: [PATCH] Prerelease `v0.2.1.1` --- src/chsrc-main.c | 6 +++--- src/recipe/os/pacman/Arch-Linux.c | 27 +++++++++++++++------------ src/recipe/recipe-template.c | 18 +++++++++++++----- 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 2730e9d..f9b6e30 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -27,13 +27,13 @@ * | MadDogOwner * | * Created On : <2023-08-28> - * Last Modified : <2025-04-15> + * Last Modified : <2025-05-27> * * chsrc: Change Source —— 全平台通用命令行换源工具 * ------------------------------------------------------------*/ -#define Chsrc_Version "0.2.1" -#define Chsrc_Release_Date "2025/04/13" +#define Chsrc_Version "0.2.1.1" +#define Chsrc_Release_Date "2025/05/27" #define Chsrc_Maintain_URL "https://github.com/RubyMetric/chsrc" #define Chsrc_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc" diff --git a/src/recipe/os/pacman/Arch-Linux.c b/src/recipe/os/pacman/Arch-Linux.c index 5bef75e..9317f34 100644 --- a/src/recipe/os/pacman/Arch-Linux.c +++ b/src/recipe/os/pacman/Arch-Linux.c @@ -83,7 +83,7 @@ os_arch_setsrc (char *option) to_write = xy_strjoin (3, "Server = ", source.url, "arm/$arch/$repo"); } - // 越前面的优先级越高 + /* 配置文件中,越前面的优先级越高 */ chsrc_prepend_to_file (to_write, OS_Pacman_MirrorList); if (is_x86) @@ -120,19 +120,22 @@ os_archlinuxcn_setsrc (char *option) chsrc_backup (OS_Pacman_ArchLinuxCN_MirrorList); char *arch = chsrc_get_cpuarch (); - - // 检查是否已存在 archlinuxcn 配置段 + + /* 检查是否已存在 archlinuxcn 配置段 */ char *check_cmd = "grep -q '\\[archlinuxcn\\]' " OS_Pacman_ArchLinuxCN_MirrorList; int ret = system(check_cmd); - - if (ret == 0) { - char *sed_cmd = xy_strjoin (4, "sed -i '/\\[archlinuxcn\\]/{n;s|^Server = .*|Server = ", - source.url, "$arch|;}' ", OS_Pacman_ArchLinuxCN_MirrorList); - chsrc_run (sed_cmd, RunOpt_Default); - } else { - char *archlinuxcn_config = xy_strjoin (3, "\n[archlinuxcn]\nServer = ", source.url, "$arch\n"); - chsrc_append_to_file (archlinuxcn_config, OS_Pacman_ArchLinuxCN_MirrorList); - } + + if (ret == 0) + { + char *sed_cmd = xy_strjoin (4, "sed -i '/\\[archlinuxcn\\]/{n;s|^Server = .*|Server = ", + source.url, "$arch|;}' ", OS_Pacman_ArchLinuxCN_MirrorList); + chsrc_run (sed_cmd, RunOpt_Default); + } + else + { + char *archlinuxcn_config = xy_strjoin (3, "\n[archlinuxcn]\nServer = ", source.url, "$arch\n"); + chsrc_append_to_file (archlinuxcn_config, OS_Pacman_ArchLinuxCN_MirrorList); + } chsrc_run ("pacman-key --lsign-key \"farseerfc@archlinux.org\"", RunOpt_Dont_Abort_On_Failure); // 此命令可能会失败, 但对换源没有影响 chsrc_run ("pacman -Sy archlinuxcn-keyring", RunOpt_Default); diff --git a/src/recipe/recipe-template.c b/src/recipe/recipe-template.c index 4a77d9c..fc40612 100644 --- a/src/recipe/recipe-template.c +++ b/src/recipe/recipe-template.c @@ -4,6 +4,7 @@ * File Name : recipe-template.c * File Authors : Aoran Zeng * Contributors : Nil Null + * | * Created On : <2024-08-09> * Last Modified : <2024-11-22> * ------------------------------------------------------------- @@ -13,21 +14,28 @@ * * 模版中: * 为该换源目标的名称 - * 为该换源目标的类别,仅有3类: pl, os, wr + * 为该换源目标的类别,仅有3类: pl, os, wr * 分别对应3个子目录: lang, os, ware * ------------------------------------------------------------*/ -/* 模版文件从下行正式开始 */ + +/* 模版文件内容从下方第30行正式开始 */ + + + + + /** ------------------------------------------------------------ * SPDX-License-Identifier: GPL-3.0-or-later * ------------------------------------------------------------- * File Name : .c * File Authors : Nil Null 尼尔闹先生 * Contributors : Nul None 怒了馕女士 - * Created On : <2024-01-01> https://www.yuque.com/ccmywish/blog/nil-null-and-nul-none - * Last Modified : <2024-01-01> 请更新文件标头 + * | + * Created On : <2025-01-01> https://www.yuque.com/ccmywish/blog/nil-null-and-nul-none + * Last Modified : <2025-01-01> 请更新文件标头 * ------------------------------------------------------------*/ /** @@ -42,7 +50,7 @@ RubyMetric = {"rbmt", // chsrc set rbmt "https://rubymetirc.com/target/aws/aws-sdk-go/@v/v1.45.2.zip"}; /** - * @update 2024-08-09 + * @update 2025-12-31 * @note 该target的各个源地址,该例数据为虚拟填充 */ static Source_t