|
6 | 6 | * Contributors : Zhao <[email protected]> |
7 | 7 | * | |
8 | 8 | * Created On : <2023-08-30> |
9 | | - * Last Modified : <2024-12-18> |
| 9 | + * Last Modified : <2025-03-25> |
10 | 10 | * ------------------------------------------------------------*/ |
11 | 11 |
|
12 | 12 | static SourceProvider_t os_ubuntu_upstream = |
@@ -46,13 +46,13 @@ os_ubuntu_getsrc (char *option) |
46 | 46 | return; |
47 | 47 | } |
48 | 48 |
|
49 | | - if (chsrc_check_file (OS_Apt_SourceList)) |
| 49 | + if (chsrc_check_file (OS_Ubuntu_old_SourceList)) |
50 | 50 | { |
51 | | - chsrc_view_file (OS_Apt_SourceList); |
| 51 | + chsrc_view_file (OS_Ubuntu_old_SourceList); |
52 | 52 | return; |
53 | 53 | } |
54 | 54 |
|
55 | | - char *msg = CliOpt_InEnglish ? "Source config file missing! However, you can still run `chsrc set ubuntu` to add and use new sources" |
| 55 | + char *msg = CliOpt_InEnglish ? "Source list file missing! However, you can still run `chsrc set ubuntu` to add and use new sources" |
56 | 56 | : "缺少源配置文件!但仍可直接通过 chsrc set ubuntu 来添加使用新的源"; |
57 | 57 | chsrc_error2 (msg); |
58 | 58 | return; |
@@ -98,31 +98,33 @@ os_ubuntu_setsrc (char *option) |
98 | 98 | if (chsrc_check_file (OS_Ubuntu_SourceList_DEB822)) |
99 | 99 | { |
100 | 100 | char *msg = CliOpt_InEnglish ? "Will change source based on new format" |
101 | | - : "将基于新格式换源"; |
| 101 | + : "将基于新格式(DEB822)换源"; |
102 | 102 | chsrc_note2 (msg); |
103 | 103 | os_ubuntu_setsrc_for_deb822 (option); |
104 | 104 | return; |
105 | 105 | } |
106 | 106 |
|
107 | | - bool sourcelist_exist = ensure_apt_sourcelist (OS_Is_Ubuntu); |
| 107 | + chsrc_note2 ("将基于旧格式(非DEB822)换源"); |
| 108 | + |
| 109 | + bool sourcelist_exist = ensure_debian_or_ubuntu_old_sourcelist (OS_Is_Ubuntu); |
108 | 110 |
|
109 | 111 | chsrc_yield_source_and_confirm (os_ubuntu); |
110 | 112 |
|
111 | | - // 不存在的时候,用的是我们生成的无效文件,不要备份 |
| 113 | + /* 不存在的时候,用的是我们生成的无效文件,不要备份 */ |
112 | 114 | if (sourcelist_exist) |
113 | 115 | { |
114 | | - chsrc_backup (OS_Apt_SourceList); |
| 116 | + chsrc_backup (OS_Ubuntu_old_SourceList); |
115 | 117 | } |
116 | 118 |
|
117 | | - char *arch = chsrc_get_cpuarch (); |
| 119 | + char *arch = chsrc_get_cpuarch(); |
118 | 120 | char *cmd = NULL; |
119 | 121 | if (0==strncmp (arch, "x86_64", 6)) |
120 | 122 | { |
121 | | - cmd = xy_strjoin (3, "sed -E -i \'s@https?://.*/ubuntu/?@", source.url, "@g\' " OS_Apt_SourceList); |
| 123 | + cmd = xy_strjoin (3, "sed -E -i \'s@https?://.*/ubuntu/?@", source.url, "@g\' " OS_Ubuntu_old_SourceList); |
122 | 124 | } |
123 | 125 | else |
124 | 126 | { |
125 | | - cmd = xy_strjoin (3, "sed -E -i \'s@https?://.*/ubuntu-ports/?@", source.url, "-ports@g\' " OS_Apt_SourceList); |
| 127 | + cmd = xy_strjoin (3, "sed -E -i \'s@https?://.*/ubuntu-ports/?@", source.url, "-ports@g\' " OS_Ubuntu_old_SourceList); |
126 | 128 | } |
127 | 129 |
|
128 | 130 | chsrc_run (cmd, RunOpt_Default); |
|
0 commit comments