Skip to content

Commit e8c0085

Browse files
committed
Prerelease v0.2.1.1
1 parent 61a049b commit e8c0085

3 files changed

Lines changed: 31 additions & 20 deletions

File tree

src/chsrc-main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
* | MadDogOwner <xiaoran@xrgzs.top>
2828
* |
2929
* Created On : <2023-08-28>
30-
* Last Modified : <2025-04-15>
30+
* Last Modified : <2025-05-27>
3131
*
3232
* chsrc: Change Source —— 全平台通用命令行换源工具
3333
* ------------------------------------------------------------*/
3434

35-
#define Chsrc_Version "0.2.1"
36-
#define Chsrc_Release_Date "2025/04/13"
35+
#define Chsrc_Version "0.2.1.1"
36+
#define Chsrc_Release_Date "2025/05/27"
3737
#define Chsrc_Maintain_URL "https://github.com/RubyMetric/chsrc"
3838
#define Chsrc_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc"
3939

src/recipe/os/pacman/Arch-Linux.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ os_arch_setsrc (char *option)
8383
to_write = xy_strjoin (3, "Server = ", source.url, "arm/$arch/$repo");
8484
}
8585

86-
// 越前面的优先级越高
86+
/* 配置文件中,越前面的优先级越高 */
8787
chsrc_prepend_to_file (to_write, OS_Pacman_MirrorList);
8888

8989
if (is_x86)
@@ -120,19 +120,22 @@ os_archlinuxcn_setsrc (char *option)
120120
chsrc_backup (OS_Pacman_ArchLinuxCN_MirrorList);
121121

122122
char *arch = chsrc_get_cpuarch ();
123-
124-
// 检查是否已存在 archlinuxcn 配置段
123+
124+
/* 检查是否已存在 archlinuxcn 配置段 */
125125
char *check_cmd = "grep -q '\\[archlinuxcn\\]' " OS_Pacman_ArchLinuxCN_MirrorList;
126126
int ret = system(check_cmd);
127-
128-
if (ret == 0) {
129-
char *sed_cmd = xy_strjoin (4, "sed -i '/\\[archlinuxcn\\]/{n;s|^Server = .*|Server = ",
130-
source.url, "$arch|;}' ", OS_Pacman_ArchLinuxCN_MirrorList);
131-
chsrc_run (sed_cmd, RunOpt_Default);
132-
} else {
133-
char *archlinuxcn_config = xy_strjoin (3, "\n[archlinuxcn]\nServer = ", source.url, "$arch\n");
134-
chsrc_append_to_file (archlinuxcn_config, OS_Pacman_ArchLinuxCN_MirrorList);
135-
}
127+
128+
if (ret == 0)
129+
{
130+
char *sed_cmd = xy_strjoin (4, "sed -i '/\\[archlinuxcn\\]/{n;s|^Server = .*|Server = ",
131+
source.url, "$arch|;}' ", OS_Pacman_ArchLinuxCN_MirrorList);
132+
chsrc_run (sed_cmd, RunOpt_Default);
133+
}
134+
else
135+
{
136+
char *archlinuxcn_config = xy_strjoin (3, "\n[archlinuxcn]\nServer = ", source.url, "$arch\n");
137+
chsrc_append_to_file (archlinuxcn_config, OS_Pacman_ArchLinuxCN_MirrorList);
138+
}
136139

137140
chsrc_run ("pacman-key --lsign-key \"farseerfc@archlinux.org\"", RunOpt_Dont_Abort_On_Failure); // 此命令可能会失败, 但对换源没有影响
138141
chsrc_run ("pacman -Sy archlinuxcn-keyring", RunOpt_Default);

src/recipe/recipe-template.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* File Name : recipe-template.c
55
* File Authors : Aoran Zeng <ccmywish@qq.com>
66
* Contributors : Nil Null <nil@null.org>
7+
* |
78
* Created On : <2024-08-09>
89
* Last Modified : <2024-11-22>
910
* -------------------------------------------------------------
@@ -13,21 +14,28 @@
1314
*
1415
* 模版中:
1516
* <target> 为该换源目标的名称
16-
* <category> 为该换源目标的类别,仅有3类: pl, os, wr
17+
* <category> 为该换源目标的类别,仅有3类: pl, os, wr
1718
* 分别对应3个子目录: lang, os, ware
1819
* ------------------------------------------------------------*/
1920

2021

2122

22-
/* 模版文件从下行正式开始 */
23+
24+
/* 模版文件内容从下方第30行正式开始 */
25+
26+
27+
28+
29+
2330
/** ------------------------------------------------------------
2431
* SPDX-License-Identifier: GPL-3.0-or-later
2532
* -------------------------------------------------------------
2633
* File Name : <target>.c
2734
* File Authors : Nil Null <nil@null.org> 尼尔闹先生
2835
* Contributors : Nul None <nul@none.org> 怒了馕女士
29-
* Created On : <2024-01-01> https://www.yuque.com/ccmywish/blog/nil-null-and-nul-none
30-
* Last Modified : <2024-01-01> 请更新文件标头
36+
* |
37+
* Created On : <2025-01-01> https://www.yuque.com/ccmywish/blog/nil-null-and-nul-none
38+
* Last Modified : <2025-01-01> 请更新文件标头
3139
* ------------------------------------------------------------*/
3240

3341
/**
@@ -42,7 +50,7 @@ RubyMetric = {"rbmt", // chsrc set <target> rbmt
4250
"https://rubymetirc.com/target/aws/aws-sdk-go/@v/v1.45.2.zip"};
4351

4452
/**
45-
* @update 2024-08-09
53+
* @update 2025-12-31
4654
* @note 该target的各个源地址,该例数据为虚拟填充
4755
*/
4856
static Source_t

0 commit comments

Comments
 (0)