mirror of
https://github.com/RubyMetric/chsrc
synced 2025-12-27 21:19:31 +08:00
@@ -6,7 +6,7 @@
|
||||
* Contributors : Nil Null <nil@null.org>
|
||||
* |
|
||||
* Created On : <2024-06-08>
|
||||
* Last Modified : <2024-11-21>
|
||||
* Last Modified : <2024-11-22>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
static MirrorSite
|
||||
|
||||
@@ -48,45 +48,36 @@ wr_homebrew_setsrc (char *option)
|
||||
{
|
||||
chsrc_yield_source_and_confirm (wr_homebrew);
|
||||
|
||||
char *splitter = "\n\n# Generated by chsrc " Chsrc_Banner_Version;
|
||||
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"), "\"");
|
||||
char *splitter = "\n\n# Generated by chsrc " Chsrc_Banner_Version;
|
||||
char *w1 = xy_strjoin (3, "export HOMEBREW_API_DOMAIN=\"", source.url, "homebrew-bottles/api", "\"\n");
|
||||
char *w2 = xy_strjoin (3, "export HOMEBREW_BOTTLE_DOMAIN=\"", source.url, "homebrew-bottles", "\"\n");
|
||||
char *w3 = xy_strjoin (3, "export HOMEBREW_BREW_GIT_REMOTE=\"", source.url, "git/homebrew/brew.git", "\"\n");
|
||||
char *w4 = xy_strjoin (3, "export HOMEBREW_CORE_GIT_REMOTE=\"", source.url, "git/homebrew/homebrew-core.git", "\"\n");
|
||||
|
||||
char *w = xy_strjoin (5, splitter, w1, w2, w3, w4);
|
||||
|
||||
char *zshrc = "~/.zshrc";
|
||||
chsrc_backup (zshrc);
|
||||
chsrc_append_to_file (splitter, zshrc);
|
||||
chsrc_append_to_file (api_domain, zshrc);
|
||||
chsrc_append_to_file (bottle_domain, zshrc);
|
||||
chsrc_append_to_file (brew_git_remote, zshrc);
|
||||
chsrc_append_to_file (core_git_remote, zshrc);
|
||||
chsrc_append_to_file (w, zshrc);
|
||||
|
||||
char *bashrc = "~/.bashrc";
|
||||
if (xy_file_exist (bashrc))
|
||||
{
|
||||
chsrc_backup (bashrc);
|
||||
chsrc_append_to_file (splitter, bashrc);
|
||||
chsrc_append_to_file (api_domain, bashrc);
|
||||
chsrc_append_to_file (bottle_domain, bashrc);
|
||||
chsrc_append_to_file (brew_git_remote, bashrc);
|
||||
chsrc_append_to_file (core_git_remote, bashrc);
|
||||
chsrc_append_to_file (w, bashrc);
|
||||
}
|
||||
|
||||
char *fishrc = "~/.config/fish/config.fish";
|
||||
if (xy_file_exist (fishrc))
|
||||
{
|
||||
char *api_domain_fish = xy_strjoin(3, "set -x HOMEBREW_API_DOMAIN \"", xy_2strjoin(source.url, "homebrew-bottles/api"), "\"");
|
||||
char *bottle_domain_fish = xy_strjoin(3, "set -x HOMEBREW_BOTTLE_DOMAIN \"", xy_2strjoin(source.url, "homebrew-bottles"), "\"");
|
||||
char *brew_git_remote_fish = xy_strjoin(3, "set -x HOMEBREW_BREW_GIT_REMOTE \"", xy_2strjoin(source.url, "git/homebrew/brew.git"), "\"");
|
||||
char *core_git_remote_fish = xy_strjoin(3, "set -x HOMEBREW_CORE_GIT_REMOTE \"", xy_2strjoin(source.url, "git/homebrew/homebrew-core.git"), "\"");
|
||||
char *w1 = xy_strjoin(3, "set -x HOMEBREW_API_DOMAIN \"", source.url, "homebrew-bottles/api", "\"\n");
|
||||
char *w2 = xy_strjoin(3, "set -x HOMEBREW_BOTTLE_DOMAIN \"", source.url, "homebrew-bottles", "\"\n");
|
||||
char *w3 = xy_strjoin(3, "set -x HOMEBREW_BREW_GIT_REMOTE \"",source.url, "git/homebrew/brew.git", "\"\n");
|
||||
char *w4 = xy_strjoin(3, "set -x HOMEBREW_CORE_GIT_REMOTE \"",source.url, "git/homebrew/homebrew-core.git", "\"\n");
|
||||
|
||||
char *w = xy_strjoin (5, splitter, w1, w2, w3, w4);
|
||||
chsrc_backup (fishrc);
|
||||
chsrc_append_to_file (splitter, fishrc);
|
||||
chsrc_append_to_file (api_domain_fish, fishrc);
|
||||
chsrc_append_to_file (bottle_domain_fish, fishrc);
|
||||
chsrc_append_to_file (brew_git_remote_fish, fishrc);
|
||||
chsrc_append_to_file (core_git_remote_fish, fishrc);
|
||||
chsrc_append_to_file (w, fishrc);
|
||||
}
|
||||
|
||||
chsrc_conclude(&source, SetsrcType_Auto);
|
||||
|
||||
@@ -43,18 +43,18 @@ wr_nix_setsrc (char *option)
|
||||
char *cmd = xy_strjoin (3, "nix-channel --add ", source.url, "nixpkgs-unstable nixpkgs");
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
char *towrite = xy_strjoin (3, "substituters = ", source.url, "store https://cache.nixos.org/");
|
||||
chsrc_append_to_file (towrite , "~/.config/nix/nix.conf");
|
||||
char *w = xy_strjoin (3, "substituters = ", source.url, "store https://cache.nixos.org/");
|
||||
chsrc_append_to_file (w, "~/.config/nix/nix.conf");
|
||||
|
||||
chsrc_run ("nix-channel --update", RunOpt_Default);
|
||||
|
||||
chsrc_note2 ("若您使用的是NixOS,请确认您的系统版本<version>(如22.11),并手动运行:");
|
||||
cmd = xy_strjoin (3, "nix-channel --add ", source.url, "nixpkgs-<version> nixpkgs");
|
||||
puts (cmd);
|
||||
say (cmd);
|
||||
|
||||
cmd = xy_strjoin (3, "nix.settings.substituters = [ \"", source.url, "store\" ];");
|
||||
chsrc_note2 ("若您使用的是NixOS,请额外添加下述内容至 configuration.nix 中");
|
||||
puts (cmd);
|
||||
say (cmd);
|
||||
|
||||
chsrc_conclude (&source, SetsrcType_SemiAuto);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user