diff --git a/src/recipe/os/YUM/common.h b/src/recipe/os/YUM/common.h index 068c6b5d..a5c20d89 100644 --- a/src/recipe/os/YUM/common.h +++ b/src/recipe/os/YUM/common.h @@ -3,11 +3,12 @@ * ------------------------------------------------------------- * File Authors : Aoran Zeng * Contributors : Nil Null + * | * Created On : <2024-08-16> - * Last Modified : <2024-08-16> + * Last Modified : <2024-12-18> * ------------------------------------------------------------*/ // #define OS_Yum_SourceList "/etc/yum.repos" #define OS_Yum_SourceList_D "/etc/yum.repos.d/" -#define OS_openEuler_SourceList "openEuler.repo" +#define OS_openEuler_SourceList OS_Yum_SourceList_D "openEuler.repo" diff --git a/src/recipe/os/YUM/openEuler.c b/src/recipe/os/YUM/openEuler.c index c996ead2..0e734d5c 100644 --- a/src/recipe/os/YUM/openEuler.c +++ b/src/recipe/os/YUM/openEuler.c @@ -5,16 +5,24 @@ * Contributors : Aoran Zeng * | Yangmoooo * | happy game + * | * Created On : <2023-09-06> * Last Modified : <2024-12-18> * ------------------------------------------------------------*/ +static SourceProvider_t os_Upstream_openEuler = +{ + "upstream", "https://repo.openeuler.org/", "上游默认源 https://repo.openeuler.org/", "https://repo.openeuler.org/", + {NotSkip, NA, NA, "https://repo.openeuler.org/openEuler-24.03-LTS/ISO/x86_64/openEuler-24.03-LTS-netinst-x86_64-dvd.iso"} // 896MB +}; + + /** - * @update 2024-09-14 + * @update 2024-12-18 */ static Source_t os_openeuler_sources[] = { - {&UpstreamProvider, "https://repo.openeuler.org/"}, + {&os_Upstream_openEuler, "https://repo.openeuler.org/"}, {&Ali, "https://mirrors.aliyun.com/openeuler/"}, {&Bfsu, "https://mirrors.bfsu.edu.cn/openeuler/"}, {&Ustc, "https://mirrors.ustc.edu.cn/openeuler/"}, @@ -26,8 +34,19 @@ static Source_t os_openeuler_sources[] = }; def_sources_n(os_openeuler); + /** - * @update: 2024-12-18 + * chsrc get openeuler + */ +void +os_openeuler_getsrc (char *option) +{ + chsrc_view_file (OS_openEuler_SourceList); +} + + +/** + * chsrc set openeuler */ void os_openeuler_setsrc (char *option) @@ -36,17 +55,17 @@ os_openeuler_setsrc (char *option) chsrc_yield_source_and_confirm (os_openeuler); - chsrc_backup (OS_Yum_SourceList_D OS_openEuler_SourceList); + chsrc_backup (OS_openEuler_SourceList); - // 替换 baseurl=<>/openEuler-xx.xx/... + // 替换 baseurl=<>/openEuler-xx.xx/... // openEuler-xx.xx 为 openEuler 版本号 - // sed -E 's!^baseurl=.*?/openEuler-([^/]+)!baseurl=source.url/openEuler-\1/!g' OS_openEuler_SourceList + // sed -E 's!^baseurl=.*?/openEuler-([^/]+)!baseurl=$(source.url)/openEuler-\1/!g' OS_openEuler_SourceList char* cmd = xy_strjoin (6, "sed ", "-i -E 's!^baseurl=.*?/openEuler-([^/]+)!baseurl=", source.url, "openEuler-\\1", "!g' ", - OS_Yum_SourceList_D OS_openEuler_SourceList); + OS_openEuler_SourceList); chsrc_run (cmd, RunOpt_Default); chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line); @@ -55,4 +74,36 @@ os_openeuler_setsrc (char *option) chsrc_conclude (&source); } -def_target_s(os_openeuler); + +/** + * chsrc reset openeuler + */ +void +os_openeuler_resetsrc (char *option) +{ + os_openeuler_setsrc (option); +} + + +/** + * chsrc ls openeuler + */ +Feature_t +os_openeuler_feat (char *option) +{ + Feature_t f = {0}; + + f.can_get = true; + f.can_reset = true; + + f.cap_locally = CanNot; + f.cap_locally_explain = NULL; + f.can_english = true; + f.can_user_define = true; + + f.note = NULL; + + return f; +} + +def_target_gsrf(os_openeuler);