Add os_ros

This commit is contained in:
Heng Guo 2023-09-30 11:38:47 +08:00
parent 547a0707e3
commit 0d5adeb37f
2 changed files with 49 additions and 2 deletions

33
chsrc.c
View File

@ -1583,6 +1583,34 @@ os_openbsd_setsrc(char* option)
chsrc_say_thanks(&source);
}
/**
*
* https://mirrors.tuna.tsinghua.edu.cn/help/ros/
*/
void
os_ros_setsrc (char* option)
{
chsrc_ensure_root();
int index = use_specific_mirror_or_auto_select (option, os_ros);
source_info source = os_ros_sources[index];
chsrc_say_selection(&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);
cmd = "sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654";
chsrc_run(cmd);
chsrc_run("sudo apt update");
chsrc_say_thanks(&source);
}
@ -1928,7 +1956,8 @@ target_info
os_rocky_target = {os_rocky_setsrc, NULL, os_rocky_sources, os_rocky_sources_n},
os_solus_target = {os_solus_setsrc, NULL, os_solus_sources, os_solus_sources_n},
os_freebsd_target = {os_freebsd_setsrc, NULL, os_freebsd_sources, os_freebsd_sources_n},
os_openeuler_target = {os_openeuler_setsrc, NULL, os_openeuler_sources, os_openeuler_sources_n};
os_openeuler_target = {os_openeuler_setsrc, NULL, os_openeuler_sources, os_openeuler_sources_n},
os_ros_target = {os_ros_setsrc, NULL, os_ros_sources, os_ros_sources_n};
static const char
*os_ubuntu [] = {"ubuntu", NULL, targetinfo(&os_ubuntu_target)},
@ -1954,6 +1983,7 @@ static const char
*os_deepin [] = {"deepin", NULL, targetinfo(&os_deepin_target)},
*os_openeuler [] = {"euler", "openeuler", NULL, targetinfo(&os_openeuler_target)},
*os_openkylin [] = {"kylin", "openkylin", NULL, targetinfo(&os_openkylin_target)},
*os_ros [] = {"ros", "ros", NULL, targetinfo(&os_ros_target)},
**os_systems[] =
{
os_ubuntu, os_mint, os_debian, os_fedora, os_opensuse, os_kali,
@ -1964,6 +1994,7 @@ static const char
os_freebsd, os_netbsd, os_openbsd,
os_msys2,
os_deepin, os_openeuler, os_openkylin,
os_ros
};

View File

@ -677,6 +677,22 @@ os_openkylin_sources[] = {
{&Upstream, "https://archive.openkylin.top/openkylin/"},
{&Ali, "https://mirrors.aliyun.com/openkylin/"},
{&Netease, "https://mirrors.163.com/openkylin/"},
},
/**
* 2023-09-30
*
* TODO: 1.
*/
os_ros_sources[] = {
{&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"},
{&Netease, "https://mirrors.163.com"},
{&Sohu, "https://mirrors.sohu.com"}
};
@ -800,7 +816,7 @@ def_target_sources_n(os_trisquel); def_target_sources_n(os_linuxlite); def_targe
def_target_sources_n(os_freebsd); def_target_sources_n(os_netbsd); def_target_sources_n(os_openbsd);
def_target_sources_n(os_deepin); def_target_sources_n(os_openeuler); def_target_sources_n(os_openkylin);
def_target_sources_n(os_ros);
def_target_sources_n(wr_brew); def_target_sources_n(wr_flathub);
def_target_sources_n(wr_nix); def_target_sources_n(wr_guix);