Fix envar for homebrew

This commit is contained in:
Aoran Zeng 2023-09-17 14:06:21 +08:00
parent 3ed500bf83
commit e6f8d17ad0

17
chsrc.c
View File

@ -1491,6 +1491,13 @@ wr_brew_getsrc(char* option)
system(cmd);
}
/**
* : https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/
*
* brew 4.0.0 (2023 2 16)
* HOMEBREW_INSTALL_FROM_API homebrew-core HOMEBREW_CORE_GIT_REMOTE
*
*/
void
wr_brew_setsrc(char* option)
{
@ -1504,10 +1511,10 @@ wr_brew_setsrc(char* option)
source_info source = wr_brew_sources[index];
chsrc_say_selection (&source);
char* api_domain = xy_strjoin(3, "export HOMEBREW_API_DOMAIN=\"", xy_2strjoin(source.url, "homebrew-bottles/api"), "\"");
char* bottle_domain = xy_strjoin(3, "export HOMEBREW_API_DOMAIN=\"", xy_2strjoin(source.url, "homebrew-bottles"), "\"");
char* brew_git_remote = xy_strjoin(3, "export HOMEBREW_API_DOMAIN=\"", xy_2strjoin(source.url, "git/homebrew/brew.git"), "\"");
char* core_git_remote = xy_strjoin(3, "export HOMEBREW_API_DOMAIN=\"", xy_2strjoin(source.url, "git/homebrew/homebrew-core.git"), "\"");
char* api_domain = xy_strjoin(3, "export HOMEBREW_API_DOMAIN=\"", xy_2strjoin(source.url, "homebrew-bottles/api"), "\"");
char* bottle_domain = xy_strjoin(3, "export HOMEBREW_BOTTLE_DOMAIN=\"", xy_2strjoin(source.url, "homebrew-bottles"), "\"");
char* brew_git_remote = xy_strjoin(3, "export HOMEBREW_BREW_GIT_REMOTE=\"", xy_2strjoin(source.url, "git/homebrew/brew.git"), "\"");
char* core_git_remote = xy_strjoin(3, "export HOMEBREW_CORE_GIT_REMOTE=\"", xy_2strjoin(source.url, "git/homebrew/homebrew-core.git"), "\"");
chsrc_runcmd(xy_strjoin(3,"echo ", api_domain, " >> ~/.bashrc >> ~/.zshrc"));
chsrc_runcmd(xy_strjoin(3,"echo ", bottle_domain, " >> ~/.bashrc >> ~/.zshrc"));
@ -1515,9 +1522,11 @@ wr_brew_setsrc(char* option)
chsrc_runcmd(xy_strjoin(3,"echo ", core_git_remote, " >> ~/.bashrc >> ~/.zshrc"));
chsrc_say_thanks (&source);
puts(""); xy_warn("chsrc: 请您重启终端使环境变量生效");
}
/**
* : https://mirrors.sjtug.sjtu.edu.cn/docs/guix
*/