mirror of
https://github.com/RubyMetric/chsrc
synced 2025-12-25 20:09:54 +08:00
Rename inner function
This commit is contained in:
@@ -43,9 +43,7 @@ os_armbian_setsrc (char *option)
|
||||
{
|
||||
chsrc_ensure_root ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_armbian);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_armbian);
|
||||
|
||||
chsrc_backup (OS_Armbian_SourceList);
|
||||
|
||||
@@ -54,7 +52,7 @@ os_armbian_setsrc (char *option)
|
||||
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
#undef OS_Armbian_SourceList
|
||||
|
||||
|
||||
@@ -48,9 +48,7 @@ os_debian_getsrc (char *option)
|
||||
void
|
||||
os_debian_setsrc_for_deb822 (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_debian);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_debian);
|
||||
|
||||
chsrc_note2 ("如果遇到无法拉取 HTTPS 源的情况,我们会使用 HTTP 源并需要您运行:");
|
||||
puts ("apt install apt-transport-https ca-certificates");
|
||||
@@ -65,7 +63,7 @@ os_debian_setsrc_for_deb822 (char *option)
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
|
||||
@@ -89,9 +87,7 @@ os_debian_setsrc (char *option)
|
||||
// Docker环境下,Debian镜像可能不存在该文件
|
||||
bool sourcelist_exist = ensure_apt_sourcelist (OS_Is_Debian_Literally);
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_debian);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_debian);
|
||||
|
||||
chsrc_note2 ("如果遇到无法拉取 HTTPS 源的情况,我们会使用 HTTP 源并需要您运行:");
|
||||
puts ("apt install apt-transport-https ca-certificates");
|
||||
@@ -106,7 +102,7 @@ os_debian_setsrc (char *option)
|
||||
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
def_target(os_debian);
|
||||
|
||||
@@ -41,9 +41,7 @@ os_kali_setsrc (char *option)
|
||||
{
|
||||
chsrc_ensure_root ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_kali);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_kali);
|
||||
|
||||
chsrc_backup (OS_Apt_SourceList);
|
||||
|
||||
@@ -53,7 +51,7 @@ os_kali_setsrc (char *option)
|
||||
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target(os_kali);
|
||||
|
||||
@@ -32,16 +32,14 @@ os_linuxlite_setsrc (char *option)
|
||||
{
|
||||
chsrc_ensure_root ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_linuxlite);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_linuxlite);
|
||||
|
||||
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);
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
def_target(os_linuxlite);
|
||||
|
||||
@@ -35,9 +35,7 @@ os_linuxmint_setsrc (char *option)
|
||||
{
|
||||
chsrc_ensure_root ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_linuxmint);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_linuxmint);
|
||||
|
||||
chsrc_backup (OS_LinuxMint_SourceList);
|
||||
|
||||
@@ -46,7 +44,7 @@ os_linuxmint_setsrc (char *option)
|
||||
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
chsrc_warn2 ("完成后请不要再使用 mintsources(自带的图形化软件源设置工具)进行任何操作,因为在操作后,无论是否有按“确定”,mintsources 均会覆写我们刚才换源的内容");
|
||||
}
|
||||
|
||||
|
||||
@@ -34,9 +34,7 @@ os_ros_setsrc (char *option)
|
||||
{
|
||||
chsrc_ensure_root (OS_ROS_SourceList);
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_ros);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_ros);
|
||||
|
||||
chsrc_backup (OS_ROS_SourceList);
|
||||
|
||||
@@ -48,7 +46,7 @@ os_ros_setsrc (char *option)
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target_s(os_ros);
|
||||
|
||||
@@ -35,9 +35,7 @@ os_raspberrypi_setsrc (char *option)
|
||||
{
|
||||
chsrc_ensure_root(); // HELP: 不确定是否需要
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_raspberrypi);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_raspberrypi);
|
||||
|
||||
chsrc_backup (OS_RaspberryPi_SourceList);
|
||||
|
||||
@@ -46,7 +44,7 @@ os_raspberrypi_setsrc (char *option)
|
||||
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target(os_raspberrypi);
|
||||
|
||||
@@ -37,9 +37,7 @@ os_trisquel_setsrc (char *option)
|
||||
{
|
||||
chsrc_ensure_root ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_trisquel);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_trisquel);
|
||||
|
||||
chsrc_backup (OS_Apt_SourceList);
|
||||
|
||||
@@ -47,7 +45,7 @@ os_trisquel_setsrc (char *option)
|
||||
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target(os_trisquel);
|
||||
|
||||
@@ -53,9 +53,7 @@ os_ubuntu_getsrc (char *option)
|
||||
void
|
||||
os_ubuntu_setsrc_for_deb822 (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_ubuntu);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_ubuntu);
|
||||
|
||||
chsrc_backup (OS_Ubuntu_SourceList_DEB822);
|
||||
|
||||
@@ -72,7 +70,7 @@ os_ubuntu_setsrc_for_deb822 (char *option)
|
||||
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,9 +90,7 @@ os_ubuntu_setsrc (char *option)
|
||||
|
||||
bool sourcelist_exist = ensure_apt_sourcelist (OS_Is_Ubuntu);
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_ubuntu);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_ubuntu);
|
||||
|
||||
// 不存在的时候,用的是我们生成的无效文件,不要备份
|
||||
if (sourcelist_exist)
|
||||
@@ -115,7 +111,7 @@ os_ubuntu_setsrc (char *option)
|
||||
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
def_target(os_ubuntu);
|
||||
|
||||
@@ -41,9 +41,7 @@ os_deepin_setsrc (char *option)
|
||||
{
|
||||
chsrc_ensure_root();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_deepin);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_deepin);
|
||||
|
||||
chsrc_backup (OS_Apt_SourceList);
|
||||
|
||||
@@ -53,7 +51,7 @@ os_deepin_setsrc (char *option)
|
||||
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target(os_deepin);
|
||||
|
||||
@@ -32,16 +32,14 @@ os_openkylin_setsrc (char *option)
|
||||
{
|
||||
chsrc_ensure_root();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_openkylin);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_openkylin);
|
||||
|
||||
chsrc_backup (OS_Apt_SourceList);
|
||||
|
||||
char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/openkylin/?@", source.url, "@g'" OS_Apt_SourceList);
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target(os_openkylin);
|
||||
|
||||
Reference in New Issue
Block a user