11/** ------------------------------------------------------------
22 * SPDX-License-Identifier: GPL-3.0-or-later
33 * -------------------------------------------------------------
4- * File Authors : Heng Guo <[email protected] > 5- * Contributors : Aoran Zeng <[email protected] > 6- * Created On : <2023-09-17>
7- * Last Modified : <2025-07-21>
4+ * File Authors : Heng Guo <[email protected] > 5+ * Contributors : Aoran Zeng <[email protected] > 6+ * Created On : <2023-09-17>
7+ * Major Revision : 1
8+ * Last Modified : <2025-07-21>
89 * ------------------------------------------------------------*/
910
11+ #include "rawstr4c.h"
12+
1013/**
1114 * @update 2025-06-20
1215 */
@@ -30,54 +33,17 @@ def_sources_n(os_opensuse);
3033
3134
3235/**
33- * HELP: 未经测试
36+ * @consult https://mirrors.tuna.tsinghua.edu.cn/help/opensuse/
3437 */
3538void
3639os_opensuse_setsrc (char * option )
3740{
38- chsrc_ensure_root (); // HELP: 不知道是否需要确保root权限
41+ chsrc_ensure_root ();
3942
4043 chsrc_yield_source_and_confirm (os_opensuse );
4144
42- char * source_nselect = "zypper mr -da" ;
43- chsrc_run (source_nselect , RunOpt_Default );
44-
45- char * cmd1 = xy_strjoin (3 ,
46- "zypper ar -cfg '" ,
47- source .url ,
48- "/opensuse/distribution/leap/$releasever/repo/oss/' mirror-oss" );
49- char * cmd2 = xy_strjoin (3 ,
50- "zypper ar -cfg '" ,
51- source .url ,
52- "/opensuse/distribution/leap/$releasever/repo/non-oss/' mirror-non-oss" );
53- char * cmd3 = xy_strjoin (3 ,
54- "zypper ar -cfg '" ,
55- source .url ,
56- "/opensuse/distribution/leap/$releasever/oss/' mirror-update" );
57- char * cmd4 = xy_strjoin (3 ,
58- "zypper ar -cfg '" ,
59- source .url ,
60- "/opensuse/distribution/leap/$releasever/non-oss/' mirror-update-non-oss" );
61- char * cmd5 = xy_strjoin (3 ,
62- "zypper ar -cfg '" ,
63- source .url ,
64- "/opensuse/distribution/leap/$releasever/sle/' mirror-sle-update" );
65- char * cmd6 = xy_strjoin (3 ,
66- "zypper ar -cfg '" ,
67- source .url ,
68- "/opensuse/distribution/leap/$releasever/backports/' mirror-backports-update" );
69-
70- chsrc_run (cmd1 , RunOpt_Default );
71- chsrc_run (cmd2 , RunOpt_Default );
72- chsrc_run (cmd3 , RunOpt_Default );
73- chsrc_run (cmd4 , RunOpt_Default );
74-
75- chsrc_note2 ("leap 15.3用户还需要添加sle和backports源" );
76- chsrc_note2 ("另外请确保系统在更新后仅启用了六个软件源,可以使用 zypper lr 检查软件源状态" );
77- chsrc_note2 ("并使用 zypper mr -d 禁用多余的软件源" );
78-
79- chsrc_run (cmd5 , RunOpt_Default );
80- chsrc_run (cmd6 , RunOpt_Default );
45+ /* TODO: 实现 Tumbleweed 换源 */
46+ chsrc_run_as_bash_file (RAWSTR_os_openSUSE_leap_in_bash );
8147
8248 chsrc_determine_chgtype (ChgType_Untested );
8349 chsrc_conclude (& source );
0 commit comments