mirror of
https://github.com/RubyMetric/chsrc
synced 2025-06-08 19:54:13 +08:00
Adjust chsrc_conclude()
This commit is contained in:
parent
6a59ec51e1
commit
722de55ecb
@ -30,6 +30,17 @@ int ProgMode_Leader_Selected_Index = -1;
|
|||||||
/* 此时 chsrc_run() 不再是recipe中指定要运行的一个外部命令,而是作为一个功能实现的支撑 */
|
/* 此时 chsrc_run() 不再是recipe中指定要运行的一个外部命令,而是作为一个功能实现的支撑 */
|
||||||
bool ProgMode_Run_as_a_Service = false;
|
bool ProgMode_Run_as_a_Service = false;
|
||||||
|
|
||||||
|
enum ChgType_t
|
||||||
|
{
|
||||||
|
ChgType_Auto,
|
||||||
|
ChgType_Reset,
|
||||||
|
ChgType_SemiAuto,
|
||||||
|
ChgType_Manual,
|
||||||
|
ChgType_Untested
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ChgType_t ProgMode_ChgType = ChgType_Auto;
|
||||||
|
|
||||||
|
|
||||||
/* 命令行选项 */
|
/* 命令行选项 */
|
||||||
bool CliOpt_IPv6 = false;
|
bool CliOpt_IPv6 = false;
|
||||||
@ -769,7 +780,7 @@ source_has_empty_url (Source_t *source)
|
|||||||
* 1. 用户指定某个 Mirror Code
|
* 1. 用户指定某个 Mirror Code
|
||||||
* 2. NULL: 用户什么都没指定 (将测速选择最快镜像)
|
* 2. NULL: 用户什么都没指定 (将测速选择最快镜像)
|
||||||
* 3. 用户给了一个 URL
|
* 3. 用户给了一个 URL
|
||||||
* 4. SetsrcType_Reset
|
* 4. ChgType_Reset
|
||||||
* 选用了Leader target
|
* 选用了Leader target
|
||||||
* 5. ProgMode_Leader_Selected_Index 将给出所选索引
|
* 5. ProgMode_Leader_Selected_Index 将给出所选索引
|
||||||
*
|
*
|
||||||
@ -846,11 +857,6 @@ confirm_source (Source_t *source)
|
|||||||
#define chsrc_yield_source_and_confirm(for_what) chsrc_yield_source(for_what);chsrc_confirm_source
|
#define chsrc_yield_source_and_confirm(for_what) chsrc_yield_source(for_what);chsrc_confirm_source
|
||||||
|
|
||||||
|
|
||||||
#define SetsrcType_Auto "auto"
|
|
||||||
#define SetsrcType_Reset "reset"
|
|
||||||
#define SetsrcType_SemiAuto "semiauto"
|
|
||||||
#define SetsrcType_Manual "manual"
|
|
||||||
#define SetsrcType_Untested "untested"
|
|
||||||
|
|
||||||
#define MSG_EN_PUBLIC_URL "If the URL you specify is a public service, you are invited to contribute: chsrc issue"
|
#define MSG_EN_PUBLIC_URL "If the URL you specify is a public service, you are invited to contribute: chsrc issue"
|
||||||
#define MSG_CN_PUBLIC_URL "若您指定的URL为公有服务,邀您参与贡献: chsrc issue"
|
#define MSG_CN_PUBLIC_URL "若您指定的URL为公有服务,邀您参与贡献: chsrc issue"
|
||||||
@ -876,22 +882,24 @@ confirm_source (Source_t *source)
|
|||||||
#define thank_mirror(msg) chsrc_log(xy_2strjoin(msg,purple(CliOpt_InEnglish?source->mirror->abbr:source->mirror->name)))
|
#define thank_mirror(msg) chsrc_log(xy_2strjoin(msg,purple(CliOpt_InEnglish?source->mirror->abbr:source->mirror->name)))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param source 可为NULL
|
* @param source 可为NULL
|
||||||
* @param last_word 5种选择:SetsrcType_Auto | SetsrcType_Reset | SetsrcType_SemiAuto | SetsrcType_Manual | SetsrcType_Untested
|
*
|
||||||
* @translation Done
|
* @param[g] ProgMode_ChgType
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
chsrc_conclude (Source_t *source, const char *last_word)
|
chsrc_conclude (Source_t *source)
|
||||||
{
|
{
|
||||||
split_between_source_changing_process;
|
split_between_source_changing_process;
|
||||||
|
|
||||||
if ((ProgMode_CMD_Reset == true) || xy_streql (SetsrcType_Reset, last_word))
|
// fprintf (stderr, "chsrc: now change type: %d\n", ProgMode_ChgType);
|
||||||
|
|
||||||
|
if (ProgMode_CMD_Reset || ChgType_Reset == ProgMode_ChgType)
|
||||||
{
|
{
|
||||||
// source_is_upstream (source)
|
// source_is_upstream (source)
|
||||||
char *msg = CliOpt_InEnglish ? "Has been reset to the upstream default source" : "已重置为上游默认源";
|
char *msg = CliOpt_InEnglish ? "Has been reset to the upstream default source" : "已重置为上游默认源";
|
||||||
chsrc_log (purple (msg));
|
chsrc_log (purple (msg));
|
||||||
}
|
}
|
||||||
else if (xy_streql (SetsrcType_Auto, last_word))
|
else if (ChgType_Auto == ProgMode_ChgType)
|
||||||
{
|
{
|
||||||
if (source)
|
if (source)
|
||||||
{
|
{
|
||||||
@ -914,7 +922,7 @@ chsrc_conclude (Source_t *source, const char *last_word)
|
|||||||
chsrc_log (msg);
|
chsrc_log (msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (xy_streql (SetsrcType_SemiAuto, last_word))
|
else if (ChgType_SemiAuto == ProgMode_ChgType)
|
||||||
{
|
{
|
||||||
if (source)
|
if (source)
|
||||||
{
|
{
|
||||||
@ -941,7 +949,7 @@ chsrc_conclude (Source_t *source, const char *last_word)
|
|||||||
char *msg = CliOpt_InEnglish ? MSG_EN_BETTER : MSG_CN_BETTER;
|
char *msg = CliOpt_InEnglish ? MSG_EN_BETTER : MSG_CN_BETTER;
|
||||||
chsrc_warn (msg);
|
chsrc_warn (msg);
|
||||||
}
|
}
|
||||||
else if (xy_streql (SetsrcType_Manual, last_word))
|
else if (ChgType_Manual == ProgMode_ChgType)
|
||||||
{
|
{
|
||||||
if (source)
|
if (source)
|
||||||
{
|
{
|
||||||
@ -966,7 +974,7 @@ chsrc_conclude (Source_t *source, const char *last_word)
|
|||||||
char *msg = CliOpt_InEnglish ? MSG_EN_BETTER : MSG_CN_BETTER;
|
char *msg = CliOpt_InEnglish ? MSG_EN_BETTER : MSG_CN_BETTER;
|
||||||
chsrc_warn (msg);
|
chsrc_warn (msg);
|
||||||
}
|
}
|
||||||
else if (xy_streql (SetsrcType_Untested, last_word))
|
else if (ChgType_Untested == ProgMode_ChgType)
|
||||||
{
|
{
|
||||||
if (source)
|
if (source)
|
||||||
{
|
{
|
||||||
@ -992,7 +1000,8 @@ chsrc_conclude (Source_t *source, const char *last_word)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
say (last_word);
|
fprintf (stderr, "chsrc: Wrong change type: %d\n", ProgMode_ChgType);
|
||||||
|
xy_unreach;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,8 +26,9 @@ pl_clojure_setsrc (char *option)
|
|||||||
chsrc_yield_source_and_confirm (pl_clojure);
|
chsrc_yield_source_and_confirm (pl_clojure);
|
||||||
|
|
||||||
chsrc_note2 ("抱歉,Clojure换源较复杂,您可手动查阅并换源:");
|
chsrc_note2 ("抱歉,Clojure换源较复杂,您可手动查阅并换源:");
|
||||||
puts (source.url);
|
say (source.url);
|
||||||
chsrc_conclude (&source, SetsrcType_Manual);
|
ProgMode_ChgType = ChgType_Manual;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target_s (pl_clojure);
|
def_target_s (pl_clojure);
|
||||||
|
@ -83,14 +83,16 @@ pl_dart_flutter_setsrc (char *option)
|
|||||||
chsrc_append_to_file (w, bashrc);
|
chsrc_append_to_file (w, bashrc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
|
||||||
|
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
pl_dart_flutter_resetsrc (char *option)
|
pl_dart_flutter_resetsrc (char *option)
|
||||||
{
|
{
|
||||||
pl_dart_flutter_setsrc (SetsrcType_Reset);
|
pl_dart_flutter_setsrc (option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,14 +79,16 @@ pl_dart_setsrc (char *option)
|
|||||||
chsrc_append_to_file (w, bashrc);
|
chsrc_append_to_file (w, bashrc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
|
||||||
|
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
pl_dart_resetsrc (char *option)
|
pl_dart_resetsrc (char *option)
|
||||||
{
|
{
|
||||||
pl_dart_setsrc (SetsrcType_Reset);
|
pl_dart_setsrc (option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,7 +76,8 @@ pl_go_setsrc (char *option)
|
|||||||
|
|
||||||
cmd = xy_strjoin (3, "go env -w GOPROXY=", source.url, ",direct");
|
cmd = xy_strjoin (3, "go env -w GOPROXY=", source.url, ",direct");
|
||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,8 +61,9 @@ pl_haskell_setsrc (char *option)
|
|||||||
" ignore-expiry: no");
|
" ignore-expiry: no");
|
||||||
|
|
||||||
chsrc_note2 (xy_strjoin (3, "请向 ", config, " 中手动添加:"));
|
chsrc_note2 (xy_strjoin (3, "请向 ", config, " 中手动添加:"));
|
||||||
puts (file);
|
say (file);
|
||||||
chsrc_conclude (&source, SetsrcType_Manual);
|
ProgMode_ChgType = ChgType_Manual;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target_s (pl_haskell);
|
def_target_s (pl_haskell);
|
||||||
|
@ -93,9 +93,10 @@ pl_java_setsrc (char *option)
|
|||||||
"}");
|
"}");
|
||||||
|
|
||||||
chsrc_note2 ("请在您的 build.gradle 中添加:");
|
chsrc_note2 ("请在您的 build.gradle 中添加:");
|
||||||
puts (file);
|
say (file);
|
||||||
}
|
}
|
||||||
chsrc_conclude (&source, SetsrcType_Manual);
|
ProgMode_ChgType = ChgType_Manual;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target(pl_java);
|
def_target(pl_java);
|
||||||
|
@ -49,7 +49,8 @@ pl_julia_setsrc (char *option)
|
|||||||
|
|
||||||
chsrc_append_to_file (w, PL_Julia_Config);
|
chsrc_append_to_file (w, PL_Julia_Config);
|
||||||
|
|
||||||
chsrc_conclude (&source, SetsrcType_Untested);
|
ProgMode_ChgType = ChgType_Untested;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,9 +52,10 @@ pl_lua_setsrc (char *option)
|
|||||||
"server = \"", source.url, "\"");
|
"server = \"", source.url, "\"");
|
||||||
|
|
||||||
chsrc_note2 ("请手动修改 ~/.luarocks/upload_config.lua 文件 (用于上传):");
|
chsrc_note2 ("请手动修改 ~/.luarocks/upload_config.lua 文件 (用于上传):");
|
||||||
puts (upload_config);
|
say (upload_config);
|
||||||
|
|
||||||
chsrc_conclude (&source, SetsrcType_Manual);
|
ProgMode_ChgType = ChgType_Manual;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target(pl_lua);
|
def_target(pl_lua);
|
||||||
|
@ -27,8 +27,6 @@ pl_nodejs_bun_getsrc (char *option)
|
|||||||
void
|
void
|
||||||
pl_nodejs_bun_setsrc (char *option)
|
pl_nodejs_bun_setsrc (char *option)
|
||||||
{
|
{
|
||||||
char *setsrc_type = xy_streql (option, SetsrcType_Reset) ? SetsrcType_Reset : SetsrcType_Manual;
|
|
||||||
|
|
||||||
// 用的是 npm Registry 的源
|
// 用的是 npm Registry 的源
|
||||||
chsrc_yield_source (pl_nodejs);
|
chsrc_yield_source (pl_nodejs);
|
||||||
|
|
||||||
@ -44,8 +42,9 @@ pl_nodejs_bun_setsrc (char *option)
|
|||||||
chsrc_note2 (xy_strjoin (3, "请您手动写入以下内容到 ", xy_normalize_path ("~/.bunfig.toml"), " 文件中"));
|
chsrc_note2 (xy_strjoin (3, "请您手动写入以下内容到 ", xy_normalize_path ("~/.bunfig.toml"), " 文件中"));
|
||||||
}
|
}
|
||||||
|
|
||||||
puts (file);
|
say (file);
|
||||||
chsrc_conclude (&source, setsrc_type);
|
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -55,7 +54,7 @@ pl_nodejs_bun_setsrc (char *option)
|
|||||||
void
|
void
|
||||||
pl_nodejs_bun_resetsrc (char *option)
|
pl_nodejs_bun_resetsrc (char *option)
|
||||||
{
|
{
|
||||||
pl_nodejs_bun_setsrc (SetsrcType_Reset);
|
pl_nodejs_bun_setsrc (option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,7 +94,8 @@ pl_nodejs_setsrc (char *option)
|
|||||||
pl_nodejs_pnpm_setsrc (option);
|
pl_nodejs_pnpm_setsrc (option);
|
||||||
}
|
}
|
||||||
|
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -104,7 +105,7 @@ pl_nodejs_setsrc (char *option)
|
|||||||
void
|
void
|
||||||
pl_nodejs_resetsrc (char *option)
|
pl_nodejs_resetsrc (char *option)
|
||||||
{
|
{
|
||||||
pl_nodejs_setsrc (SetsrcType_Reset);
|
pl_nodejs_setsrc (option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,7 +72,10 @@ pl_nodejs_yarn_setsrc (char *option)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ProgMode_Target_Group!=true)
|
if (ProgMode_Target_Group!=true)
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
{
|
||||||
|
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -82,7 +85,7 @@ pl_nodejs_yarn_setsrc (char *option)
|
|||||||
void
|
void
|
||||||
pl_nodejs_yarn_resetsrc (char *option)
|
pl_nodejs_yarn_resetsrc (char *option)
|
||||||
{
|
{
|
||||||
pl_nodejs_yarn_setsrc (SetsrcType_Reset);
|
pl_nodejs_yarn_setsrc (option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +41,10 @@ pl_nodejs_npm_setsrc (char *option)
|
|||||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||||
|
|
||||||
if (ProgMode_Target_Group!=true)
|
if (ProgMode_Target_Group!=true)
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
{
|
||||||
|
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -51,7 +54,7 @@ pl_nodejs_npm_setsrc (char *option)
|
|||||||
void
|
void
|
||||||
pl_nodejs_npm_resetsrc (char *option)
|
pl_nodejs_npm_resetsrc (char *option)
|
||||||
{
|
{
|
||||||
pl_nodejs_npm_setsrc (SetsrcType_Reset);
|
pl_nodejs_npm_setsrc (option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,7 +42,8 @@ pl_nodejs_nvm_setsrc (char *option)
|
|||||||
if (xy_file_exist (zshrc))
|
if (xy_file_exist (zshrc))
|
||||||
chsrc_append_to_file (w, zshrc);
|
chsrc_append_to_file (w, zshrc);
|
||||||
|
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ pl_nodejs_nvm_setsrc (char *option)
|
|||||||
void
|
void
|
||||||
pl_nodejs_nvm_resetsrc (char *option)
|
pl_nodejs_nvm_resetsrc (char *option)
|
||||||
{
|
{
|
||||||
// pl_nodejs_nvm_setsrc (SetsrcType_Reset);
|
// pl_nodejs_nvm_setsrc (ChgType_Reset);
|
||||||
chsrc_error ("暂不支持对 nvm 重置");
|
chsrc_error ("暂不支持对 nvm 重置");
|
||||||
exit (Exit_Unsupported);
|
exit (Exit_Unsupported);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,10 @@ pl_nodejs_pnpm_setsrc (char *option)
|
|||||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||||
|
|
||||||
if (ProgMode_Target_Group!=true)
|
if (ProgMode_Target_Group!=true)
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
{
|
||||||
|
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -52,7 +55,7 @@ pl_nodejs_pnpm_setsrc (char *option)
|
|||||||
void
|
void
|
||||||
pl_nodejs_pnpm_resetsrc (char *option)
|
pl_nodejs_pnpm_resetsrc (char *option)
|
||||||
{
|
{
|
||||||
pl_nodejs_pnpm_setsrc (SetsrcType_Reset);
|
pl_nodejs_pnpm_setsrc (option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,9 +48,10 @@ pl_ocaml_setsrc(char *option)
|
|||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
|
|
||||||
chsrc_note2 ("如果是首次使用 opam ,请使用以下命令进行初始化");
|
chsrc_note2 ("如果是首次使用 opam ,请使用以下命令进行初始化");
|
||||||
puts (xy_2strjoin ("opam init default ", source.url));
|
say (xy_2strjoin ("opam init default ", source.url));
|
||||||
|
|
||||||
chsrc_conclude (&source, SetsrcType_SemiAuto);
|
ProgMode_ChgType = ChgType_SemiAuto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target(pl_ocaml);
|
def_target(pl_ocaml);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||||
* Contributors : Nil Null <nil@null.org>
|
* Contributors : Nil Null <nil@null.org>
|
||||||
* Created On : <2023-08-30>
|
* Created On : <2023-08-30>
|
||||||
* Last Modified : <2024-09-14>
|
* Last Modified : <2024-11-22>
|
||||||
* ------------------------------------------------------------*/
|
* ------------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,7 +39,7 @@ pl_php_getsrc (char *option)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHP 换源,参考:https://developer.aliyun.com/composer
|
* @consult https://developer.aliyun.com/composer
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pl_php_setsrc (char *option)
|
pl_php_setsrc (char *option)
|
||||||
@ -57,7 +57,8 @@ pl_php_setsrc (char *option)
|
|||||||
char *cmd = xy_strjoin (4, "composer config", where, "repo.packagist composer ", source.url);
|
char *cmd = xy_strjoin (4, "composer config", where, "repo.packagist composer ", source.url);
|
||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
|
|
||||||
chsrc_conclude (&source, SetsrcType_SemiAuto);
|
ProgMode_ChgType = ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,8 +54,10 @@ pl_perl_setsrc (char *option)
|
|||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
|
|
||||||
chsrc_note2 ("请您使用 perl -v 以及 cpan -v,若 Perl >= v5.36 或 CPAN >= 2.29,请额外手动调用下面的命令");
|
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()\"");
|
say ("perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('pushy_https', 0);; CPAN::HandleConfig->commit()\"");
|
||||||
chsrc_conclude (&source, SetsrcType_SemiAuto);
|
|
||||||
|
ProgMode_ChgType = ChgType_SemiAuto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target(pl_perl);
|
def_target(pl_perl);
|
||||||
|
@ -43,7 +43,10 @@ pl_python_pdm_setsrc (char *option)
|
|||||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||||
|
|
||||||
if (ProgMode_Target_Group!=true)
|
if (ProgMode_Target_Group!=true)
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
{
|
||||||
|
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -53,7 +56,7 @@ pl_python_pdm_setsrc (char *option)
|
|||||||
void
|
void
|
||||||
pl_python_pdm_resetsrc (char *option)
|
pl_python_pdm_resetsrc (char *option)
|
||||||
{
|
{
|
||||||
pl_python_pdm_setsrc (SetsrcType_Reset);
|
pl_python_pdm_setsrc (option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +41,10 @@ pl_python_poetry_setsrc (char *option)
|
|||||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||||
|
|
||||||
if (ProgMode_Target_Group!=true)
|
if (ProgMode_Target_Group!=true)
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
{
|
||||||
|
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -51,7 +54,7 @@ pl_python_poetry_setsrc (char *option)
|
|||||||
void
|
void
|
||||||
pl_python_poetry_resetsrc (char *option)
|
pl_python_poetry_resetsrc (char *option)
|
||||||
{
|
{
|
||||||
pl_python_poetry_setsrc (SetsrcType_Reset);
|
pl_python_poetry_setsrc (option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,8 +45,6 @@ pl_python_setsrc (char *option)
|
|||||||
chsrc_note2 (msg);
|
chsrc_note2 (msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *setsrc_type = xy_streql (option, SetsrcType_Reset) ? SetsrcType_Reset : SetsrcType_Auto;
|
|
||||||
|
|
||||||
bool pdm_exist = false,
|
bool pdm_exist = false,
|
||||||
poetry_exist = false;
|
poetry_exist = false;
|
||||||
|
|
||||||
@ -71,13 +69,14 @@ pl_python_setsrc (char *option)
|
|||||||
pl_python_pdm_setsrc (option);
|
pl_python_pdm_setsrc (option);
|
||||||
}
|
}
|
||||||
|
|
||||||
chsrc_conclude (&source, setsrc_type);
|
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pl_python_resetsrc (char *option)
|
pl_python_resetsrc (char *option)
|
||||||
{
|
{
|
||||||
pl_python_setsrc (SetsrcType_Reset);
|
pl_python_setsrc (option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,7 +53,10 @@ pl_python_pip_setsrc (char *option)
|
|||||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||||
|
|
||||||
if (ProgMode_Target_Group!=true)
|
if (ProgMode_Target_Group!=true)
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
{
|
||||||
|
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -63,7 +66,7 @@ pl_python_pip_setsrc (char *option)
|
|||||||
void
|
void
|
||||||
pl_python_pip_resetsrc (char *option)
|
pl_python_pip_resetsrc (char *option)
|
||||||
{
|
{
|
||||||
pl_python_pip_setsrc (SetsrcType_Reset);
|
pl_python_pip_setsrc (option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,7 +71,8 @@ pl_r_setsrc (char *option)
|
|||||||
|
|
||||||
chsrc_append_to_file (w, config);
|
chsrc_append_to_file (w, config);
|
||||||
|
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
ProgMode_ChgType = ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target(pl_r);
|
def_target(pl_r);
|
||||||
|
@ -62,8 +62,6 @@ pl_ruby_remove_gem_source (const char *source)
|
|||||||
void
|
void
|
||||||
pl_ruby_setsrc (char *option)
|
pl_ruby_setsrc (char *option)
|
||||||
{
|
{
|
||||||
char *setsrc_type = xy_streql (option, SetsrcType_Reset) ? SetsrcType_Reset : SetsrcType_Auto;
|
|
||||||
|
|
||||||
chsrc_ensure_program ("gem");
|
chsrc_ensure_program ("gem");
|
||||||
|
|
||||||
chsrc_yield_source_and_confirm (pl_ruby);
|
chsrc_yield_source_and_confirm (pl_ruby);
|
||||||
@ -87,13 +85,14 @@ pl_ruby_setsrc (char *option)
|
|||||||
cmd = xy_strjoin (4, "bundle config", where, "'mirror.https://rubygems.org' ", source.url);
|
cmd = xy_strjoin (4, "bundle config", where, "'mirror.https://rubygems.org' ", source.url);
|
||||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||||
|
|
||||||
chsrc_conclude (&source, setsrc_type);
|
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pl_ruby_resetsrc (char *option)
|
pl_ruby_resetsrc (char *option)
|
||||||
{
|
{
|
||||||
pl_ruby_setsrc (SetsrcType_Reset);
|
pl_ruby_setsrc (option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,8 +55,9 @@ pl_rust_cargo_setsrc (char *option)
|
|||||||
"registry = \"sparse+", source.url, "\"");
|
"registry = \"sparse+", source.url, "\"");
|
||||||
|
|
||||||
chsrc_note2 (xy_strjoin (3, "请您手动写入以下内容到 ", xy_normalize_path ("~/.cargo/config.toml"), " 文件中:"));
|
chsrc_note2 (xy_strjoin (3, "请您手动写入以下内容到 ", xy_normalize_path ("~/.cargo/config.toml"), " 文件中:"));
|
||||||
puts (file);
|
say (file);
|
||||||
chsrc_conclude (&source, SetsrcType_Manual);
|
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -66,7 +67,7 @@ pl_rust_cargo_setsrc (char *option)
|
|||||||
void
|
void
|
||||||
pl_rust_cargo_resetsrc (char *option)
|
pl_rust_cargo_resetsrc (char *option)
|
||||||
{
|
{
|
||||||
pl_rust_cargo_setsrc (SetsrcType_Reset);
|
pl_rust_cargo_setsrc (option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,8 +45,6 @@ pl_rust_rustup_getsrc (char *option)
|
|||||||
void
|
void
|
||||||
pl_rust_rustup_setsrc (char *option)
|
pl_rust_rustup_setsrc (char *option)
|
||||||
{
|
{
|
||||||
char *setsrc_type = xy_streql (option, SetsrcType_Reset) ? SetsrcType_Reset : SetsrcType_Auto;
|
|
||||||
|
|
||||||
chsrc_yield_source_and_confirm (pl_rust_rustup);
|
chsrc_yield_source_and_confirm (pl_rust_rustup);
|
||||||
|
|
||||||
char *w1 = xy_strjoin (3, "export RUSTUP_DIST_SERVER=\"", source.url, "\"\n");
|
char *w1 = xy_strjoin (3, "export RUSTUP_DIST_SERVER=\"", source.url, "\"\n");
|
||||||
@ -80,7 +78,8 @@ pl_rust_rustup_setsrc (char *option)
|
|||||||
chsrc_append_to_file (w, fishrc);
|
chsrc_append_to_file (w, fishrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
chsrc_conclude (&source, setsrc_type);
|
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
chsrc_note2 ("请您重启终端使rustup环境变量生效");
|
chsrc_note2 ("请您重启终端使rustup环境变量生效");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +90,7 @@ pl_rust_rustup_setsrc (char *option)
|
|||||||
void
|
void
|
||||||
pl_rust_rustup_resetsrc (char *option)
|
pl_rust_rustup_resetsrc (char *option)
|
||||||
{
|
{
|
||||||
pl_rust_rustup_setsrc (SetsrcType_Reset);
|
pl_rust_rustup_setsrc (option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,7 +57,9 @@ os_armbian_setsrc (char *option)
|
|||||||
|
|
||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
|
||||||
|
ProgMode_ChgType = ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,7 +66,9 @@ os_debian_setsrc_for_deb822 (char *option)
|
|||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
|
|
||||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
|
||||||
|
ProgMode_ChgType = ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -105,7 +107,9 @@ os_debian_setsrc (char *option)
|
|||||||
|
|
||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
|
||||||
|
ProgMode_ChgType = ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,7 +53,9 @@ os_kali_setsrc (char *option)
|
|||||||
|
|
||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||||
chsrc_conclude (&source, SetsrcType_Untested);
|
|
||||||
|
ProgMode_ChgType = ChgType_Untested;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target(os_kali);
|
def_target(os_kali);
|
||||||
|
@ -42,7 +42,9 @@ os_linuxlite_setsrc (char *option)
|
|||||||
char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/.*/?@", source.url, "@g' " 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_run ("apt update", RunOpt_No_Last_New_Line);
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
|
||||||
|
ProgMode_ChgType = ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target(os_linuxlite);
|
def_target(os_linuxlite);
|
||||||
|
@ -54,7 +54,9 @@ os_linuxmint_setsrc (char *option)
|
|||||||
|
|
||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
|
||||||
|
ProgMode_ChgType = ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
chsrc_warn2 ("完成后请不要再使用 mintsources(自带的图形化软件源设置工具)进行任何操作,因为在操作后,无论是否有按“确定”,mintsources 均会覆写我们刚才换源的内容");
|
chsrc_warn2 ("完成后请不要再使用 mintsources(自带的图形化软件源设置工具)进行任何操作,因为在操作后,无论是否有按“确定”,mintsources 均会覆写我们刚才换源的内容");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,9 @@ os_ros_setsrc (char *option)
|
|||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
|
|
||||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||||
chsrc_conclude (&source, SetsrcType_Untested);
|
|
||||||
|
ProgMode_ChgType = ChgType_Untested;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target_s(os_ros);
|
def_target_s(os_ros);
|
||||||
|
@ -44,7 +44,9 @@ os_raspberrypi_setsrc (char *option)
|
|||||||
|
|
||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||||
chsrc_conclude (&source, SetsrcType_Untested);
|
|
||||||
|
ProgMode_ChgType = ChgType_Untested;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target(os_raspberrypi);
|
def_target(os_raspberrypi);
|
||||||
|
@ -46,7 +46,9 @@ os_trisquel_setsrc (char *option)
|
|||||||
|
|
||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||||
chsrc_conclude (&source, SetsrcType_Untested);
|
|
||||||
|
ProgMode_ChgType = ChgType_Untested;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target(os_trisquel);
|
def_target(os_trisquel);
|
||||||
|
@ -75,7 +75,9 @@ os_ubuntu_setsrc_for_deb822 (char *option)
|
|||||||
|
|
||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
|
||||||
|
ProgMode_ChgType = ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -118,7 +120,9 @@ os_ubuntu_setsrc (char *option)
|
|||||||
|
|
||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
|
||||||
|
ProgMode_ChgType = ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +51,9 @@ os_deepin_setsrc (char *option)
|
|||||||
|
|
||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||||
chsrc_conclude (&source, SetsrcType_Untested);
|
|
||||||
|
ProgMode_ChgType = ChgType_Untested;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target(os_deepin);
|
def_target(os_deepin);
|
||||||
|
@ -39,7 +39,9 @@ os_openkylin_setsrc (char *option)
|
|||||||
char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*/openkylin/?@", source.url, "@g'" 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 (cmd, RunOpt_Default);
|
||||||
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
chsrc_run ("apt update", RunOpt_No_Last_New_Line);
|
||||||
chsrc_conclude (&source, SetsrcType_Untested);
|
|
||||||
|
ProgMode_ChgType = ChgType_Untested;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target(os_openkylin);
|
def_target(os_openkylin);
|
||||||
|
@ -48,7 +48,9 @@ os_alpine_setsrc (char *option)
|
|||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
|
|
||||||
chsrc_run ("apk update", RunOpt_No_Last_New_Line);
|
chsrc_run ("apk update", RunOpt_No_Last_New_Line);
|
||||||
chsrc_conclude (&source, SetsrcType_Untested);
|
|
||||||
|
ProgMode_ChgType = ChgType_Untested;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target(os_alpine);
|
def_target(os_alpine);
|
||||||
|
@ -128,7 +128,8 @@ os_freebsd_setsrc (char *option)
|
|||||||
chsrc_overwrite_file (update, "/etc/freebsd-update.conf");
|
chsrc_overwrite_file (update, "/etc/freebsd-update.conf");
|
||||||
*/
|
*/
|
||||||
|
|
||||||
chsrc_conclude (&source, SetsrcType_SemiAuto);
|
ProgMode_ChgType = ChgType_SemiAuto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target_s(os_freebsd);
|
def_target_s(os_freebsd);
|
||||||
|
@ -58,7 +58,8 @@ os_netbsd_setsrc (char *option)
|
|||||||
char *url = xy_strjoin (5, source.url, arch, "/", version, "/All");
|
char *url = xy_strjoin (5, source.url, arch, "/", version, "/All");
|
||||||
chsrc_overwrite_file (url, "/usr/pkg/etc/pkgin/repositories.conf");
|
chsrc_overwrite_file (url, "/usr/pkg/etc/pkgin/repositories.conf");
|
||||||
|
|
||||||
chsrc_conclude (&source, SetsrcType_Untested);
|
ProgMode_ChgType = ChgType_Untested;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target(os_netbsd);
|
def_target(os_netbsd);
|
||||||
|
@ -47,7 +47,8 @@ os_openbsd_setsrc (char *option)
|
|||||||
chsrc_backup ("/etc/installurl");
|
chsrc_backup ("/etc/installurl");
|
||||||
chsrc_overwrite_file (source.url, "/etc/installurl");
|
chsrc_overwrite_file (source.url, "/etc/installurl");
|
||||||
|
|
||||||
chsrc_conclude (&source, SetsrcType_Untested);
|
ProgMode_ChgType = ChgType_Untested;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target(os_openbsd);
|
def_target(os_openbsd);
|
||||||
|
@ -45,7 +45,9 @@ os_gentoo_setsrc (char *option)
|
|||||||
char *w = xy_strjoin (3, "GENTOO_MIRRORS=\"https://", source.url, "gentoo\"\n");
|
char *w = xy_strjoin (3, "GENTOO_MIRRORS=\"https://", source.url, "gentoo\"\n");
|
||||||
|
|
||||||
chsrc_append_to_file (w, "/etc/portage/make.conf");
|
chsrc_append_to_file (w, "/etc/portage/make.conf");
|
||||||
chsrc_conclude (&source, SetsrcType_Untested);
|
|
||||||
|
ProgMode_ChgType = ChgType_Untested;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target_s(os_gentoo);
|
def_target_s(os_gentoo);
|
||||||
|
@ -50,7 +50,9 @@ os_openwrt_setsrc (char *option)
|
|||||||
char *cmd = xy_strjoin (3, "sed -E -i 's@https?://.*downloads.openwrt.org@", source.url, "@g' " 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_run ("apt update", RunOpt_No_Last_New_Line);
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
|
||||||
|
ProgMode_ChgType = ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,7 +32,9 @@ os_solus_setsrc (char *option)
|
|||||||
|
|
||||||
char *cmd = xy_2strjoin ("eopkg add-repo Solus ", source.url);
|
char *cmd = xy_2strjoin ("eopkg add-repo Solus ", source.url);
|
||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
|
||||||
|
ProgMode_ChgType = ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target_s(os_solus);
|
def_target_s(os_solus);
|
||||||
|
@ -52,7 +52,8 @@ os_void_setsrc (char *option)
|
|||||||
|
|
||||||
chsrc_note2 ("若报错可尝试使用以下命令:");
|
chsrc_note2 ("若报错可尝试使用以下命令:");
|
||||||
say (cmd);
|
say (cmd);
|
||||||
chsrc_conclude (&source, SetsrcType_Untested);
|
ProgMode_ChgType = ChgType_Untested;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target(os_void);
|
def_target(os_void);
|
||||||
|
@ -36,7 +36,9 @@ os_almalinux_setsrc (char *option)
|
|||||||
|
|
||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
|
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
|
||||||
|
ProgMode_ChgType = ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target_s(os_almalinux);
|
def_target_s(os_almalinux);
|
||||||
|
@ -36,7 +36,9 @@ os_anolis_setsrc (char *option)
|
|||||||
|
|
||||||
chsrc_run ("dnf makecache", RunOpt_Default);
|
chsrc_run ("dnf makecache", RunOpt_Default);
|
||||||
chsrc_run ("dnf update", RunOpt_No_Last_New_Line);
|
chsrc_run ("dnf update", RunOpt_No_Last_New_Line);
|
||||||
chsrc_conclude (&source, SetsrcType_Untested);
|
|
||||||
|
ProgMode_ChgType = ChgType_Untested;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target_s(os_anolis);
|
def_target_s(os_anolis);
|
||||||
|
@ -37,8 +37,6 @@ def_sources_n(os_fedora);
|
|||||||
void
|
void
|
||||||
os_fedora_setsrc (char *option)
|
os_fedora_setsrc (char *option)
|
||||||
{
|
{
|
||||||
char *setsrc_type = xy_streql (option, SetsrcType_Reset) ? SetsrcType_Reset : SetsrcType_Auto;
|
|
||||||
|
|
||||||
chsrc_ensure_root ();
|
chsrc_ensure_root ();
|
||||||
|
|
||||||
chsrc_yield_source_and_confirm (os_fedora);
|
chsrc_yield_source_and_confirm (os_fedora);
|
||||||
@ -74,14 +72,15 @@ os_fedora_setsrc (char *option)
|
|||||||
|
|
||||||
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
|
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
|
||||||
|
|
||||||
chsrc_conclude (&source, setsrc_type);
|
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
os_fedora_resetsrc (char *option)
|
os_fedora_resetsrc (char *option)
|
||||||
{
|
{
|
||||||
os_fedora_setsrc (SetsrcType_Reset);
|
os_fedora_setsrc (option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,7 +67,9 @@ os_rockylinux_setsrc (char *option)
|
|||||||
|
|
||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
|
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
|
||||||
|
ProgMode_ChgType = ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,7 +44,9 @@ os_openeuler_setsrc (char *option)
|
|||||||
chsrc_overwrite_file (towrite, OS_openEuler_SourceList);
|
chsrc_overwrite_file (towrite, OS_openEuler_SourceList);
|
||||||
|
|
||||||
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
|
chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line);
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
|
||||||
|
ProgMode_ChgType = ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target_s(os_openeuler);
|
def_target_s(os_openeuler);
|
||||||
|
@ -75,7 +75,9 @@ os_opensuse_setsrc (char *option)
|
|||||||
|
|
||||||
chsrc_run (cmd5, RunOpt_Default);
|
chsrc_run (cmd5, RunOpt_Default);
|
||||||
chsrc_run (cmd6, RunOpt_Default);
|
chsrc_run (cmd6, RunOpt_Default);
|
||||||
chsrc_conclude (&source, SetsrcType_Untested);
|
|
||||||
|
ProgMode_ChgType = ChgType_Untested;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target_s(os_opensuse);
|
def_target_s(os_opensuse);
|
||||||
|
@ -91,7 +91,8 @@ os_arch_setsrc (char *option)
|
|||||||
{
|
{
|
||||||
chsrc_run ("pacman -Syy", RunOpt_No_Last_New_Line);
|
chsrc_run ("pacman -Syy", RunOpt_No_Last_New_Line);
|
||||||
}
|
}
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
ProgMode_ChgType = ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -124,7 +125,9 @@ os_archlinuxcn_setsrc (char *option)
|
|||||||
chsrc_run ("pacman -Sy archlinuxcn-keyring", RunOpt_Default);
|
chsrc_run ("pacman -Sy archlinuxcn-keyring", RunOpt_Default);
|
||||||
|
|
||||||
chsrc_run ("pacman -Syy", RunOpt_No_Last_New_Line);
|
chsrc_run ("pacman -Syy", RunOpt_No_Last_New_Line);
|
||||||
chsrc_conclude (&source, SetsrcType_Untested);
|
|
||||||
|
ProgMode_ChgType = ChgType_Untested;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
#undef OS_Pacman_MirrorList
|
#undef OS_Pacman_MirrorList
|
||||||
|
|
||||||
|
@ -47,7 +47,9 @@ os_msys2_setsrc (char *option)
|
|||||||
"#g\" /etc/pacman.d/mirrorlist* ");
|
"#g\" /etc/pacman.d/mirrorlist* ");
|
||||||
|
|
||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
chsrc_conclude (&source, SetsrcType_Untested);
|
|
||||||
|
ProgMode_ChgType = ChgType_Untested;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target_s(os_msys2);
|
def_target_s(os_msys2);
|
||||||
|
@ -20,7 +20,8 @@ os_manjaro_setsrc (char *option)
|
|||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
|
|
||||||
chsrc_run ("pacman -Syy", RunOpt_No_Last_New_Line);
|
chsrc_run ("pacman -Syy", RunOpt_No_Last_New_Line);
|
||||||
chsrc_conclude (NULL, SetsrcType_Auto);
|
ProgMode_ChgType = ChgType_Auto;
|
||||||
|
chsrc_conclude (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Target_t os_manjaro_target = {NULL, os_manjaro_setsrc, NULL, NULL, 0};
|
Target_t os_manjaro_target = {NULL, os_manjaro_setsrc, NULL, NULL, 0};
|
||||||
|
@ -77,13 +77,14 @@ void
|
|||||||
void
|
void
|
||||||
<category>_<target>_setsrc (char *option)
|
<category>_<target>_setsrc (char *option)
|
||||||
{
|
{
|
||||||
// 下面这行是必须的,注入source变量
|
/* 下面这行是必须的,注入source变量 */
|
||||||
chsrc_yield_source_and_confirm (<category>_<target>);
|
chsrc_yield_source_and_confirm (<category>_<target>);
|
||||||
|
|
||||||
/* 具体的换源步骤,如调用第三方命令... */
|
/* 具体的换源步骤,如调用第三方命令... */
|
||||||
|
|
||||||
// 最后总结输出
|
/* 最后总结输出 */
|
||||||
chsrc_conclude (&source, setsrc_type);
|
ProgMode_ChgType = ChgType_;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,7 +67,9 @@ wr_anaconda_setsrc (char *option)
|
|||||||
puts (file);
|
puts (file);
|
||||||
|
|
||||||
chsrc_note2 ("然后运行 conda clean -i 清除索引缓存,保证用的是镜像站提供的索引");
|
chsrc_note2 ("然后运行 conda clean -i 清除索引缓存,保证用的是镜像站提供的索引");
|
||||||
chsrc_conclude (&source, SetsrcType_SemiAuto);
|
|
||||||
|
ProgMode_ChgType = ChgType_SemiAuto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target_s (wr_anaconda);
|
def_target_s (wr_anaconda);
|
||||||
|
@ -38,7 +38,8 @@ wr_cocoapods_setsrc (char *option)
|
|||||||
char *source_str = xy_strjoin (3, "source '", source.url, "'");
|
char *source_str = xy_strjoin (3, "source '", source.url, "'");
|
||||||
say (source_str);
|
say (source_str);
|
||||||
|
|
||||||
chsrc_conclude (&source, SetsrcType_Manual);
|
ProgMode_ChgType = ChgType_Manual;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target_s (wr_cocoapods);
|
def_target_s (wr_cocoapods);
|
||||||
|
@ -151,7 +151,9 @@ wr_dockerhub_setsrc (char *option)
|
|||||||
chsrc_note2 ("选择“Docker Engine”选项卡,在该选项卡中找到“registry-mirrors”一栏,添加镜像地址:");
|
chsrc_note2 ("选择“Docker Engine”选项卡,在该选项卡中找到“registry-mirrors”一栏,添加镜像地址:");
|
||||||
puts (source.url);
|
puts (source.url);
|
||||||
}
|
}
|
||||||
chsrc_conclude (&source, SetsrcType_Manual);
|
|
||||||
|
ProgMode_ChgType = ChgType_Manual;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,9 +36,10 @@ wr_emacs_setsrc (char *option)
|
|||||||
chsrc_yield_source_and_confirm (wr_emacs);
|
chsrc_yield_source_and_confirm (wr_emacs);
|
||||||
|
|
||||||
chsrc_note2 ("Emacs换源涉及Elisp,需要手动查阅并换源:");
|
chsrc_note2 ("Emacs换源涉及Elisp,需要手动查阅并换源:");
|
||||||
puts (source.url);
|
say (source.url);
|
||||||
|
|
||||||
chsrc_conclude (&source, SetsrcType_Manual);
|
ProgMode_ChgType = ChgType_Manual;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target_s (wr_emacs);
|
def_target_s (wr_emacs);
|
||||||
|
@ -37,7 +37,8 @@ wr_flathub_setsrc (char *option)
|
|||||||
char *cmd = xy_2strjoin ("flatpak remote-modify flathub --url=", source.url);
|
char *cmd = xy_2strjoin ("flatpak remote-modify flathub --url=", source.url);
|
||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
|
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
ProgMode_ChgType = ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target_s (wr_flathub);
|
def_target_s (wr_flathub);
|
||||||
|
@ -32,8 +32,10 @@ wr_guix_setsrc (char *option)
|
|||||||
" (url \"", source.url, "\")))");
|
" (url \"", source.url, "\")))");
|
||||||
|
|
||||||
chsrc_note2 ("为防止扰乱配置文件,请您手动写入以下内容到 ~/.config/guix/channels.scm 文件中");
|
chsrc_note2 ("为防止扰乱配置文件,请您手动写入以下内容到 ~/.config/guix/channels.scm 文件中");
|
||||||
puts (file);
|
say (file);
|
||||||
chsrc_conclude (&source, SetsrcType_Manual);
|
|
||||||
|
ProgMode_ChgType = ChgType_Manual;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target_s (wr_guix);
|
def_target_s (wr_guix);
|
||||||
|
@ -81,7 +81,8 @@ wr_homebrew_setsrc (char *option)
|
|||||||
chsrc_append_to_file (w, fishrc);
|
chsrc_append_to_file (w, fishrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
chsrc_conclude(&source, SetsrcType_Auto);
|
ProgMode_ChgType = ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
chsrc_note2 ("请您重启终端使Homebrew环境变量生效");
|
chsrc_note2 ("请您重启终端使Homebrew环境变量生效");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,8 @@ wr_nix_setsrc (char *option)
|
|||||||
chsrc_note2 ("若您使用的是NixOS,请额外添加下述内容至 configuration.nix 中");
|
chsrc_note2 ("若您使用的是NixOS,请额外添加下述内容至 configuration.nix 中");
|
||||||
say (cmd);
|
say (cmd);
|
||||||
|
|
||||||
chsrc_conclude (&source, SetsrcType_SemiAuto);
|
ProgMode_ChgType = ChgType_SemiAuto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target_s (wr_nix);
|
def_target_s (wr_nix);
|
||||||
|
@ -78,7 +78,8 @@ wr_tex_setsrc (char *option)
|
|||||||
chsrc_run (cmd, RunOpt_Default);
|
chsrc_run (cmd, RunOpt_Default);
|
||||||
}
|
}
|
||||||
|
|
||||||
chsrc_conclude (&source, SetsrcType_Untested);
|
ProgMode_ChgType = ChgType_Untested;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
def_target(wr_tex);
|
def_target(wr_tex);
|
||||||
|
@ -34,14 +34,17 @@ wr_winget_setsrc (char *option)
|
|||||||
chsrc_run ("winget source remove winget", RunOpt_Default);
|
chsrc_run ("winget source remove winget", RunOpt_Default);
|
||||||
chsrc_run (xy_2strjoin ("winget source add winget ", source.url), RunOpt_Default);
|
chsrc_run (xy_2strjoin ("winget source add winget ", source.url), RunOpt_Default);
|
||||||
|
|
||||||
chsrc_conclude (&source, SetsrcType_Auto);
|
ProgMode_ChgType = ChgType_Auto;
|
||||||
|
chsrc_conclude (&source);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wr_winget_resetsrc (char *option)
|
wr_winget_resetsrc (char *option)
|
||||||
{
|
{
|
||||||
chsrc_run ("winget source reset winget", RunOpt_Default);
|
chsrc_run ("winget source reset winget", RunOpt_Default);
|
||||||
chsrc_conclude (NULL, SetsrcType_Auto);
|
|
||||||
|
ProgMode_ChgType = ChgType_Auto;
|
||||||
|
chsrc_conclude (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user