diff --git a/include/source.h b/include/source.h index 7bba314..50f5ac7 100644 --- a/include/source.h +++ b/include/source.h @@ -282,21 +282,6 @@ os_archlinuxcn_sources[] = { }, -/** - * @time 2023-09-05 更新 - * @note 源并不完整,且未经测试是否有效 - */ -os_gentoo_sources[] = { - {&Upstream, NULL}, - {&Ali, "mirrors.aliyun.com"}, - {&Bfsu, "mirrors.bfsu.edu.cn"}, - {&Ustc, "mirrors.ustc.edu.cn"}, - {&Tuna, "mirrors.tuna.tsinghua.edu.cn"}, - {&Tencent, "mirrors.tencent.com"}, - {&Netease, "mirrors.163.com"}, - {&Sohu, "mirrors.sohu.com"} -}, - /** * @time 2024-06-12 更新 @@ -617,7 +602,7 @@ def_sources_n(os_ubuntu); def_sources_n(os_mint); def_sources_n(os_debian); def_sources_n(os_fedora); def_sources_n(os_kali); def_sources_n(os_opensuse); def_sources_n(os_arch); def_sources_n(os_archlinuxcn); -def_sources_n(os_msys2); def_sources_n(os_gentoo); +def_sources_n(os_msys2); def_sources_n(os_rocky); def_sources_n(os_alma); def_sources_n(os_linuxlite); def_sources_n(os_raspberrypi); diff --git a/src/chsrc.c b/src/chsrc.c index 0c42269..9ae465d 100644 --- a/src/chsrc.c +++ b/src/chsrc.c @@ -723,32 +723,8 @@ os_archlinuxcn_setsrc (char *option) } #undef OS_Pacman_MirrorList -/** - * HELP: 未经测试 - */ -void -os_gentoo_setsrc (char *option) -{ - chsrc_ensure_root (); - - SourceInfo source; - chsrc_yield_source (os_gentoo); - chsrc_confirm_source (&source); - - chsrc_backup ("/etc/portage/repos.conf/gentoo.conf"); - - char *cmd = xy_strjoin (3, "sed -i \"s#rsync://.*/gentoo-portage#rsync://", - source.url, - "gentoo-portage#g"); - chsrc_run (cmd, RunOpt_Default); - - char *towrite = xy_strjoin (3, "GENTOO_MIRRORS=\"https://", source.url, "gentoo\""); - - chsrc_append_to_file (towrite, "/etc/portage/make.conf"); - chsrc_say_lastly (&source, ChsrcTypeUntested); -} - +#include "recipe/os/gentoo.c" /** * 参考: https://help.mirrors.cernet.edu.cn/rocky/ diff --git a/src/recipe/catalog.c b/src/recipe/catalog.c index 62bb451..f55c46a 100644 --- a/src/recipe/catalog.c +++ b/src/recipe/catalog.c @@ -48,7 +48,6 @@ def_target(os_armbian); def_target(os_arch); def_target(os_archlinuxcn); def_target_noget(os_fedora); def_target_noget(os_opensuse); -def_target_noget(os_gentoo); def_target_noget(os_rocky); def_target_noget(os_alma); def_target_noget(os_freebsd); diff --git a/src/recipe/os/gentoo.c b/src/recipe/os/gentoo.c new file mode 100644 index 0000000..eab8904 --- /dev/null +++ b/src/recipe/os/gentoo.c @@ -0,0 +1,53 @@ +/** ------------------------------------------------------------ + * SPDX-License-Identifier: GPL-3.0-or-later + * ------------------------------------------------------------- + * File Authors : Heng Guo <2085471348@qq.com> + * Contributors : Nil Null + * Created On : <2023-09-05> + * Last Modified : <2024-08-16> + * ------------------------------------------------------------*/ + +/** + * @time 2023-09-05 更新 + * @note 源并不完整,且未经测试是否有效 + */ +static SourceInfo +os_gentoo_sources[] = { + {&Upstream, NULL}, + {&Ali, "mirrors.aliyun.com"}, + {&Bfsu, "mirrors.bfsu.edu.cn"}, + {&Ustc, "mirrors.ustc.edu.cn"}, + {&Tuna, "mirrors.tuna.tsinghua.edu.cn"}, + {&Tencent, "mirrors.tencent.com"}, + {&Netease, "mirrors.163.com"}, + {&Sohu, "mirrors.sohu.com"} +}; +def_sources_n(os_gentoo); + + +/** + * HELP: 未经测试 + */ +void +os_gentoo_setsrc (char *option) +{ + chsrc_ensure_root (); + + SourceInfo source; + chsrc_yield_source (os_gentoo); + chsrc_confirm_source (&source); + + chsrc_backup ("/etc/portage/repos.conf/gentoo.conf"); + + char *cmd = xy_strjoin (3, "sed -i \"s#rsync://.*/gentoo-portage#rsync://", + source.url, + "gentoo-portage#g"); + chsrc_run (cmd, RunOpt_Default); + + char *towrite = xy_strjoin (3, "GENTOO_MIRRORS=\"https://", source.url, "gentoo\""); + + chsrc_append_to_file (towrite, "/etc/portage/make.conf"); + chsrc_say_lastly (&source, ChsrcTypeUntested); +} + +def_target_noget(os_gentoo);