From 1c37cfa311974f2004173bd8ea9588b78a99cf3a Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 16 Aug 2024 03:19:31 +0800 Subject: [PATCH] Split linuxlite out --- include/source.h | 12 ------- src/chsrc.c | 29 +---------------- src/recipe/catalog.c | 1 - src/recipe/os/apt-family/Linux-Lite.c | 47 +++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 41 deletions(-) create mode 100644 src/recipe/os/apt-family/Linux-Lite.c diff --git a/include/source.h b/include/source.h index 51730b8..3a46539 100644 --- a/include/source.h +++ b/include/source.h @@ -173,16 +173,6 @@ os_msys2_sources[] = { -/** - * @time 2023-09-29 更新 - */ -os_linuxlite_sources[] = { - {&Upstream, NULL}, - {&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/linuxliteos/"} -}, - - - /** * @time 2023-09-06 更新 @@ -333,8 +323,6 @@ def_sources_n(pl_dotnet); def_sources_n(os_msys2); -def_sources_n(os_linuxlite); - def_sources_n(os_openeuler); def_sources_n(os_openkylin); def_sources_n(os_anolis); diff --git a/src/chsrc.c b/src/chsrc.c index a7b12e8..572921b 100644 --- a/src/chsrc.c +++ b/src/chsrc.c @@ -82,6 +82,7 @@ pl_clojure_setsrc (char *option) // Ubuntu-based #include "recipe/os/apt-family/linuxmint.c" #include "recipe/os/apt-family/trisquel.c" +#include "recipe/os/apt-family/Linux-Lite.c" // Independent #include "recipe/os/apt-family/ros.c" #include "recipe/os/apt-family/deepin.c" @@ -150,34 +151,6 @@ os_manjaro_setsrc (char *option) -void -os_linuxlite_getsrc (char *option) -{ - chsrc_view_file (OS_Apt_SourceList); -} - -/** - * 参考: https://help.mirrors.cernet.edu.cn/linuxliteos/ - */ -void -os_linuxlite_setsrc (char *option) -{ - chsrc_ensure_root (); - - SourceInfo source; - chsrc_yield_source (os_linuxlite); - chsrc_confirm_source (&source); - - chsrc_backup (OS_Apt_SourceList); - - char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/.*/?@", source.url, "@g' /etc/apt/sources.list"); - - chsrc_run ("apt update", RunOpt_No_Last_New_Line); - chsrc_say_lastly (&source, ChsrcTypeAuto); -} - - - #include "recipe/os/openwrt.c" diff --git a/src/recipe/catalog.c b/src/recipe/catalog.c index bcc532c..a2d85a9 100644 --- a/src/recipe/catalog.c +++ b/src/recipe/catalog.c @@ -39,7 +39,6 @@ static const char }; -def_target(os_linuxlite); def_target(os_openkylin); def_target_noget(os_openeuler); def_target_noget(os_anolis); diff --git a/src/recipe/os/apt-family/Linux-Lite.c b/src/recipe/os/apt-family/Linux-Lite.c new file mode 100644 index 0000000..2ec3510 --- /dev/null +++ b/src/recipe/os/apt-family/Linux-Lite.c @@ -0,0 +1,47 @@ +/** ------------------------------------------------------------ + * SPDX-License-Identifier: GPL-3.0-or-later + * ------------------------------------------------------------- + * File Authors : Aoran Zeng + * Contributors : Nil Null + * Created On : <2023-09-29> + * Last Modified : <2024-08-16> + * ------------------------------------------------------------*/ + +/** + * @time 2023-09-29 更新 + */ +static SourceInfo +os_linuxlite_sources[] = { + {&Upstream, NULL}, + {&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/linuxliteos/"} +}; +def_sources_n(os_linuxlite); + + +void +os_linuxlite_getsrc (char *option) +{ + chsrc_view_file (OS_Apt_SourceList); +} + +/** + * 参考: https://help.mirrors.cernet.edu.cn/linuxliteos/ + */ +void +os_linuxlite_setsrc (char *option) +{ + chsrc_ensure_root (); + + SourceInfo source; + chsrc_yield_source (os_linuxlite); + chsrc_confirm_source (&source); + + chsrc_backup (OS_Apt_SourceList); + + char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/.*/?@", source.url, "@g' " OS_Apt_SourceList); + + chsrc_run ("apt update", RunOpt_No_Last_New_Line); + chsrc_say_lastly (&source, ChsrcTypeAuto); +} + +def_target(os_linuxlite);