Fix Fedora

- 不再支持fedora 38及以下
    - 默认使用metalink匹配最快源, 提示用户可自行注释
This commit is contained in:
happygame 2024-10-09 13:48:43 +08:00 committed by ccmywish
parent 53820935dd
commit 3146c7f58d

View File

@ -4,13 +4,13 @@
* File Authors : Heng Guo <2085471348@qq.com>
* Contributors : Aoran Zeng <ccmywish@qq.com>
* Created On : <2023-09-26>
* Last Modified : <2024-09-14>
* Last Modified : <2024-10-09>
*
* Fedora Linux
* ------------------------------------------------------------*/
/**
* @update 2024-09-14
* @update 2024-10-09
*/
static SourceInfo
os_fedora_sources[] = {
@ -28,7 +28,9 @@ def_sources_n(os_fedora);
/**
* @note fedora 29
* @note fedora 38
* :
* 1. https://mirrors.ustc.edu.cn/help/fedora.html
*/
void
os_fedora_setsrc (char *option)
@ -37,27 +39,25 @@ os_fedora_setsrc (char *option)
chsrc_yield_source_and_confirm (os_fedora);
chsrc_note2 ("Fedora 29 及以下版本暂不支持");
chsrc_note2 ("Fedora 38 及以下版本暂不支持");
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' ",
char* cmd = xy_strjoin (7, "sed ",
"-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");
"/etc/yum.repos.d/fedora-updates.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_note2 ("chsrc 已为您更换baseurl, 但fedora默认会优先使用metalink来匹配最快的源, 如您在获取metadata时速度较慢可自行将其注释");
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
chsrc_conclude (&source, SetsrcType_Auto);