diff --git a/include/source.h b/include/source.h index 9bb151d..1cea65c 100644 --- a/include/source.h +++ b/include/source.h @@ -153,26 +153,6 @@ pl_dotnet_sources[] = { - -/** - * @time 2024-04-18 更新 - * @note 源并不完整,且未经测试是否有效 - */ -static SourceInfo -os_msys2_sources[] = { - {&Upstream, NULL}, - {&Ali, "https://mirrors.aliyun.com/msys2"}, - {&Bfsu, "https://mirrors.bfsu.edu.cn/msys2"}, - {&Ustc, "https://mirrors.ustc.edu.cn/msys2"}, - {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/msys2"}, - {&Tencent, "https://mirrors.tencent.com/msys2"}, - {&Huawei, "https://mirrors.huaweicloud.com/msys2"}, - {&Netease, "https://mirrors.163.com/msys2"}, - {&Sohu, "https://mirrors.sohu.com/msys2"} -}; - - - /** * @time 2024-06-07 更新 * @note 目前仅有一个源 @@ -283,7 +263,6 @@ wr_tex_sources[] = { def_sources_n(pl_clojure); def_sources_n(pl_dotnet); -def_sources_n(os_msys2); def_sources_n(wr_winget); def_sources_n(wr_brew); def_sources_n(wr_cocoapods); diff --git a/src/chsrc.c b/src/chsrc.c index 9f2bf64..e1aa770 100644 --- a/src/chsrc.c +++ b/src/chsrc.c @@ -31,6 +31,11 @@ #include "recipe/lang/java.c" #include "recipe/lang/rust.c" +#include "recipe/lang/dart.c" +#include "recipe/lang/haskell.c" +#include "recipe/lang/ocaml.c" +#include "recipe/lang/r.c" +#include "recipe/lang/julia.c" void pl_dotnet_getsrc (char *option) @@ -63,14 +68,6 @@ pl_clojure_setsrc (char *option) } -#include "recipe/lang/dart.c" -#include "recipe/lang/haskell.c" -#include "recipe/lang/ocaml.c" -#include "recipe/lang/r.c" -#include "recipe/lang/julia.c" - - - #include "recipe/os/apt-family/common.h" #include "recipe/os/apt-family/debian.c" @@ -89,10 +86,6 @@ pl_clojure_setsrc (char *option) #include "recipe/os/apt-family/deepin.c" - -#include "recipe/os/opensuse.c" - - #include "recipe/os/yum-family/common.h" #include "recipe/os/yum-family/Fedora-Linux.c" #include "recipe/os/yum-family/AlmaLinux.c" @@ -100,39 +93,12 @@ pl_clojure_setsrc (char *option) #include "recipe/os/yum-family/openEuler.c" #include "recipe/os/yum-family/Anolis-OS.c" -/** - * HELP: 未经测试 - */ -void -os_msys2_setsrc (char *option) -{ - SourceInfo source; - chsrc_yield_source (os_msys2); - chsrc_confirm_source (&source); - - chsrc_backup ("/etc/pacman.d/mirrorlist.mingw32"); - chsrc_backup ("/etc/pacman.d/mirrorlist.mingw64"); - chsrc_backup ("/etc/pacman.d/mirrorlist.msys"); - - char *prev = xy_strjoin (3, "请针对你的架构下载安装此目录下的文件:", - source.url, - "distrib/<架构>/"); - chsrc_note2 (prev); - - char *cmd = xy_strjoin (3, "sed -i \"s#https\?://mirror.msys2.org/#", - source.url, - "#g\" /etc/pacman.d/mirrorlist* "); - - chsrc_run (cmd, RunOpt_Default); - chsrc_say_lastly (&source, ChsrcTypeUntested); -} - - +#include "recipe/os/opensuse.c" #include "recipe/os/arch.c" +#include "recipe/os/MSYS2.c" + #include "recipe/os/gentoo.c" - - #include "recipe/os/alpine.c" #include "recipe/os/void.c" #include "recipe/os/solus.c" diff --git a/src/recipe/catalog.c b/src/recipe/catalog.c index 800e2ba..570698a 100644 --- a/src/recipe/catalog.c +++ b/src/recipe/catalog.c @@ -39,7 +39,6 @@ static const char }; -def_target_noget(os_msys2); TargetInfo os_manjaro_target = {NULL, os_manjaro_setsrc, NULL, NULL, 0}; static const char diff --git a/src/recipe/os/MSYS2.c b/src/recipe/os/MSYS2.c new file mode 100644 index 0000000..95225c8 --- /dev/null +++ b/src/recipe/os/MSYS2.c @@ -0,0 +1,55 @@ +/** ------------------------------------------------------------ + * SPDX-License-Identifier: GPL-3.0-or-later + * ------------------------------------------------------------- + * File Authors : Heng Guo <2085471348@qq.com> + * Contributors : Nil Null + * Created On : <2023-09-06> + * Last Modified : <2024-08-16> + * ------------------------------------------------------------*/ + +/** + * @time 2024-04-18 更新 + */ +static SourceInfo +os_msys2_sources[] = { + {&Upstream, NULL}, + {&Ali, "https://mirrors.aliyun.com/msys2"}, + {&Bfsu, "https://mirrors.bfsu.edu.cn/msys2"}, + {&Ustc, "https://mirrors.ustc.edu.cn/msys2"}, + {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/msys2"}, + {&Tencent, "https://mirrors.tencent.com/msys2"}, + {&Huawei, "https://mirrors.huaweicloud.com/msys2"}, + {&Netease, "https://mirrors.163.com/msys2"}, + {&Sohu, "https://mirrors.sohu.com/msys2"} +}; +def_sources_n(os_msys2); + + +/** + * HELP: 未经测试 + */ +void +os_msys2_setsrc (char *option) +{ + SourceInfo source; + chsrc_yield_source (os_msys2); + chsrc_confirm_source (&source); + + chsrc_backup ("/etc/pacman.d/mirrorlist.mingw32"); + chsrc_backup ("/etc/pacman.d/mirrorlist.mingw64"); + chsrc_backup ("/etc/pacman.d/mirrorlist.msys"); + + char *prev = xy_strjoin (3, "请针对你的架构下载安装此目录下的文件:", + source.url, + "distrib/<架构>/"); + chsrc_note2 (prev); + + char *cmd = xy_strjoin (3, "sed -i \"s#https\?://mirror.msys2.org/#", + source.url, + "#g\" /etc/pacman.d/mirrorlist* "); + + chsrc_run (cmd, RunOpt_Default); + chsrc_say_lastly (&source, ChsrcTypeUntested); +} + +def_target_noget(os_msys2);