chsrc/src/recipe/os/APT/openKylin.c
2024-11-22 07:02:21 +08:00

46 lines
1.3 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Heng Guo <2085471348@qq.com>
* Contributors : Nil Null <nil@null.org>
* Created On : <2023-09-06>
* Last Modified : <2024-08-16>
*
* openKylin直接基于Linux内核开发属于和Debian、openSUSE、Fedora、Arch
* 同一级别的、根社区发布的系统
* ------------------------------------------------------------*/
/**
* @time 2023-09-29 更新
*/
static Source_t
os_openkylin_sources[] = {
{&UpstreamProvider, "https://archive.openkylin.top/openkylin/"},
{&Ali, "https://mirrors.aliyun.com/openkylin/"},
{&Netease, "https://mirrors.163.com/openkylin/"},
};
def_sources_n(os_openkylin);
void
os_openkylin_getsrc (char *option)
{
chsrc_view_file (OS_Apt_SourceList);
}
void
os_openkylin_setsrc (char *option)
{
chsrc_ensure_root();
chsrc_yield_source_and_confirm (os_openkylin);
chsrc_backup (OS_Apt_SourceList);
char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/openkylin/?@", source.url, "@g'" OS_Apt_SourceList);
chsrc_run (cmd, RunOpt_Default);
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
chsrc_conclude (&source, SetsrcType_Untested);
}
def_target(os_openkylin);