diff --git a/src/chsrc.c b/src/chsrc.c index 6cab75f..bedb5fa 100644 --- a/src/chsrc.c +++ b/src/chsrc.c @@ -14,7 +14,7 @@ * chsrc: Change Source —— 全平台通用命令行换源工具 * ------------------------------------------------------------*/ -#define Chsrc_Version "v0.1.7.pre4-2024/06/20" +#define Chsrc_Version "v0.1.7.pre5-2024/06/21" #define Chsrc_Maintain_URL "https://gitee.com/RubyMetric/chsrc" #include "chsrc.h" @@ -843,7 +843,7 @@ ensure_apt_sourcelist (int debian_type) if (debian_type == Debian_deriv_ubuntu) { makeup = xy_strjoin (9, - "# Generated by chsrc " Chsrc_Version "(" Chsrc_Maintain_URL ")\n\n" + "# Generated by chsrc " Chsrc_Version "\n\n" "deb " Chsrc_Maintain_URL "/ubuntu ", codename, " main restricted universe multiverse\n" "deb " Chsrc_Maintain_URL "/ubuntu ", codename, "-updates main restricted universe multiverse\n" "deb " Chsrc_Maintain_URL "/ubuntu ", codename, "-backports main restricted universe multiverse\n" @@ -857,7 +857,7 @@ ensure_apt_sourcelist (int debian_type) // https://mirrors.tuna.tsinghua.edu.cn/help/debian/ // 从 Debian 12 开始,开始有一项 non-free-firmware makeup = xy_strjoin (9, - "# Generated by chsrc " Chsrc_Version "(" Chsrc_Maintain_URL ")\n\n" + "# Generated by chsrc " Chsrc_Version "\n\n" "deb " Chsrc_Maintain_URL "/debian ", codename, " main contrib non-free non-free-firmware\n" "deb " Chsrc_Maintain_URL "/debian ", codename, "-updates main contrib non-free non-free-firmware\n" "deb " Chsrc_Maintain_URL "/debian ", codename, "-backports main contrib non-free non-free-firmware\n" @@ -2058,11 +2058,16 @@ wr_brew_setsrc (char *option) chsrc_yield_source (wr_brew); chsrc_confirm_source (&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_BOTTLE_DOMAIN=\"", xy_2strjoin (source.url, "homebrew-bottles"), "\""); + char *splitter = "\n\n# Generated by chsrc " Chsrc_Version "\n"; + 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_backup ("~/.zshrc"); + chsrc_backup ("~/.bashrc"); + + chsrc_append_to_file (splitter, "~/.bashrc >> ~/.zshrc"); chsrc_append_to_file (api_domain, "~/.bashrc >> ~/.zshrc"); chsrc_append_to_file (bottle_domain, "~/.bashrc >> ~/.zshrc"); chsrc_append_to_file (brew_git_remote, "~/.bashrc >> ~/.zshrc");