mirror of
https://github.com/RubyMetric/chsrc
synced 2025-12-28 13:49:49 +08:00
67 lines
2.2 KiB
C
67 lines
2.2 KiB
C
/** ------------------------------------------------------------
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
* -------------------------------------------------------------
|
|
* File Authors : Heng Guo <2085471348@qq.com>
|
|
* Contributors : Aoran Zeng <ccmywish@qq.com>
|
|
* Created On : <2023-09-26>
|
|
* Last Modified : <2024-09-14>
|
|
*
|
|
* 名称为 Fedora Linux
|
|
* ------------------------------------------------------------*/
|
|
|
|
/**
|
|
* @update 2024-09-14
|
|
*/
|
|
static SourceInfo
|
|
os_fedora_sources[] = {
|
|
{&Upstream, NULL},
|
|
{&Ali, "https://mirrors.aliyun.com/fedora"},
|
|
{&Bfsu, "https://mirrors.bfsu.edu.cn/fedora"},
|
|
{&Ustc, "https://mirrors.ustc.edu.cn/fedora"},
|
|
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/fedora"},
|
|
{&Tencent, "https://mirrors.tencent.com/fedora"},
|
|
// {&Tencent_Intra, "https://mirrors.tencentyun.com/fedora"},
|
|
{&Netease, "https://mirrors.163.com/fedora"},
|
|
{&Sohu, "https://mirrors.sohu.com/fedora"}
|
|
};
|
|
def_sources_n(os_fedora);
|
|
|
|
|
|
/**
|
|
* @note fedora 29 及以下版本暂不支持
|
|
*/
|
|
void
|
|
os_fedora_setsrc (char *option)
|
|
{
|
|
chsrc_ensure_root ();
|
|
|
|
chsrc_yield_source_and_confirm (os_fedora);
|
|
|
|
chsrc_note2 ("Fedora 29 及以下版本暂不支持");
|
|
|
|
chsrc_backup ("/etc/yum.repos.d/fedora.repo");
|
|
chsrc_backup ("/etc/yum.repos.d/fedora-updates.repo");
|
|
|
|
char* cmd = xy_strjoin (9, "sed -e 's|^metalink=|#metalink=|g' ",
|
|
"-e 's|^#baseurl=http://download.example/pub/fedora/linux/|baseurl=",
|
|
source.url,
|
|
"|g' ",
|
|
"-i.bak ",
|
|
"/etc/yum.repos.d/fedora.repo ",
|
|
"/etc/yum.repos.d/fedora-modular.repo ",
|
|
"/etc/yum.repos.d/fedora-updates.repo ",
|
|
"/etc/yum.repos.d/fedora-updates-modular.repo");
|
|
|
|
chsrc_run (cmd, RunOpt_Default);
|
|
|
|
chsrc_log2 ("已替换文件 /etc/yum.repos.d/fedora.repo");
|
|
chsrc_log2 ("已新增文件 /etc/yum.repos.d/fedora-modular.repo");
|
|
chsrc_log2 ("已替换文件 /etc/yum.repos.d/fedora-updates.repo");
|
|
chsrc_log2 ("已新增文件 /etc/yum.repos.d/fedora-updates-modular.repo");
|
|
|
|
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
|
|
chsrc_conclude (&source, SetsrcType_Auto);
|
|
}
|
|
|
|
def_target_s(os_fedora);
|