Prerelease v0.2.1.1

This commit is contained in:
Aoran Zeng 2025-05-27 18:43:09 +08:00
parent 61a049b776
commit e8c0085c47
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
3 changed files with 31 additions and 20 deletions

View File

@ -27,13 +27,13 @@
* | MadDogOwner <xiaoran@xrgzs.top>
* |
* 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"

View File

@ -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);

View File

@ -4,6 +4,7 @@
* File Name : recipe-template.c
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nil Null <nil@null.org>
* |
* Created On : <2024-08-09>
* Last Modified : <2024-11-22>
* -------------------------------------------------------------
@ -13,21 +14,28 @@
*
* :
* <target>
* <category> 3: pl, os, wr
* <category> 3: pl, os, wr
* 3: lang, os, ware
* ------------------------------------------------------------*/
/* 模版文件从下行正式开始 */
/* 模版文件内容从下方第30行正式开始 */
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Name : <target>.c
* File Authors : Nil Null <nil@null.org>
* Contributors : Nul None <nul@none.org>
* 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 <target> 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