diff --git a/include/source.h b/include/source.h index 8fccf37..90dd36a 100644 --- a/include/source.h +++ b/include/source.h @@ -297,23 +297,6 @@ os_openkylin_sources[] = { {&Upstream, "https://archive.openkylin.top/openkylin/"}, {&Ali, "https://mirrors.aliyun.com/openkylin/"}, {&Netease, "https://mirrors.163.com/openkylin/"}, -}, - - -/** - * @time 2024-04-18 更新 - * @note 未经测试是否有效 - */ -os_ros_sources[] = { - {&Upstream, NULL}, - {&Ali, "https://mirrors.aliyun.com"}, - {&Bfsu, "https://mirrors.bfsu.edu.cn"}, - {&Ustc, "https://mirrors.ustc.edu.cn"}, - {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn"}, - {&Tencent, "https://mirrors.tencent.com"}, - {&Huawei, "https://mirrors.huaweicloud.com"}, - {&Netease, "https://mirrors.163.com"}, - {&Sohu, "https://mirrors.sohu.com"} }; @@ -435,8 +418,6 @@ def_sources_n(os_rocky); def_sources_n(os_alma); def_sources_n(os_linuxlite); -def_sources_n(os_ros); - def_sources_n(os_deepin); 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 d07a9c6..d2ba274 100644 --- a/src/chsrc.c +++ b/src/chsrc.c @@ -76,6 +76,7 @@ pl_clojure_setsrc (char *option) #include "recipe/os/apt-family/trisquel.c" #include "recipe/os/apt-family/armbian.c" #include "recipe/os/apt-family/raspberrypi.c" +#include "recipe/os/apt-family/ros.c" @@ -308,7 +309,7 @@ os_linuxlite_setsrc (char *option) -#include "./recipe/os/openwrt.c" +#include "recipe/os/openwrt.c" @@ -386,33 +387,6 @@ os_openkylin_setsrc (char *option) #include "recipe/os/netbsd.c" #include "recipe/os/openbsd.c" -/** - * 参考: - * https://mirrors.tuna.tsinghua.edu.cn/help/ros/ - */ -void -os_ros_setsrc (char *option) -{ - chsrc_ensure_root (); - - SourceInfo source; - chsrc_yield_source (os_ros); - chsrc_confirm_source (&source); - - chsrc_backup ("/etc/apt/sources.list.d/ros-latest.list"); - - char *cmd = NULL; - cmd = xy_strjoin(3, "sed -E -i \'s@https?://.*/ros/ubuntu/?@", source.url, "@/ros/ubuntug\' /etc/apt/sources.list"); - chsrc_run(cmd, RunOpt_Default); - - cmd = "apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654"; - chsrc_run (cmd, RunOpt_Default); - - chsrc_run ("apt update", RunOpt_No_Last_New_Line); - chsrc_say_lastly (&source, ChsrcTypeUntested); -} - - diff --git a/src/recipe/catalog.c b/src/recipe/catalog.c index cea0be5..8489ec1 100644 --- a/src/recipe/catalog.c +++ b/src/recipe/catalog.c @@ -47,7 +47,6 @@ def_target_noget(os_rocky); def_target_noget(os_alma); def_target_noget(os_openeuler); def_target_noget(os_anolis); -def_target_noget(os_ros); def_target_noget(os_msys2); TargetInfo os_manjaro_target = {NULL, os_manjaro_setsrc, NULL, NULL, 0}; diff --git a/src/recipe/os/apt-family/common.h b/src/recipe/os/apt-family/common.h index f246c7f..e194976 100644 --- a/src/recipe/os/apt-family/common.h +++ b/src/recipe/os/apt-family/common.h @@ -26,7 +26,13 @@ #define OS_Is_Debian_Literally 1 #define OS_Is_Ubuntu 2 +// independent +#define OS_ROS_SourceList OS_Apt_SourceList_D "ros-latest.list" + +// Ubuntu based #define OS_LinuxMint_SourceList OS_Apt_SourceList_D "official-package-repositories.list" + +// Debian based #define OS_Armbian_SourceList OS_Apt_SourceList_D "armbian.list" #define OS_RaspberryPi_SourceList OS_Apt_SourceList_D "raspi.list" diff --git a/src/recipe/os/apt-family/ros.c b/src/recipe/os/apt-family/ros.c new file mode 100644 index 0000000..9426a64 --- /dev/null +++ b/src/recipe/os/apt-family/ros.c @@ -0,0 +1,54 @@ +/** ------------------------------------------------------------ + * SPDX-License-Identifier: GPL-3.0-or-later + * ------------------------------------------------------------- + * File Authors : Heng Guo <2085471348@qq.com> + * Contributors : Aoran Zeng + * Created On : <2023-09-03> + * Last Modified : <2024-08-16> + * ------------------------------------------------------------*/ + +/** + * @time 2024-04-18 更新 + * @note 未经测试是否有效 + */ +static SourceInfo +os_ros_sources[] = { + {&Upstream, NULL}, + {&Ali, "https://mirrors.aliyun.com"}, + {&Bfsu, "https://mirrors.bfsu.edu.cn"}, + {&Ustc, "https://mirrors.ustc.edu.cn"}, + {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn"}, + {&Tencent, "https://mirrors.tencent.com"}, + {&Huawei, "https://mirrors.huaweicloud.com"}, + {&Netease, "https://mirrors.163.com"}, + {&Sohu, "https://mirrors.sohu.com"} +}; +def_sources_n(os_ros); + +/** + * 参考: + * https://mirrors.tuna.tsinghua.edu.cn/help/ros/ + */ +void +os_ros_setsrc (char *option) +{ + chsrc_ensure_root (OS_ROS_SourceList); + + SourceInfo source; + chsrc_yield_source (os_ros); + chsrc_confirm_source (&source); + + chsrc_backup (OS_ROS_SourceList); + + char *cmd = NULL; + cmd = xy_strjoin(3, "sed -E -i \'s@https?://.*/ros/ubuntu/?@", source.url, "@/ros/ubuntug\' " OS_ROS_SourceList); + chsrc_run(cmd, RunOpt_Default); + + cmd = "apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654"; + chsrc_run (cmd, RunOpt_Default); + + chsrc_run ("apt update", RunOpt_No_Last_New_Line); + chsrc_say_lastly (&source, ChsrcTypeUntested); +} + +def_target_noget(os_ros);