mirror of
https://github.com/RubyMetric/chsrc.git
synced 2024-11-22 11:20:02 +08:00
Rename inner function
This commit is contained in:
parent
15d9ba817e
commit
eba633b6e4
|
@ -531,6 +531,7 @@ source_has_empty_url (SourceInfo *source)
|
|||
* @dependency 变量 source
|
||||
*/
|
||||
#define chsrc_yield_source(for_what) \
|
||||
SourceInfo source; \
|
||||
if (is_url (option)) \
|
||||
{ \
|
||||
SourceInfo __tmp = { &UserDefine, option }; \
|
||||
|
@ -554,8 +555,9 @@ source_has_empty_url (SourceInfo *source)
|
|||
*
|
||||
* @translation Done
|
||||
*/
|
||||
#define chsrc_confirm_source confirm_source(&source)
|
||||
void
|
||||
chsrc_confirm_source (SourceInfo *source)
|
||||
confirm_source (SourceInfo *source)
|
||||
{
|
||||
// 由于实现问题,我们把本应该独立出去的默认上游源,也放在了可以换源的数组中,而且放在第一个
|
||||
// chsrc 已经规避用户使用未实现的 `chsrc reset`
|
||||
|
@ -583,6 +585,8 @@ chsrc_confirm_source (SourceInfo *source)
|
|||
split_between_source_changing_process;
|
||||
}
|
||||
|
||||
#define chsrc_yield_source_and_confirm(for_what) chsrc_yield_source(for_what);chsrc_confirm_source
|
||||
|
||||
|
||||
#define ChsrcTypeAuto "auto"
|
||||
#define ChsrcTypeReset "reset"
|
||||
|
@ -617,7 +621,7 @@ chsrc_confirm_source (SourceInfo *source)
|
|||
* @translation Done
|
||||
*/
|
||||
void
|
||||
chsrc_say_lastly (SourceInfo *source, const char *last_word)
|
||||
chsrc_conclude (SourceInfo *source, const char *last_word)
|
||||
{
|
||||
split_between_source_changing_process;
|
||||
|
||||
|
|
|
@ -23,13 +23,11 @@ def_sources_n(pl_clojure);
|
|||
void
|
||||
pl_clojure_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_clojure);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_clojure);
|
||||
|
||||
chsrc_note2 ("抱歉,Clojure换源较复杂,您可手动查阅并换源:");
|
||||
puts (source.url);
|
||||
chsrc_say_lastly (&source, ChsrcTypeManual);
|
||||
chsrc_conclude (&source, ChsrcTypeManual);
|
||||
}
|
||||
|
||||
def_target_s (pl_clojure);
|
||||
|
|
|
@ -48,9 +48,7 @@ pl_dart_getsrc (char *option)
|
|||
void
|
||||
pl_dart_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_dart);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_dart);
|
||||
|
||||
char *towrite = NULL;
|
||||
|
||||
|
@ -85,7 +83,7 @@ pl_dart_setsrc (char *option)
|
|||
towrite = xy_strjoin (3, "export FLUTTER_STORAGE_BASE_URL=\"", flutter, "\"");
|
||||
chsrc_append_to_file (towrite, "~/.bashrc >> ~/.zshrc");
|
||||
}
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target(pl_dart);
|
||||
|
|
|
@ -59,16 +59,14 @@ pl_go_setsrc (char *option)
|
|||
{
|
||||
pl_go_check_cmd ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_go);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_go);
|
||||
|
||||
char *cmd = "go env -w GO111MODULE=on";
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
cmd = xy_strjoin (3, "go env -w GOPROXY=", source.url, ",direct");
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
def_target(pl_go);
|
||||
|
|
|
@ -24,9 +24,7 @@ def_sources_n(pl_haskell);
|
|||
void
|
||||
pl_haskell_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_haskell);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_haskell);
|
||||
|
||||
char *file = xy_strjoin (3, "repository mirror\n"
|
||||
" url: ", source.url,
|
||||
|
@ -64,7 +62,7 @@ pl_haskell_setsrc (char *option)
|
|||
|
||||
chsrc_note2 (xy_strjoin (3, "请向 ", config, " 中手动添加:"));
|
||||
puts (file);
|
||||
chsrc_say_lastly (&source, ChsrcTypeManual);
|
||||
chsrc_conclude (&source, ChsrcTypeManual);
|
||||
}
|
||||
|
||||
def_target_s (pl_haskell);
|
||||
|
|
|
@ -63,9 +63,7 @@ pl_java_setsrc (char *option)
|
|||
bool maven_exist, gradle_exist;
|
||||
pl_java_check_cmd (&maven_exist, &gradle_exist);
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_java);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_java);
|
||||
|
||||
if (maven_exist)
|
||||
{
|
||||
|
@ -97,7 +95,7 @@ pl_java_setsrc (char *option)
|
|||
chsrc_note2 ("请在您的 build.gradle 中添加:");
|
||||
puts (file);
|
||||
}
|
||||
chsrc_say_lastly (&source, ChsrcTypeManual);
|
||||
chsrc_conclude (&source, ChsrcTypeManual);
|
||||
}
|
||||
|
||||
def_target(pl_java);
|
||||
|
|
|
@ -42,14 +42,12 @@ pl_julia_getsrc (char *option)
|
|||
void
|
||||
pl_julia_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_julia);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_julia);
|
||||
|
||||
const char *towrite = xy_strjoin (3, "ENV[\"JULIA_PKG_SERVER\"] = \"", source.url, "\"");
|
||||
|
||||
chsrc_append_to_file (towrite, "~/.julia/config/startup.jl");
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target(pl_julia);
|
||||
|
|
|
@ -36,9 +36,7 @@ pl_lua_getsrc (char *option)
|
|||
void
|
||||
pl_lua_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_lua);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_lua);
|
||||
|
||||
char *config = xy_strjoin (3, "rocks_servers = {\n"
|
||||
" \"", source.url, "\"\n"
|
||||
|
@ -53,7 +51,7 @@ pl_lua_setsrc (char *option)
|
|||
chsrc_note2 ("请手动修改 ~/.luarocks/upload_config.lua 文件 (用于上传):");
|
||||
puts (upload_config);
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeManual);
|
||||
chsrc_conclude (&source, ChsrcTypeManual);
|
||||
}
|
||||
|
||||
def_target(pl_lua);
|
||||
|
|
|
@ -79,9 +79,7 @@ pl_nodejs_setsrc (char *option)
|
|||
bool npm_exist, yarn_exist, pnpm_exist;
|
||||
pl_nodejs_check_cmd (&npm_exist, &yarn_exist, &pnpm_exist);
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_nodejs);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_nodejs);
|
||||
|
||||
char *cmd = NULL;
|
||||
|
||||
|
@ -110,7 +108,7 @@ pl_nodejs_setsrc (char *option)
|
|||
chsrc_run (cmd, RunOpt_Default);
|
||||
}
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -39,9 +39,7 @@ pl_ocaml_setsrc(char *option)
|
|||
{
|
||||
pl_ocaml_check_cmd ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_ocaml);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_ocaml);
|
||||
|
||||
char *cmd = xy_strjoin (3, "opam repo set-url default ",
|
||||
source.url,
|
||||
|
@ -52,7 +50,7 @@ pl_ocaml_setsrc(char *option)
|
|||
chsrc_note2 ("如果是首次使用 opam ,请使用以下命令进行初始化");
|
||||
puts (xy_2strjoin ("opam init default ", source.url));
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeSemiAuto);
|
||||
}
|
||||
|
||||
def_target(pl_ocaml);
|
||||
|
|
|
@ -45,9 +45,7 @@ pl_php_setsrc (char *option)
|
|||
{
|
||||
pl_php_check_cmd ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_php);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_php);
|
||||
|
||||
char *where = " -g ";
|
||||
if (CliOpt_Locally==true)
|
||||
|
@ -58,7 +56,7 @@ pl_php_setsrc (char *option)
|
|||
char *cmd = xy_strjoin (4, "composer config", where, "repo.packagist composer ", source.url);
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeSemiAuto);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -47,9 +47,7 @@ pl_perl_getsrc (char *option)
|
|||
void
|
||||
pl_perl_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_perl);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_perl);
|
||||
|
||||
char *cmd = xy_strjoin (3,
|
||||
"perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('urllist', 'unshift', '", source.url, "'); CPAN::HandleConfig->commit()\"");
|
||||
|
@ -57,7 +55,7 @@ pl_perl_setsrc (char *option)
|
|||
|
||||
chsrc_note2 ("请您使用 perl -v 以及 cpan -v,若 Perl >= v5.36 或 CPAN >= 2.29,请额外手动调用下面的命令");
|
||||
puts ("perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('pushy_https', 0);; CPAN::HandleConfig->commit()\"");
|
||||
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeSemiAuto);
|
||||
}
|
||||
|
||||
def_target(pl_perl);
|
||||
|
|
|
@ -107,9 +107,7 @@ pl_python_setsrc (char *option)
|
|||
|
||||
pl_python_check_cmd (&prog, &poetry_exist, &pdm_exist);
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_python);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_python);
|
||||
|
||||
// 这里用的是 config --user,会写入用户目录(而不是项目目录)
|
||||
// GitHub#39
|
||||
|
@ -133,7 +131,7 @@ pl_python_setsrc (char *option)
|
|||
chsrc_run (cmd, RunOpt_Default);
|
||||
}
|
||||
|
||||
chsrc_say_lastly (&source, chsrc_type);
|
||||
chsrc_conclude (&source, chsrc_type);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -52,9 +52,7 @@ pl_r_getsrc (char *option)
|
|||
void
|
||||
pl_r_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_r);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_r);
|
||||
|
||||
char *bioconductor_url = xy_str_delete_suffix (xy_str_delete_suffix (source.url, "cran/"), "CRAN/");
|
||||
bioconductor_url = xy_2strjoin(bioconductor_url, "bioconductor");
|
||||
|
@ -73,7 +71,7 @@ pl_r_setsrc (char *option)
|
|||
chsrc_append_to_file (towrite1, "~/.Rprofile");
|
||||
chsrc_append_to_file (towrite2, "~/.Rprofile");
|
||||
}
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
def_target(pl_r);
|
||||
|
|
|
@ -68,9 +68,7 @@ pl_ruby_setsrc (char *option)
|
|||
|
||||
chsrc_ensure_program ("gem");
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_ruby);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_ruby);
|
||||
|
||||
char *cmd = NULL;
|
||||
|
||||
|
@ -91,7 +89,7 @@ pl_ruby_setsrc (char *option)
|
|||
cmd = xy_strjoin (4, "bundle config", where, "'mirror.https://rubygems.org' ", source.url);
|
||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||
|
||||
chsrc_say_lastly (&source, chsrc_type);
|
||||
chsrc_conclude (&source, chsrc_type);
|
||||
|
||||
// chsrc_note2 ("Ruby的镜像源目前仅有 腾讯软件源,RubyChina 实现正确");
|
||||
// chsrc_note2 ("而其它如Tuna,Bfsu,Ali目前都实现的有问题,请勿使用");
|
||||
|
|
|
@ -35,9 +35,7 @@ pl_rust_getsrc (char *option)
|
|||
void
|
||||
pl_rust_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_rust);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (pl_rust);
|
||||
|
||||
const char* file = xy_strjoin (3,
|
||||
"[source.crates-io]\n"
|
||||
|
@ -48,7 +46,7 @@ pl_rust_setsrc (char *option)
|
|||
|
||||
chsrc_note2 (xy_strjoin (3, "请您手动写入以下内容到 ", xy_uniform_path ("~/.cargo/config.toml"), " 文件中:"));
|
||||
puts (file);
|
||||
chsrc_say_lastly (&source, ChsrcTypeManual);
|
||||
chsrc_conclude (&source, ChsrcTypeManual);
|
||||
}
|
||||
|
||||
def_target(pl_rust);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -39,9 +39,7 @@ os_alpine_setsrc (char *option)
|
|||
{
|
||||
// chsrc_ensure_root(); // HELP: 不确定是否需要root
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_alpine);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_alpine);
|
||||
|
||||
char* cmd = xy_strjoin (3,
|
||||
"sed -i 's#https\\?://dl-cdn.alpinelinux.org/alpine#", source.url, "#g' /etc/apk/repositories"
|
||||
|
@ -49,7 +47,7 @@ os_alpine_setsrc (char *option)
|
|||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
chsrc_run ("apk update", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target(os_alpine);
|
||||
|
|
|
@ -42,7 +42,7 @@ os_freebsd_setsrc (char *option)
|
|||
int index = use_specific_mirror_or_auto_select (option, os_freebsd);
|
||||
|
||||
SourceInfo source = os_freebsd_sources[index];
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_confirm_source;
|
||||
|
||||
chsrc_log2 ("1. 添加 freebsd-pkg 源 (二进制安装包)");
|
||||
chsrc_ensure_dir ("/usr/local/etc/pkg/repos");
|
||||
|
@ -128,7 +128,7 @@ os_freebsd_setsrc (char *option)
|
|||
chsrc_overwrite_file (update, "/etc/freebsd-update.conf");
|
||||
*/
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeSemiAuto);
|
||||
}
|
||||
|
||||
def_target_s(os_freebsd);
|
||||
|
|
|
@ -46,9 +46,7 @@ os_netbsd_setsrc (char *option)
|
|||
{
|
||||
chsrc_ensure_root (); // HELP: 不知道是否需要确保root权限
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_netbsd);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_netbsd);
|
||||
|
||||
chsrc_backup ("/usr/pkg/etc/pkgin/repositories.conf");
|
||||
|
||||
|
@ -59,7 +57,7 @@ os_netbsd_setsrc (char *option)
|
|||
char *url = xy_strjoin (5, source.url, arch, "/", version, "/All");
|
||||
chsrc_overwrite_file (url, "/usr/pkg/etc/pkgin/repositories.conf");
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target(os_netbsd);
|
||||
|
|
|
@ -41,14 +41,12 @@ os_openbsd_setsrc (char *option)
|
|||
{
|
||||
chsrc_ensure_root ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_openbsd);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_openbsd);
|
||||
|
||||
chsrc_backup ("/etc/installurl");
|
||||
chsrc_overwrite_file (source.url, "/etc/installurl");
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target(os_openbsd);
|
||||
|
|
|
@ -33,9 +33,7 @@ os_gentoo_setsrc (char *option)
|
|||
{
|
||||
chsrc_ensure_root ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_gentoo);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_gentoo);
|
||||
|
||||
chsrc_backup ("/etc/portage/repos.conf/gentoo.conf");
|
||||
|
||||
|
@ -47,7 +45,7 @@ os_gentoo_setsrc (char *option)
|
|||
char *towrite = xy_strjoin (3, "GENTOO_MIRRORS=\"https://", source.url, "gentoo\"");
|
||||
|
||||
chsrc_append_to_file (towrite, "/etc/portage/make.conf");
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target_s(os_gentoo);
|
||||
|
|
|
@ -42,16 +42,14 @@ os_openwrt_setsrc (char *option)
|
|||
{
|
||||
chsrc_ensure_root ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_openwrt);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_openwrt);
|
||||
|
||||
chsrc_backup (OS_OpenWRT_SourceConfig);
|
||||
|
||||
char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*downloads.openwrt.org@", source.url, "@g' " OS_OpenWRT_SourceConfig);
|
||||
|
||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -28,13 +28,11 @@ os_solus_setsrc (char *option)
|
|||
{
|
||||
chsrc_ensure_root ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_solus);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_solus);
|
||||
|
||||
char *cmd = xy_2strjoin ("eopkg add-repo Solus ", source.url);
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
def_target_s(os_solus);
|
||||
|
|
|
@ -33,11 +33,9 @@ os_void_getsrc (char *option)
|
|||
void
|
||||
os_void_setsrc (char *option)
|
||||
{
|
||||
// chsrc_ensure_root(); // HELP: 不确定是否需要root
|
||||
chsrc_ensure_root (); // HELP: 不确定是否需要root
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_void);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_void);
|
||||
|
||||
chsrc_ensure_dir ("/etc/xbps.d");
|
||||
char *cmd = "cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/";
|
||||
|
@ -53,8 +51,8 @@ os_void_setsrc (char *option)
|
|||
);
|
||||
|
||||
chsrc_note2 ("若报错可尝试使用以下命令:");
|
||||
puts (cmd);
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
say (cmd);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target(os_void);
|
||||
|
|
|
@ -29,16 +29,14 @@ os_almalinux_setsrc (char *option)
|
|||
{
|
||||
chsrc_ensure_root ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_almalinux);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_almalinux);
|
||||
|
||||
char *cmd = xy_strjoin (3,
|
||||
"sed -e 's|^mirrorlist=|#mirrorlist=|g' -e 's|^#\\s*baseurl=https://repo.almalinux.org/almalinux|baseurl=", source.url, "|g' -i.bak /etc/yum.repos.d/almalinux*.repo");
|
||||
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
def_target_s(os_almalinux);
|
||||
|
|
|
@ -29,16 +29,14 @@ os_anolis_setsrc (char *option)
|
|||
{
|
||||
chsrc_ensure_root ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_anolis);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_anolis);
|
||||
|
||||
char *cmd = xy_strjoin (3, "sed -i.bak -E 's|https?://(mirrors\\.openanolis\\.cn/anolis)|", source.url, "|g' /etc/yum.repos.d/*.repo");
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
chsrc_run ("dnf makecache", RunOpt_Default);
|
||||
chsrc_run ("dnf update", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target_s(os_anolis);
|
||||
|
|
|
@ -35,9 +35,7 @@ os_fedora_setsrc (char *option)
|
|||
{
|
||||
chsrc_ensure_root ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_fedora);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_fedora);
|
||||
|
||||
chsrc_note2 ("Fedora 29 及以下版本暂不支持");
|
||||
|
||||
|
@ -62,7 +60,7 @@ os_fedora_setsrc (char *option)
|
|||
chsrc_log2 ("已新增文件 /etc/yum.repos.d/fedora-updates-modular.repo");
|
||||
|
||||
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
def_target_s(os_fedora);
|
||||
|
|
|
@ -33,9 +33,7 @@ os_rockylinux_setsrc (char *option)
|
|||
{
|
||||
chsrc_ensure_root ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_rockylinux);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_rockylinux);
|
||||
|
||||
char *cmd = xy_strjoin (3,
|
||||
"sed -e 's|^mirrorlist=|#mirrorlist=|g' "
|
||||
|
@ -44,7 +42,7 @@ os_rockylinux_setsrc (char *option)
|
|||
);
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target_s(os_rockylinux);
|
||||
|
|
|
@ -32,9 +32,7 @@ os_openeuler_setsrc (char *option)
|
|||
{
|
||||
chsrc_ensure_root ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_openeuler);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_openeuler);
|
||||
|
||||
chsrc_backup (OS_openEuler_SourceList);
|
||||
|
||||
|
@ -45,7 +43,7 @@ os_openeuler_setsrc (char *option)
|
|||
chsrc_overwrite_file (towrite, OS_openEuler_SourceList);
|
||||
|
||||
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
def_target_s(os_openeuler);
|
||||
|
|
|
@ -33,9 +33,7 @@ os_opensuse_setsrc (char *option)
|
|||
{
|
||||
chsrc_ensure_root (); // HELP: 不知道是否需要确保root权限
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_opensuse);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_opensuse);
|
||||
|
||||
char *source_nselect = "zypper mr -da";
|
||||
chsrc_run (source_nselect, RunOpt_Default);
|
||||
|
@ -76,7 +74,7 @@ os_opensuse_setsrc (char *option)
|
|||
|
||||
chsrc_run (cmd5, RunOpt_Default);
|
||||
chsrc_run (cmd6, RunOpt_Default);
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target_s(os_opensuse);
|
||||
|
|
|
@ -59,9 +59,7 @@ os_arch_setsrc (char *option)
|
|||
{
|
||||
chsrc_ensure_root ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_arch);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_arch);
|
||||
|
||||
chsrc_backup (OS_Pacman_MirrorList);
|
||||
|
||||
|
@ -91,7 +89,7 @@ os_arch_setsrc (char *option)
|
|||
{
|
||||
chsrc_run ("pacman -Syy", RunOpt_No_Last_New_Line);
|
||||
}
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,9 +107,7 @@ os_archlinuxcn_setsrc (char *option)
|
|||
{
|
||||
chsrc_ensure_root ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_archlinuxcn);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_archlinuxcn);
|
||||
|
||||
chsrc_backup (OS_Pacman_MirrorList);
|
||||
|
||||
|
@ -126,7 +122,7 @@ os_archlinuxcn_setsrc (char *option)
|
|||
chsrc_run ("pacman -Sy archlinuxcn-keyring", RunOpt_Default);
|
||||
|
||||
chsrc_run ("pacman -Syy", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
#undef OS_Pacman_MirrorList
|
||||
|
||||
|
|
|
@ -31,9 +31,7 @@ def_sources_n(os_msys2);
|
|||
void
|
||||
os_msys2_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (os_msys2);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (os_msys2);
|
||||
|
||||
chsrc_backup ("/etc/pacman.d/mirrorlist.mingw32");
|
||||
chsrc_backup ("/etc/pacman.d/mirrorlist.mingw64");
|
||||
|
@ -49,7 +47,7 @@ os_msys2_setsrc (char *option)
|
|||
"#g\" /etc/pacman.d/mirrorlist* ");
|
||||
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target_s(os_msys2);
|
||||
|
|
|
@ -20,7 +20,7 @@ os_manjaro_setsrc (char *option)
|
|||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
chsrc_run ("pacman -Syy", RunOpt_No_Last_New_Line);
|
||||
chsrc_say_lastly (NULL, ChsrcTypeAuto);
|
||||
chsrc_conclude (NULL, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
TargetInfo os_manjaro_target = {NULL, os_manjaro_setsrc, NULL, NULL, 0};
|
||||
|
|
|
@ -71,17 +71,13 @@ void
|
|||
{
|
||||
// chsrc set <target>
|
||||
|
||||
// 下面这3行是必须的
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_ruby);
|
||||
chsrc_confirm_source (&source);
|
||||
|
||||
// 下面这行是必须的,注入source变量
|
||||
chsrc_yield_source_and_confirm (<category>_<target>);
|
||||
|
||||
/* 具体的换源步骤,如调用第三方命令... */
|
||||
|
||||
|
||||
// 最后总结输出
|
||||
chsrc_say_lastly (&source, chsrc_type);
|
||||
chsrc_conclude (&source, chsrc_type);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -25,9 +25,7 @@ def_sources_n(wr_anaconda);
|
|||
void
|
||||
wr_anaconda_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (wr_anaconda);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (wr_anaconda);
|
||||
|
||||
char *main = xy_2strjoin (source.url, "pkgs/main");
|
||||
char *r = xy_2strjoin (source.url, "pkgs/r");
|
||||
|
@ -69,7 +67,7 @@ wr_anaconda_setsrc (char *option)
|
|||
puts (file);
|
||||
|
||||
chsrc_note2 ("然后运行 conda clean -i 清除索引缓存,保证用的是镜像站提供的索引");
|
||||
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeSemiAuto);
|
||||
}
|
||||
|
||||
def_target_s (wr_anaconda);
|
||||
|
|
|
@ -24,9 +24,7 @@ def_sources_n(wr_cocoapods);
|
|||
void
|
||||
wr_cocoapods_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (wr_cocoapods);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (wr_cocoapods);
|
||||
|
||||
chsrc_note2 ("请手动执行以下命令:");
|
||||
|
||||
|
@ -40,7 +38,7 @@ wr_cocoapods_setsrc (char *option)
|
|||
char *source_str = xy_strjoin (3, "source '", source.url, "'");
|
||||
say (source_str);
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeManual);
|
||||
chsrc_conclude (&source, ChsrcTypeManual);
|
||||
}
|
||||
|
||||
def_target_s (wr_cocoapods);
|
||||
|
|
|
@ -66,9 +66,7 @@ wr_dockerhub_getsrc (char *option)
|
|||
void
|
||||
wr_dockerhub_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (wr_dockerhub);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (wr_dockerhub);
|
||||
|
||||
if (xy_on_linux || xy_on_bsd)
|
||||
{
|
||||
|
@ -93,7 +91,7 @@ wr_dockerhub_setsrc (char *option)
|
|||
chsrc_note2 ("选择“Docker Engine”选项卡,在该选项卡中找到“registry-mirrors”一栏,添加镜像地址:");
|
||||
puts (source.url);
|
||||
}
|
||||
chsrc_say_lastly (&source, ChsrcTypeManual);
|
||||
chsrc_conclude (&source, ChsrcTypeManual);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,14 +30,12 @@ def_sources_n(wr_emacs);
|
|||
void
|
||||
wr_emacs_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (wr_emacs);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (wr_emacs);
|
||||
|
||||
chsrc_note2 ("Emacs换源涉及Elisp,需要手动查阅并换源:");
|
||||
puts (source.url);
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeManual);
|
||||
chsrc_conclude (&source, ChsrcTypeManual);
|
||||
}
|
||||
|
||||
def_target_s (wr_emacs);
|
||||
|
|
|
@ -25,9 +25,7 @@ def_sources_n(wr_flathub);
|
|||
void
|
||||
wr_flathub_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (wr_flathub);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (wr_flathub);
|
||||
|
||||
chsrc_note2 ("若出现问题,可先调用以下命令:");
|
||||
char *note = xy_strjoin (3,
|
||||
|
@ -39,7 +37,7 @@ wr_flathub_setsrc (char *option)
|
|||
char *cmd = xy_2strjoin ("flatpak remote-modify flathub --url=", source.url);
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
def_target_s (wr_flathub);
|
||||
|
|
|
@ -25,9 +25,7 @@ def_sources_n(wr_guix);
|
|||
void
|
||||
wr_guix_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (wr_guix);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (wr_guix);
|
||||
|
||||
char *file = xy_strjoin (3, "(list (channel\n"
|
||||
" (inherit (car %default-channels))\n"
|
||||
|
@ -35,7 +33,7 @@ wr_guix_setsrc (char *option)
|
|||
|
||||
chsrc_note2 ("为防止扰乱配置文件,请您手动写入以下内容到 ~/.config/guix/channels.scm 文件中");
|
||||
puts (file);
|
||||
chsrc_say_lastly (&source, ChsrcTypeManual);
|
||||
chsrc_conclude (&source, ChsrcTypeManual);
|
||||
}
|
||||
|
||||
def_target_s (wr_guix);
|
||||
|
|
|
@ -45,9 +45,7 @@ wr_homebrew_getsrc (char *option)
|
|||
void
|
||||
wr_homebrew_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (wr_homebrew);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (wr_homebrew);
|
||||
|
||||
char *splitter = "\n\n# Generated by chsrc " Chsrc_Version;
|
||||
char *api_domain = xy_strjoin (3, "export HOMEBREW_API_DOMAIN=\"", xy_2strjoin (source.url, "homebrew-bottles/api"), "\"");
|
||||
|
@ -74,7 +72,7 @@ wr_homebrew_setsrc (char *option)
|
|||
chsrc_append_to_file (core_git_remote, bashrc);
|
||||
}
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
chsrc_note2 ("请您重启终端使Homebrew环境变量生效");
|
||||
}
|
||||
|
||||
|
|
|
@ -38,9 +38,7 @@ wr_nix_setsrc (char *option)
|
|||
{
|
||||
wr_nix_check_cmd ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (wr_nix);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (wr_nix);
|
||||
|
||||
char *cmd = xy_strjoin (3, "nix-channel --add ", source.url, "nixpkgs-unstable nixpkgs");
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
@ -58,7 +56,7 @@ wr_nix_setsrc (char *option)
|
|||
chsrc_note2 ("若您使用的是NixOS,请额外添加下述内容至 configuration.nix 中");
|
||||
puts (cmd);
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeSemiAuto);
|
||||
}
|
||||
|
||||
def_target_s (wr_nix);
|
||||
|
|
|
@ -61,9 +61,7 @@ wr_tex_setsrc (char *option)
|
|||
bool tlmgr_exist, mpm_exist;
|
||||
wr_tex_check_cmd (&tlmgr_exist, &mpm_exist);
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (wr_tex);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (wr_tex);
|
||||
|
||||
char *cmd = NULL;
|
||||
|
||||
|
@ -80,7 +78,7 @@ wr_tex_setsrc (char *option)
|
|||
chsrc_run (cmd, RunOpt_Default);
|
||||
}
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeUntested);
|
||||
chsrc_conclude (&source, ChsrcTypeUntested);
|
||||
}
|
||||
|
||||
def_target(wr_tex);
|
||||
|
|
|
@ -29,21 +29,19 @@ wr_winget_getsrc (char *option)
|
|||
void
|
||||
wr_winget_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (wr_winget);
|
||||
chsrc_confirm_source (&source);
|
||||
chsrc_yield_source_and_confirm (wr_winget);
|
||||
|
||||
chsrc_run ("winget source remove winget", RunOpt_Default);
|
||||
chsrc_run (xy_2strjoin ("winget source add winget ", source.url), RunOpt_Default);
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
void
|
||||
wr_winget_resetsrc (char *option)
|
||||
{
|
||||
chsrc_run ("winget source reset winget", RunOpt_Default);
|
||||
chsrc_say_lastly (NULL, ChsrcTypeAuto);
|
||||
chsrc_conclude (NULL, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user