From d3c8f7fdfef3f7cc1afee66b936ebaf49bbadc60 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 16 Aug 2024 03:13:56 +0800 Subject: [PATCH] Split rockylinux out --- include/source.h | 19 ---------- src/chsrc.c | 24 +------------ src/recipe/catalog.c | 12 +++---- src/recipe/os/yum-family/Rocky-Linux.c | 50 ++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 48 deletions(-) create mode 100644 src/recipe/os/yum-family/Rocky-Linux.c diff --git a/include/source.h b/include/source.h index 8a92ecf..51730b8 100644 --- a/include/source.h +++ b/include/source.h @@ -172,24 +172,6 @@ os_msys2_sources[] = { }, -/** - * @time 2024-06-12 更新 - */ -os_rocky_sources[] = { - {&Upstream, NULL}, - {&Ali, "https://mirrors.aliyun.com/rockylinux"}, - {&Volcengine, "https://mirrors.volces.com/rockylinux"}, - {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/rocky"}, - {&Sustech, "https://mirrors.sustech.edu.cn/rocky-linux"}, - {&Zju, "https://mirrors.zju.edu.cn/rocky"}, - {&Lzuoss, "https://mirror.lzu.edu.cn/rocky"}, - {&Sohu, "https://mirrors.sohu.com/Rocky"}, - {&Netease, "https://mirrors.163.com/rocky"} -}, - - - - /** * @time 2023-09-29 更新 @@ -350,7 +332,6 @@ def_sources_n(pl_clojure); def_sources_n(pl_dotnet); def_sources_n(os_msys2); -def_sources_n(os_rocky); def_sources_n(os_linuxlite); diff --git a/src/chsrc.c b/src/chsrc.c index da28911..a7b12e8 100644 --- a/src/chsrc.c +++ b/src/chsrc.c @@ -93,6 +93,7 @@ pl_clojure_setsrc (char *option) #include "recipe/os/yum-family/Fedora-Linux.c" #include "recipe/os/yum-family/AlmaLinux.c" +#include "recipe/os/yum-family/Rocky-Linux.c" /** * HELP: 未经测试 @@ -126,29 +127,6 @@ os_msys2_setsrc (char *option) #include "recipe/os/arch.c" #include "recipe/os/gentoo.c" -/** - * 参考: https://help.mirrors.cernet.edu.cn/rocky/ - */ -void -os_rocky_setsrc (char *option) -{ - chsrc_ensure_root (); - - SourceInfo source; - chsrc_yield_source (os_rocky); - chsrc_confirm_source (&source); - - char *cmd = xy_strjoin (3, - "sed -e 's|^mirrorlist=|#mirrorlist=|g' " - "-e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=", source.url, "|g' " - "-i.bak /etc/yum.repos.d/rocky-extras.repo /etc/yum.repos.d/rocky.repo" - ); - chsrc_run (cmd, RunOpt_Default); - chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line); - chsrc_say_lastly (&source, ChsrcTypeUntested); -} - - #include "recipe/os/alpine.c" #include "recipe/os/void.c" diff --git a/src/recipe/catalog.c b/src/recipe/catalog.c index 61221fa..bcc532c 100644 --- a/src/recipe/catalog.c +++ b/src/recipe/catalog.c @@ -41,7 +41,6 @@ static const char def_target(os_linuxlite); def_target(os_openkylin); -def_target_noget(os_rocky); def_target_noget(os_openeuler); def_target_noget(os_anolis); def_target_noget(os_msys2); @@ -59,7 +58,7 @@ static const char *os_archlinuxcn[] = {"archlinuxcn", "archcn",NULL, t(&os_archlinuxcn_target)}, *os_manjaro [] = {"manjaro", NULL, t(&os_manjaro_target)}, *os_gentoo [] = {"gentoo", NULL, t(&os_gentoo_target)}, -*os_rocky [] = {"rocky", "rockylinux", NULL, t(&os_rocky_target)}, +*os_rockylinux [] = {"rocky", "rockylinux", NULL, t(&os_rockylinux_target)}, *os_almalinux [] = {"alma", "almalinux", NULL, t(&os_almalinux_target)}, *os_alpine [] = {"alpine", NULL, t(&os_alpine_target)}, *os_void [] = {"void", "voidlinux", NULL, t(&os_void_target)}, @@ -84,16 +83,17 @@ static const char **os_systems[] = { os_debian, os_ubuntu, os_linuxmint, os_kali, - os_trisquel, os_linuxlite, os_raspberrypi, os_armbian, os_openwrt, + os_trisquel, os_linuxlite, os_raspberrypi, os_armbian, os_openwrt, os_deepin, os_openkylin, os_ros, - os_rocky, - os_fedora, os_almalinux, os_opensuse, + os_fedora, os_rockylinux, os_almalinux, os_openeuler, os_anolis, + + os_opensuse, os_arch, os_archlinuxcn, os_manjaro, os_gentoo, os_alpine, os_void, os_solus, - os_openeuler, os_anolis, + os_msys2, os_freebsd, os_netbsd, os_openbsd, }; diff --git a/src/recipe/os/yum-family/Rocky-Linux.c b/src/recipe/os/yum-family/Rocky-Linux.c new file mode 100644 index 0000000..acb3233 --- /dev/null +++ b/src/recipe/os/yum-family/Rocky-Linux.c @@ -0,0 +1,50 @@ +/** ------------------------------------------------------------ + * SPDX-License-Identifier: GPL-3.0-or-later + * ------------------------------------------------------------- + * File Authors : Aoran Zeng + * Contributors : Nil Null + * Created On : <2023-09-24> + * Last Modified : <2024-08-16> + * ------------------------------------------------------------*/ + +/** + * @time 2024-06-12 更新 + */ +static SourceInfo +os_rockylinux_sources[] = { + {&Upstream, NULL}, + {&Ali, "https://mirrors.aliyun.com/rockylinux"}, + {&Volcengine, "https://mirrors.volces.com/rockylinux"}, + {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/rocky"}, + {&Sustech, "https://mirrors.sustech.edu.cn/rocky-linux"}, + {&Zju, "https://mirrors.zju.edu.cn/rocky"}, + {&Lzuoss, "https://mirror.lzu.edu.cn/rocky"}, + {&Sohu, "https://mirrors.sohu.com/Rocky"}, + {&Netease, "https://mirrors.163.com/rocky"} +}; +def_sources_n(os_rockylinux); + + +/** + * 参考: https://help.mirrors.cernet.edu.cn/rocky/ + */ +void +os_rockylinux_setsrc (char *option) +{ + chsrc_ensure_root (); + + SourceInfo source; + chsrc_yield_source (os_rockylinux); + chsrc_confirm_source (&source); + + char *cmd = xy_strjoin (3, + "sed -e 's|^mirrorlist=|#mirrorlist=|g' " + "-e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=", source.url, "|g' " + "-i.bak /etc/yum.repos.d/rocky-extras.repo /etc/yum.repos.d/rocky.repo" + ); + chsrc_run (cmd, RunOpt_Default); + chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line); + chsrc_say_lastly (&source, ChsrcTypeUntested); +} + +def_target_noget(os_rockylinux);