2
2
* SPDX-License-Identifier: GPL-3.0-or-later
3
3
* -------------------------------------------------------------
4
4
* File Authors : Heng Guo <[email protected] >
5
- * Contributors : Aoran Zeng <[email protected] >
6
5
* | happy game <[email protected] >
6
+ * Contributors : Aoran Zeng <[email protected] >
7
+ * |
7
8
* Created On : <2023-09-26>
8
9
* Last Modified : <2024-11-04>
9
10
*
15
16
*/
16
17
static SourceInfo
17
18
os_fedora_sources [] = {
18
- {& Upstream , "http://download.example/pub/fedora/linux" },
19
+ {& Upstream , "http://download.example/pub/fedora/linux" },
19
20
{& Ali , "https://mirrors.aliyun.com/fedora" },
20
21
{& Bfsu , "https://mirrors.bfsu.edu.cn/fedora" },
21
22
{& Ustc , "https://mirrors.ustc.edu.cn/fedora" },
@@ -36,6 +37,8 @@ def_sources_n(os_fedora);
36
37
void
37
38
os_fedora_setsrc (char * option )
38
39
{
40
+ char * setsrc_type = xy_streql (option , SetsrcType_Reset ) ? SetsrcType_Reset : SetsrcType_Auto ;
41
+
39
42
chsrc_ensure_root ();
40
43
41
44
chsrc_yield_source_and_confirm (os_fedora );
@@ -45,16 +48,17 @@ os_fedora_setsrc (char *option)
45
48
chsrc_backup ("/etc/yum.repos.d/fedora.repo" );
46
49
chsrc_backup ("/etc/yum.repos.d/fedora-updates.repo" );
47
50
48
- // 取消注释 baseurl
51
+ // 取消对 baseurl 的注释
49
52
char * cmd = xy_strjoin (5 , "sed " ,
50
53
"-i 's|^#baseurl=|baseurl=" ,
51
54
"|g' " ,
52
55
"/etc/yum.repos.d/fedora.repo " ,
53
56
"/etc/yum.repos.d/fedora-updates.repo" );
54
57
chsrc_run (cmd , RunOpt_Default );
55
58
56
- // fedora的换源涉及 /etc/yum.repos.d/fedora.repo和 /etc/yum.repos.d/fedora-updates.repo
57
- // 需要替换 baseurl=source.url/releases/... 和 baseurl=source.url/releases/...
59
+ // 替换
60
+ // (1) baseurl=<<URL>>/releases/...
61
+ // (2) baseurl=<<URL>>/updates/...
58
62
cmd = xy_strjoin (7 , "sed " ,
59
63
"-i -E 's!^baseurl=.*?/(releases|updates)/!baseurl=" ,
60
64
source .url ,
@@ -69,25 +73,31 @@ os_fedora_setsrc (char *option)
69
73
chsrc_log2 ("(2) /etc/yum.repos.d/fedora-updates.repo" );
70
74
71
75
chsrc_run ("dnf makecache" , RunOpt_No_Last_New_Line );
72
- chsrc_conclude (& source , SetsrcType_Auto );
76
+
77
+ chsrc_conclude (& source , setsrc_type );
73
78
}
74
79
75
80
81
+ void
82
+ os_fedora_resetsrc (char * option )
83
+ {
84
+ os_fedora_setsrc (SetsrcType_Reset );
85
+ }
86
+
76
87
77
88
FeatInfo
78
89
os_fedora_feat (char * option )
79
90
{
80
91
FeatInfo f = {0 };
81
92
82
93
f .can_get = false;
83
- f .can_reset = false ;
94
+ f .can_reset = true ;
84
95
85
96
f .cap_locally = CanNot ;
86
- f .can_english = true ;
97
+ f .can_english = false ;
87
98
f .can_user_define = true;
88
99
89
100
return f ;
90
101
}
91
102
92
103
def_target_sf (os_fedora );
93
-
0 commit comments