-
-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #159 from ccmywish/dev
Support `get` `reset` `ls` for `openEuler` and measure upstream by default
- Loading branch information
Showing
2 changed files
with
62 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,12 @@ | |
* ------------------------------------------------------------- | ||
* File Authors : Aoran Zeng <[email protected]> | ||
* Contributors : Nil Null <[email protected]> | ||
* | | ||
* 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,16 +5,24 @@ | |
* Contributors : Aoran Zeng <[email protected]> | ||
* | Yangmoooo <[email protected]> | ||
* | happy game <[email protected]> | ||
* | | ||
* 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=<<URL>>/openEuler-xx.xx/... | ||
// 替换 baseurl=<<URL>>/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); |