From a26dc9593f05699542b6a2af96501daf66b429ac Mon Sep 17 00:00:00 2001 From: neo Date: Wed, 14 Apr 2021 18:04:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=A7=BB=E9=99=A4bottles=E9=95=9C?= =?UTF-8?q?=E5=83=8F=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dumi/theme/builtins/SourceGenerate.tsx | 33 ------------------------- docs/guide/m1.md | 10 +------- docs/guide/start.md | 29 ---------------------- 3 files changed, 1 insertion(+), 71 deletions(-) diff --git a/.dumi/theme/builtins/SourceGenerate.tsx b/.dumi/theme/builtins/SourceGenerate.tsx index 8e6719a..2fbea5c 100644 --- a/.dumi/theme/builtins/SourceGenerate.tsx +++ b/.dumi/theme/builtins/SourceGenerate.tsx @@ -73,22 +73,6 @@ const SourceGenerate = ({ first }) => { shellArray.push('brew update'); - shellArray.push(''); - - const file = terminalType === 'zsh' ? '.zprofile' : '.bash_profile'; - - if (platform === Platform.Linux && matchMirror.linuxBottles) { - shellArray.push( - `echo 'export HOMEBREW_BOTTLE_DOMAIN=${matchMirror.linuxBottles}' >> ~/${file}`, - ); - } else { - shellArray.push( - `echo 'export HOMEBREW_BOTTLE_DOMAIN=${matchMirror.bottles}' >> ~/${file}`, - ); - } - - shellArray.push(`source ~/${file}`); - return shellArray.join('\n'); } @@ -111,23 +95,6 @@ const SourceGenerate = ({ first }) => { '/bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)"', ); - shellArray.push(''); - shellArray.push('# 2.安装完成后设置'); - - const file = terminalType === 'zsh' ? '.zprofile' : '.bash_profile'; - - if (platform === Platform.Linux && matchMirror.linuxBottles) { - shellArray.push( - `echo 'export HOMEBREW_BOTTLE_DOMAIN=${matchMirror.linuxBottles}' >> ~/${file}`, - ); - } else { - shellArray.push( - `echo 'export HOMEBREW_BOTTLE_DOMAIN=${matchMirror.bottles}' >> ~/${file}`, - ); - } - - shellArray.push(`source ~/${file}`); - return shellArray.join('\n'); } diff --git a/docs/guide/m1.md b/docs/guide/m1.md index a81a083..db38faf 100644 --- a/docs/guide/m1.md +++ b/docs/guide/m1.md @@ -68,7 +68,7 @@ alias ibrew='arch -x86_64 /usr/local/bin/brew' ## 设置镜像 -**注意:本文中的安装脚本会设置中科大源镜像,如果你也想设置`cask`和`bottles`的镜像,请按下面注释部分选择执行代码。** +**注意:本文中的安装脚本会设置中科大源镜像,如果你也想设置`cask`的镜像,请按下面注释部分选择执行代码。** 更详细的教程可以参考前面的文章:[设置镜像](/guide/start/#part3) 。 @@ -85,14 +85,6 @@ git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc # cask git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git - -# bottles for zsh 和下面2选1 -echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zprofile -source ~/.zprofile - -# bottles for bash 和上面2选1 -echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile -source ~/.bash_profile ``` **如果觉得教程有用,欢迎多多分享宣传~** diff --git a/docs/guide/start.md b/docs/guide/start.md index d8f21a8..ba82059 100644 --- a/docs/guide/start.md +++ b/docs/guide/start.md @@ -77,33 +77,6 @@ git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna brew update ``` -### 设置 bottles 镜像 - -设置环境变量需要注意终端的类型,可以先通过以下方式获取: - -执行命令`echo $SHELL`,根据结果判断: - -- `/bin/zsh` => `zsh` => `.zprofile` -- `/bin/bash` => `bash` => `.bash_profile` - -然后继续正式操作,以**中科大源**为例: - -从`macOS Catalina`(10.15.x) 版开始,`Mac`使用`zsh`作为默认`Shell`,对应文件是`.zprofile`,所以命令为: - -```shell -echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zprofile -source ~/.zprofile -``` - -如果是`macOS Mojave` 及更低版本,并且没有自己配置过`zsh`,对应文件则是`.bash_profile`: - -```shell -echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile -source ~/.bash_profile -``` - -> 注意:上述区别仅仅是`.zprofile`和`.bash_profile`不同,上下文如有再次提及编辑`.zprofile`,均按此方法判断具体操作的文件。 - 至此,安装和设置操作都完成了。 ### 恢复默认源 @@ -118,8 +91,6 @@ git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/H brew update ``` -`homebrew-bottles`配置只能手动删除,将 `~/.zprofile` 文件中的 `HOMEBREW_BOTTLE_DOMAIN=https://mirrors.xxx.com`内容删除,并执行 `source ~/.zprofile`。 - ## 如何卸载 Homebrew 使用官方脚本同样会遇到`uninstall`地址无法访问问题,可以使用下面脚本: