diff --git a/src/recipe/os/BSD/FreeBSD.c b/src/recipe/os/BSD/FreeBSD.c index 8a6dbf2..63010c6 100644 --- a/src/recipe/os/BSD/FreeBSD.c +++ b/src/recipe/os/BSD/FreeBSD.c @@ -1,24 +1,41 @@ -chef_set_created_on ("2023-09-03"); -chef_set_authors ("Aoran Zeng ", "Heng Guo <2085471348@qq.com>"); -chef_set_contributors ("Nil Null "); -chef_allow_set(); -use_this; +/** ------------------------------------------------------------ + * SPDX-License-Identifier: GPL-3.0-or-later + * ------------------------------------------------------------*/ -/** - * @update 2023-09-27 - * - * @note - * 2023-09-24: 以下三个USTC, NJU, Netease 均维护了 freebsd-pkg freebsd-ports - * 2023-09-27: 请务必保持Nju前面有至少一个镜像,原因请查看 freebsd 的换源函数 - */ -static Source_t os_freebsd_sources[] = +def_target(os_freebsd); + +void +os_freebsd_prelude () { - {&UpstreamProvider, NULL, NULL}, + use_this(os_freebsd); + + chef_set_created_on (this, "2023-09-03"); + chef_set_last_updated (this, "2025-08-10"); + chef_set_sources_last_updated (this, "2023-09-27"); + + chef_set_authors (this, 2, "Aoran Zeng", "ccmywish@qq.com", "Heng Guo", "2085471348@qq.com"); + chef_set_chef (this, NULL, NULL); + chef_set_sous_chefs (this, 0); + chef_set_contributors (this, 1, + "Nil Null", "nil@null.org"); + + chef_allow_set(); + + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_forbid_english(this); + chef_forbid_user_define(this); + + chef_set_note ("2023-09-24: 以下三个USTC, NJU, Netease 均维护了 freebsd-pkg freebsd-ports\n2023-09-27: 请务必保持Nju前面有至少一个镜像,原因请查看 freebsd 的换源函数", NULL); + + def_upstream (NULL); + + def_sources_begin() + {&upstream, NULL, DelegateToUpstream}, {&Ustc, "mirrors.ustc.edu.cn", DelegateToMirror}, {&Nju, "mirror.nju.edu.cn", DelegateToMirror}, {&Netease, "mirrors.163.com", DelegateToMirror}, -}; -def_sources_n(os_freebsd); + def_sources_end() +} /** * @consult @@ -123,9 +140,5 @@ os_freebsd_setsrc (char *option) chsrc_overwrite_file (update, "/etc/freebsd-update.conf"); */ - chsrc_determine_chgtype (ChgType_SemiAuto); chsrc_conclude (&source); } - - -def_target(os_freebsd); diff --git a/src/recipe/os/BSD/NetBSD.c b/src/recipe/os/BSD/NetBSD.c index 68023fb..707eb67 100644 --- a/src/recipe/os/BSD/NetBSD.c +++ b/src/recipe/os/BSD/NetBSD.c @@ -1,16 +1,37 @@ -chef_set_created_on ("2023-09-05"); -chef_set_authors ("Aoran Zeng ", "Heng Guo <2085471348@qq.com>"); -chef_set_contributors ("Nil Null "); -chef_allow_get(); -chef_allow_set(); -use_this; +/** ------------------------------------------------------------ + * SPDX-License-Identifier: GPL-3.0-or-later + * ------------------------------------------------------------*/ -/** - * @update 2025-07-31 - */ -static Source_t os_netbsd_sources[] = +def_target(os_netbsd); + +void +os_netbsd_prelude () { - {&UpstreamProvider, NULL, NULL}, + use_this(os_netbsd); + + chef_set_created_on (this, "2023-09-05"); + chef_set_last_updated (this, "2025-08-10"); + chef_set_sources_last_updated (this, "2025-07-31"); + + chef_set_authors (this, 2, "Aoran Zeng", "ccmywish@qq.com", "Heng Guo", "2085471348@qq.com"); + chef_set_chef (this, NULL, NULL); + chef_set_sous_chefs (this, 0); + chef_set_contributors (this, 1, + "Nil Null", "nil@null.org"); + + chef_allow_get(); + chef_allow_set(); + + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_forbid_english(this); + chef_forbid_user_define(this); + + chef_set_note ("根据 @ykla: NetBSD 默认状态下没有 pkgsrc,用户可能安装了也可能没安装", NULL); + + def_upstream (NULL); + + def_sources_begin() + {&upstream, NULL, DelegateToUpstream}, {&MirrorZ, "https://mirrors.cernet.edu.cn/pkgsrc/packages/NetBSD/", DelegateToMirror}, {&Ali, "https://mirrors.aliyun.com/pkgsrc/packages/NetBSD/", DelegateToMirror}, {&Ustc, "https://mirrors.ustc.edu.cn/pkgsrc/packages/NetBSD/", DelegateToMirror}, @@ -21,8 +42,8 @@ static Source_t os_netbsd_sources[] = // {&Tencent_Intra, "https://mirrors.tencentyun.com/pkgsrc/packages/NetBSD/", DelegateToMirror}, {&Netease, "https://mirrors.163.com/pkgsrc/packages/NetBSD/", DelegateToMirror}, {&Sohu, "https://mirrors.sohu.com/pkgsrc/packages/NetBSD/", DelegateToMirror} -}; -def_sources_n(os_netbsd); + def_sources_end() +} void @@ -56,9 +77,5 @@ os_netbsd_setsrc (char *option) char *url = xy_strjoin (5, chef_ensure_trailing_slash (source.url), arch, "/", version, "/All"); chsrc_overwrite_file (url, "/usr/pkg/etc/pkgin/repositories.conf"); - chsrc_determine_chgtype (ChgType_Untested); chsrc_conclude (&source); } - - -def_target(os_netbsd); diff --git a/src/recipe/os/BSD/OpenBSD.c b/src/recipe/os/BSD/OpenBSD.c index eefe683..99efa16 100644 --- a/src/recipe/os/BSD/OpenBSD.c +++ b/src/recipe/os/BSD/OpenBSD.c @@ -1,16 +1,35 @@ -chef_set_created_on ("2023-09-03"); -chef_set_authors ("Heng Guo <2085471348@qq.com>", "Aoran Zeng "); -chef_set_contributors ("Nil Null "); -chef_allow_get(); -chef_allow_set(); -use_this; +/** ------------------------------------------------------------ + * SPDX-License-Identifier: GPL-3.0-or-later + * ------------------------------------------------------------*/ -/** - * @update 2025-07-31 - */ -static Source_t os_openbsd_sources[] = +def_target(os_openbsd); + +void +os_openbsd_prelude () { - {&UpstreamProvider, NULL, NULL}, + use_this(os_openbsd); + + chef_set_created_on (this, "2023-09-03"); + chef_set_last_updated (this, "2025-08-10"); + chef_set_sources_last_updated (this, "2025-07-31"); + + chef_set_authors (this, 2, "Heng Guo", "2085471348@qq.com", "Aoran Zeng", "ccmywish@qq.com"); + chef_set_chef (this, NULL, NULL); + chef_set_sous_chefs (this, 0); + chef_set_contributors (this, 1, + "Nil Null", "nil@null.org"); + + chef_allow_get(); + chef_allow_set(); + + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_forbid_english(this); + chef_forbid_user_define(this); + + def_upstream (NULL); + + def_sources_begin() + {&upstream, NULL, DelegateToUpstream}, {&MirrorZ, "https://mirrors.cernet.edu.cn/OpenBSD/", DelegateToMirror}, {&Bfsu, "https://mirrors.bfsu.edu.cn/OpenBSD/", DelegateToMirror}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/OpenBSD/", DelegateToMirror}, @@ -24,8 +43,8 @@ static Source_t os_openbsd_sources[] = // {&Tencent_Intra, "https://mirrors.tencentyun.com/OpenBSD/", DelegateToMirror}, {&Netease, "https://mirrors.163.com/OpenBSD/", DelegateToMirror}, {&Sohu, "https://mirrors.sohu.com/OpenBSD/", DelegateToMirror} -}; -def_sources_n(os_openbsd); + def_sources_end() +} void @@ -50,9 +69,5 @@ os_openbsd_setsrc (char *option) chsrc_backup ("/etc/installurl"); chsrc_overwrite_file (source.url, "/etc/installurl"); - chsrc_determine_chgtype (ChgType_Auto); chsrc_conclude (&source); } - - -def_target(os_openbsd); diff --git a/src/recipe/os/pacman/Arch-Linux.c b/src/recipe/os/pacman/Arch-Linux.c index 488ffac..d006b97 100644 --- a/src/recipe/os/pacman/Arch-Linux.c +++ b/src/recipe/os/pacman/Arch-Linux.c @@ -1,18 +1,42 @@ -chef_set_created_on ("2023-09-05"); -chef_set_authors ("Aoran Zeng ", "Heng Guo <2085471348@qq.com>"); -chef_set_contributors ("happy game "); -chef_allow_get(); -chef_allow_set(); -chef_note("可额外使用 chsrc set archlinuxcn 来更换 Arch Linux CN Repository 源"); -use_this; +/** ------------------------------------------------------------ + * SPDX-License-Identifier: GPL-3.0-or-later + * ------------------------------------------------------------*/ -/** - * @update 2025-06-20 - * @note 不要给后面加 / ,因为ARM情况下,还要额外加一个 arm 后缀 - */ -static Source_t os_arch_sources[] = +def_target(os_arch); + +#define OS_Pacman_MirrorList "/etc/pacman.d/mirrorlist" +#define OS_Pacman_ArchLinuxCN_MirrorList "/etc/pacman.conf" + +void +os_arch_prelude () { - {&UpstreamProvider, NULL, NULL}, + use_this(os_arch); + + chef_set_created_on (this, "2023-09-05"); + chef_set_last_updated (this, "2025-08-10"); + chef_set_sources_last_updated (this, "2025-06-20"); + + chef_set_authors (this, 2, "Aoran Zeng", "ccmywish@qq.com", + "Heng Guo", "2085471348@qq.com"); + chef_set_chef (this, NULL, NULL); + chef_set_sous_chefs (this, 0); + chef_set_contributors (this, 1, + "happy game", "happygame1024@gmail.com"); + + chef_allow_get(); + chef_allow_set(); + + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_forbid_english(this); + chef_forbid_user_define(this); + + chef_set_note ("可额外使用 chsrc set archlinuxcn 来更换 Arch Linux CN Repository 源", "You can additionally use chsrc set archlinuxcn to change Arch Linux CN Repository source"); + + def_upstream (NULL); + /** + * @note 不要给后面加 / ,因为ARM情况下,还要额外加一个 arm 后缀 + */ + def_sources_begin() {&Ali, "https://mirrors.aliyun.com/archlinux", DelegateToMirror}, {&Bfsu, "https://mirrors.bfsu.edu.cn/archlinux", DelegateToMirror}, {&Ustc, "https://mirrors.ustc.edu.cn/archlinux", DelegateToMirror}, @@ -25,37 +49,17 @@ static Source_t os_arch_sources[] = // {&Netease, "https://mirrors.163.com/archlinux", DelegateToMirror}, /* 不启用原因:过慢 */ // {&Sohu, "https://mirrors.sohu.com/archlinux", DelegateToMirror} -}, - -/** - * @update 2024-07-03 - * @note 根据 @zheng7fu2 建议,拆分 archlinuxcn 出来 - */ -os_archlinuxcn_sources[] = -{ - {&UpstreamProvider, "https://repo.archlinuxcn.org/", DelegateToUpstream}, - {&Ali, "https://mirrors.aliyun.com/archlinuxcn/", DelegateToMirror}, - {&Bfsu, "https://mirrors.bfsu.edu.cn/archlinuxcn/", DelegateToMirror}, - {&Ustc, "https://mirrors.ustc.edu.cn/archlinuxcn/", DelegateToMirror}, - {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/", DelegateToMirror}, - {&Tencent, "https://mirrors.cloud.tencent.com/archlinuxcn/", DelegateToMirror}, - // {&Tencent_Intra, "https://mirrors.cloud.tencentyun.com/archlinuxcn/", DelegateToMirror}, - - /* 不启用原因:过慢 */ - // {&Netease, "https://mirrors.163.com/archlinux-cn/", DelegateToMirror} -}; -def_sources_n(os_arch); -def_sources_n(os_archlinuxcn); + def_sources_end() +} -#define OS_Pacman_MirrorList "/etc/pacman.d/mirrorlist" -#define OS_Pacman_ArchLinuxCN_MirrorList "/etc/pacman.conf" void os_arch_getsrc (char *option) { chsrc_view_file (OS_Pacman_MirrorList); } + /** * @consult * 1. https://mirrors.tuna.tsinghua.edu.cn/help/archlinux/ @@ -102,6 +106,56 @@ os_arch_setsrc (char *option) } + +/** ------------------------------------------------------------ + * archlinuxcn target + * ------------------------------------------------------------*/ + +def_target(os_archlinuxcn); + +void +os_archlinuxcn_prelude () +{ + use_this(os_archlinuxcn); + + chef_set_created_on (this, "2023-09-05"); + chef_set_last_updated (this, "2025-08-10"); + chef_set_sources_last_updated (this, "2024-07-03"); + + chef_set_authors (this, 2, "Aoran Zeng", "ccmywish@qq.com", "Heng Guo", "2085471348@qq.com"); + chef_set_chef (this, NULL, NULL); + chef_set_sous_chefs (this, 0); + chef_set_contributors (this, 1, + "happy game", "happygame1024@gmail.com"); + + chef_allow_get(); + chef_allow_set(); + + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_forbid_english(this); + chef_forbid_user_define(this); + + chef_set_note ("可额外使用 chsrc set arch 来更换 Arch Linux 源", "You can additionally use chsrc set arch to change Arch Linux source"); + + def_upstream ("https://repo.archlinuxcn.org/"); + + /** + * @note 根据 @zheng7fu2 建议,拆分 archlinuxcn 出来 + */ + def_sources_begin() + {&upstream, NULL, DelegateToUpstream}, + {&Ali, "https://mirrors.aliyun.com/archlinuxcn/", DelegateToMirror}, + {&Bfsu, "https://mirrors.bfsu.edu.cn/archlinuxcn/", DelegateToMirror}, + {&Ustc, "https://mirrors.ustc.edu.cn/archlinuxcn/", DelegateToMirror}, + {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/", DelegateToMirror}, + {&Tencent, "https://mirrors.cloud.tencent.com/archlinuxcn/", DelegateToMirror}, + // {&Tencent_Intra, "https://mirrors.cloud.tencentyun.com/archlinuxcn/", DelegateToMirror}, + + /* 不启用原因:过慢 */ + // {&Netease, "https://mirrors.163.com/archlinux-cn/", DelegateToMirror} + def_sources_end() +} + void os_archlinuxcn_getsrc (char *option) { @@ -147,17 +201,3 @@ os_archlinuxcn_setsrc (char *option) chsrc_determine_chgtype (ChgType_Auto); chsrc_conclude (&source); } -#undef OS_Pacman_MirrorList -#undef OS_Pacman_ArchLinuxCN_MirrorList - - -def_target_has_note("可额外使用 chsrc set arch 来更换 Arch Linux 源"); -def_target(os_arch); - -chef_set_created_on ("2023-09-05"); -chef_set_authors ("Aoran Zeng ", "Heng Guo <2085471348@qq.com>"); -chef_set_contributors ("happy game "); -chef_allow_get(); -chef_allow_set(); -chef_note("可额外使用 chsrc set arch 来更换 Arch Linux 源"); -def_target(os_archlinuxcn); diff --git a/src/recipe/os/pacman/MSYS2.c b/src/recipe/os/pacman/MSYS2.c index deb991d..b7f1ba1 100644 --- a/src/recipe/os/pacman/MSYS2.c +++ b/src/recipe/os/pacman/MSYS2.c @@ -1,15 +1,34 @@ -chef_set_created_on ("2023-09-06"); -chef_set_authors ("Heng Guo <2085471348@qq.com>"); -chef_set_contributors ("Aoran Zeng "); -chef_allow_set(); -use_this; +/** ------------------------------------------------------------ + * SPDX-License-Identifier: GPL-3.0-or-later + * ------------------------------------------------------------*/ -/** - * @update 2025-06-20 - */ -static Source_t os_msys2_sources[] = +def_target(os_msys2); + +void +os_msys2_prelude () { - {&UpstreamProvider, NULL, NULL}, + use_this(os_msys2); + + chef_set_created_on (this, "2023-09-06"); + chef_set_last_updated (this, "2025-08-10"); + chef_set_sources_last_updated (this, "2025-06-20"); + + chef_set_authors (this, 1, "Heng Guo", "2085471348@qq.com"); + chef_set_chef (this, NULL, NULL); + chef_set_sous_chefs (this, 0); + chef_set_contributors (this, 1, + "Aoran Zeng", "ccmywish@qq.com"); + + chef_allow_set(); + + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_forbid_english(this); + chef_forbid_user_define(this); + + def_upstream (NULL); + + def_sources_begin() + {&upstream, NULL, DelegateToUpstream}, {&Ali, "https://mirrors.aliyun.com/msys2", DelegateToMirror}, {&Bfsu, "https://mirrors.bfsu.edu.cn/msys2", DelegateToMirror}, {&Ustc, "https://mirrors.ustc.edu.cn/msys2", DelegateToMirror}, @@ -20,8 +39,8 @@ static Source_t os_msys2_sources[] = // {&Netease, "https://mirrors.163.com/msys2", DelegateToMirror}, /* 不启用原因:过慢 */ // {&Sohu, "https://mirrors.sohu.com/msys2", DelegateToMirror} -}; -def_sources_n(os_msys2); + def_sources_end() +} /** @@ -47,9 +66,5 @@ os_msys2_setsrc (char *option) chsrc_run (cmd, RunOpt_Default); - chsrc_determine_chgtype (ChgType_Untested); chsrc_conclude (&source); } - - -def_target(os_msys2); diff --git a/src/recipe/os/pacman/Manjaro-Linux.c b/src/recipe/os/pacman/Manjaro-Linux.c index 2e6accd..272c6b8 100644 --- a/src/recipe/os/pacman/Manjaro-Linux.c +++ b/src/recipe/os/pacman/Manjaro-Linux.c @@ -1,8 +1,36 @@ -chef_set_created_on ("2023-09-06"); -chef_set_authors ("Heng Guo <2085471348@qq.com>"); -chef_set_contributors ("Nil Null "); -chef_allow_set(); -use_this; +/** ------------------------------------------------------------ + * SPDX-License-Identifier: GPL-3.0-or-later + * ------------------------------------------------------------*/ + +def_target(os_manjaro); + +void +os_manjaro_prelude () +{ + use_this(os_manjaro); + + chef_set_created_on (this, "2023-09-06"); + chef_set_last_updated (this, "2025-08-10"); + + chef_set_authors (this, 1, "Heng Guo", "2085471348@qq.com"); + chef_set_chef (this, NULL, NULL); + chef_set_sous_chefs (this, 0); + chef_set_contributors (this, 1, + "Nil Null", "nil@null.org"); + + chef_allow_set(); + + chef_allow_local_mode (this, CanNot, NULL, NULL); + chef_forbid_english(this); + chef_forbid_user_define(this); + + def_upstream (NULL); + + def_sources_begin() + {&upstream, NULL, DelegateToUpstream} + /* Manjaro uses GUI tool, no manual sources needed */ + def_sources_end() +} /** * 似乎会弹出GUI,待确定 @@ -16,8 +44,5 @@ os_manjaro_setsrc (char *option) chsrc_run ("pacman -Syy", RunOpt_No_Last_New_Line); - chsrc_determine_chgtype (ChgType_Auto); chsrc_conclude (NULL); } - -def_target(os_manjaro);