mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-01-23 03:03:02 +08:00
Split opensuse out
This commit is contained in:
parent
8c4a7969fd
commit
c96323c6bd
|
@ -251,22 +251,6 @@ os_kali_sources[] = {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @time 2024-06-12 更新
|
|
||||||
*/
|
|
||||||
os_opensuse_sources[] = {
|
|
||||||
{&Upstream, NULL},
|
|
||||||
{&Ali, "https://mirrors.aliyun.com/opensuse"},
|
|
||||||
{&Volcengine, "https://mirrors.volces.com/opensuse"},
|
|
||||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/opensuse"},
|
|
||||||
{&Ustc, "https://mirrors.ustc.edu.cn/opensuse"},
|
|
||||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/opensuse"},
|
|
||||||
{&Tencent, "https://mirrors.tencent.com/opensuse"},
|
|
||||||
{&Netease, "https://mirrors.163.com/opensuse"},
|
|
||||||
{&Sohu, "https://mirrors.sohu.com/opensuse"}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @time 2024-04-18 更新
|
* @time 2024-04-18 更新
|
||||||
* @note 源并不完整,且未经测试是否有效
|
* @note 源并不完整,且未经测试是否有效
|
||||||
|
@ -568,7 +552,7 @@ def_sources_n(pl_dotnet);
|
||||||
|
|
||||||
def_sources_n(os_ubuntu); def_sources_n(os_mint);
|
def_sources_n(os_ubuntu); def_sources_n(os_mint);
|
||||||
def_sources_n(os_debian); def_sources_n(os_fedora);
|
def_sources_n(os_debian); def_sources_n(os_fedora);
|
||||||
def_sources_n(os_kali); def_sources_n(os_opensuse);
|
def_sources_n(os_kali);
|
||||||
def_sources_n(os_msys2);
|
def_sources_n(os_msys2);
|
||||||
def_sources_n(os_rocky); def_sources_n(os_alma);
|
def_sources_n(os_rocky); def_sources_n(os_alma);
|
||||||
|
|
||||||
|
|
59
src/chsrc.c
59
src/chsrc.c
|
@ -10,7 +10,7 @@
|
||||||
* | BlockLune <blocklune@gmail.com>
|
* | BlockLune <blocklune@gmail.com>
|
||||||
* |
|
* |
|
||||||
* Created On : <2023-08-28>
|
* Created On : <2023-08-28>
|
||||||
* Last Modified : <2024-08-15>
|
* Last Modified : <2024-08-16>
|
||||||
*
|
*
|
||||||
* chsrc: Change Source —— 全平台通用命令行换源工具
|
* chsrc: Change Source —— 全平台通用命令行换源工具
|
||||||
* ------------------------------------------------------------*/
|
* ------------------------------------------------------------*/
|
||||||
|
@ -517,62 +517,7 @@ os_fedora_setsrc (char *option)
|
||||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "recipe/os/opensuse.c"
|
||||||
|
|
||||||
/**
|
|
||||||
* HELP: 未经测试
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
os_opensuse_setsrc (char *option)
|
|
||||||
{
|
|
||||||
chsrc_ensure_root (); // HELP: 不知道是否需要确保root权限
|
|
||||||
|
|
||||||
SourceInfo source;
|
|
||||||
chsrc_yield_source (os_opensuse);
|
|
||||||
chsrc_confirm_source (&source);
|
|
||||||
|
|
||||||
char *source_nselect = "zypper mr -da";
|
|
||||||
chsrc_run (source_nselect, RunOpt_Default);
|
|
||||||
|
|
||||||
char *cmd1 = xy_strjoin (3,
|
|
||||||
"zypper ar -cfg '",
|
|
||||||
source.url,
|
|
||||||
"/opensuse/distribution/leap/$releasever/repo/oss/' mirror-oss");
|
|
||||||
char *cmd2 = xy_strjoin (3,
|
|
||||||
"zypper ar -cfg '",
|
|
||||||
source.url,
|
|
||||||
"/opensuse/distribution/leap/$releasever/repo/non-oss/' mirror-non-oss");
|
|
||||||
char *cmd3 = xy_strjoin (3,
|
|
||||||
"zypper ar -cfg '",
|
|
||||||
source.url,
|
|
||||||
"/opensuse/distribution/leap/$releasever/oss/' mirror-update");
|
|
||||||
char *cmd4 = xy_strjoin (3,
|
|
||||||
"zypper ar -cfg '",
|
|
||||||
source.url,
|
|
||||||
"/opensuse/distribution/leap/$releasever/non-oss/' mirror-update-non-oss");
|
|
||||||
char *cmd5 = xy_strjoin (3,
|
|
||||||
"zypper ar -cfg '",
|
|
||||||
source.url,
|
|
||||||
"/opensuse/distribution/leap/$releasever/sle/' mirror-sle-update");
|
|
||||||
char *cmd6 = xy_strjoin (3,
|
|
||||||
"zypper ar -cfg '",
|
|
||||||
source.url,
|
|
||||||
"/opensuse/distribution/leap/$releasever/backports/' mirror-backports-update");
|
|
||||||
|
|
||||||
chsrc_run (cmd1, RunOpt_Default);
|
|
||||||
chsrc_run (cmd2, RunOpt_Default);
|
|
||||||
chsrc_run (cmd3, RunOpt_Default);
|
|
||||||
chsrc_run (cmd4, RunOpt_Default);
|
|
||||||
|
|
||||||
chsrc_note2 ("leap 15.3用户还需要添加sle和backports源");
|
|
||||||
chsrc_note2 ("另外请确保系统在更新后仅启用了六个软件源,可以使用 zypper lr 检查软件源状态");
|
|
||||||
chsrc_note2 ("并使用 zypper mr -d 禁用多余的软件源");
|
|
||||||
|
|
||||||
chsrc_run (cmd5, RunOpt_Default);
|
|
||||||
chsrc_run (cmd6, RunOpt_Default);
|
|
||||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -46,7 +46,6 @@ def_target(os_deepin); def_target(os_openkylin);
|
||||||
def_target(os_raspberrypi);
|
def_target(os_raspberrypi);
|
||||||
def_target(os_armbian);
|
def_target(os_armbian);
|
||||||
def_target_noget(os_fedora);
|
def_target_noget(os_fedora);
|
||||||
def_target_noget(os_opensuse);
|
|
||||||
def_target_noget(os_rocky);
|
def_target_noget(os_rocky);
|
||||||
def_target_noget(os_alma);
|
def_target_noget(os_alma);
|
||||||
def_target_noget(os_freebsd);
|
def_target_noget(os_freebsd);
|
||||||
|
@ -61,7 +60,7 @@ static const char
|
||||||
*os_mint [] = {"mint", NULL, t(&os_mint_target)},
|
*os_mint [] = {"mint", NULL, t(&os_mint_target)},
|
||||||
*os_debian [] = {"debian", "deb", NULL, t(&os_debian_target)},
|
*os_debian [] = {"debian", "deb", NULL, t(&os_debian_target)},
|
||||||
*os_fedora [] = {"fedora", NULL, t(&os_fedora_target)},
|
*os_fedora [] = {"fedora", NULL, t(&os_fedora_target)},
|
||||||
*os_opensuse [] = {"suse", "opensuse", NULL, t(&os_opensuse_target)},
|
*os_opensuse [] = {"opensuse", NULL, t(&os_opensuse_target)},
|
||||||
*os_kali [] = {"kali", NULL, t(&os_kali_target)},
|
*os_kali [] = {"kali", NULL, t(&os_kali_target)},
|
||||||
*os_msys2 [] = {"msys2", "msys", NULL, t(&os_msys2_target)},
|
*os_msys2 [] = {"msys2", "msys", NULL, t(&os_msys2_target)},
|
||||||
*os_arch [] = {"arch", "archlinux", NULL, t(&os_arch_target)},
|
*os_arch [] = {"arch", "archlinux", NULL, t(&os_arch_target)},
|
||||||
|
|
82
src/recipe/os/opensuse.c
Normal file
82
src/recipe/os/opensuse.c
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
/** ------------------------------------------------------------
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
* -------------------------------------------------------------
|
||||||
|
* File Authors : Heng Guo <2085471348@qq.com>
|
||||||
|
* Contributors : Nil Null <nil@null.org>
|
||||||
|
* Created On : <2023-09-17>
|
||||||
|
* Last Modified : <2024-08-16>
|
||||||
|
* ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @time 2024-06-12 更新
|
||||||
|
*/
|
||||||
|
static SourceInfo
|
||||||
|
os_opensuse_sources[] = {
|
||||||
|
{&Upstream, NULL},
|
||||||
|
{&Ali, "https://mirrors.aliyun.com/opensuse"},
|
||||||
|
{&Volcengine, "https://mirrors.volces.com/opensuse"},
|
||||||
|
{&Bfsu, "https://mirrors.bfsu.edu.cn/opensuse"},
|
||||||
|
{&Ustc, "https://mirrors.ustc.edu.cn/opensuse"},
|
||||||
|
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/opensuse"},
|
||||||
|
{&Tencent, "https://mirrors.tencent.com/opensuse"},
|
||||||
|
{&Netease, "https://mirrors.163.com/opensuse"},
|
||||||
|
{&Sohu, "https://mirrors.sohu.com/opensuse"}
|
||||||
|
};
|
||||||
|
def_sources_n(os_opensuse);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HELP: 未经测试
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
os_opensuse_setsrc (char *option)
|
||||||
|
{
|
||||||
|
chsrc_ensure_root (); // HELP: 不知道是否需要确保root权限
|
||||||
|
|
||||||
|
SourceInfo source;
|
||||||
|
chsrc_yield_source (os_opensuse);
|
||||||
|
chsrc_confirm_source (&source);
|
||||||
|
|
||||||
|
char *source_nselect = "zypper mr -da";
|
||||||
|
chsrc_run (source_nselect, RunOpt_Default);
|
||||||
|
|
||||||
|
char *cmd1 = xy_strjoin (3,
|
||||||
|
"zypper ar -cfg '",
|
||||||
|
source.url,
|
||||||
|
"/opensuse/distribution/leap/$releasever/repo/oss/' mirror-oss");
|
||||||
|
char *cmd2 = xy_strjoin (3,
|
||||||
|
"zypper ar -cfg '",
|
||||||
|
source.url,
|
||||||
|
"/opensuse/distribution/leap/$releasever/repo/non-oss/' mirror-non-oss");
|
||||||
|
char *cmd3 = xy_strjoin (3,
|
||||||
|
"zypper ar -cfg '",
|
||||||
|
source.url,
|
||||||
|
"/opensuse/distribution/leap/$releasever/oss/' mirror-update");
|
||||||
|
char *cmd4 = xy_strjoin (3,
|
||||||
|
"zypper ar -cfg '",
|
||||||
|
source.url,
|
||||||
|
"/opensuse/distribution/leap/$releasever/non-oss/' mirror-update-non-oss");
|
||||||
|
char *cmd5 = xy_strjoin (3,
|
||||||
|
"zypper ar -cfg '",
|
||||||
|
source.url,
|
||||||
|
"/opensuse/distribution/leap/$releasever/sle/' mirror-sle-update");
|
||||||
|
char *cmd6 = xy_strjoin (3,
|
||||||
|
"zypper ar -cfg '",
|
||||||
|
source.url,
|
||||||
|
"/opensuse/distribution/leap/$releasever/backports/' mirror-backports-update");
|
||||||
|
|
||||||
|
chsrc_run (cmd1, RunOpt_Default);
|
||||||
|
chsrc_run (cmd2, RunOpt_Default);
|
||||||
|
chsrc_run (cmd3, RunOpt_Default);
|
||||||
|
chsrc_run (cmd4, RunOpt_Default);
|
||||||
|
|
||||||
|
chsrc_note2 ("leap 15.3用户还需要添加sle和backports源");
|
||||||
|
chsrc_note2 ("另外请确保系统在更新后仅启用了六个软件源,可以使用 zypper lr 检查软件源状态");
|
||||||
|
chsrc_note2 ("并使用 zypper mr -d 禁用多余的软件源");
|
||||||
|
|
||||||
|
chsrc_run (cmd5, RunOpt_Default);
|
||||||
|
chsrc_run (cmd6, RunOpt_Default);
|
||||||
|
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||||
|
}
|
||||||
|
|
||||||
|
def_target_noget(os_opensuse);
|
Loading…
Reference in New Issue
Block a user