chsrc/src/recipe/os/Alpine-Linux.c

54 lines
1.6 KiB
C
Raw Normal View History

2024-08-16 00:51:46 +08:00
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nil Null <nil@null.org>
* Created On : <2023-09-24>
2024-08-16 00:56:39 +08:00
* Last Modified : <2024-08-16>
2024-08-16 00:51:46 +08:00
* ------------------------------------------------------------*/
/**
* @time 2024-04-18
*/
static SourceInfo
os_alpine_sources[] = {
{&Upstream, NULL},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/alpine"},
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/alpine"},
{&Sustech, "https://mirrors.sustech.edu.cn/alpine"},
{&Zju, "https://mirrors.zju.edu.cn/alpine"},
{&Lzuoss, "https://mirror.lzu.edu.cn/alpine"},
{&Ali, "https://mirrors.aliyun.com/alpine"},
{&Tencent, "https://mirrors.cloud.tencent.com/alpine"},
{&Huawei, "https://mirrors.huaweicloud.com/alpine"}
};
def_sources_n(os_alpine);
void
os_alpine_getsrc (char *option)
{
chsrc_view_file ("/etc/apk/repositories");
}
/**
* : https://help.mirrors.cernet.edu.cn/alpine/
*/
void
os_alpine_setsrc (char *option)
{
// chsrc_ensure_root(); // HELP: 不确定是否需要root
2024-08-18 09:27:22 +08:00
chsrc_yield_source_and_confirm (os_alpine);
2024-08-16 00:51:46 +08:00
char* cmd = xy_strjoin (3,
"sed -i 's#https\\?://dl-cdn.alpinelinux.org/alpine#", source.url, "#g' /etc/apk/repositories"
);
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apk update", RunOpt_No_Last_New_Line);
2024-08-18 09:27:22 +08:00
chsrc_conclude (&source, ChsrcTypeUntested);
2024-08-16 00:51:46 +08:00
}
def_target(os_alpine);