mirror of
https://gitee.com/ineo6/homebrew-install.git
synced 2026-07-13 23:01:07 +08:00
Compare commits
7 Commits
38feb3e2f7
...
5289036216
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5289036216 | ||
|
|
a083d77f10 | ||
|
|
8233bada05 | ||
|
|
081c5529e1 | ||
|
|
bf45ee6aea | ||
|
|
86caf05516 | ||
|
|
f2f8e25fc9 |
@ -38,7 +38,7 @@ export default defineConfig({
|
||||
'/install': [
|
||||
{
|
||||
title: '快系列-你快了吗',
|
||||
children: ['/install/stable-diffusion-webui', '/install/nvm-for-nodejs'],
|
||||
children: ['/install/stable-diffusion-webui', '/install/nvm-for-nodejs', '/install/game-porting-toolkit'],
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@ -13,6 +13,13 @@ echo 'export HOMEBREW_API_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/ap
|
||||
source ~/.zprofile
|
||||
```
|
||||
|
||||
## 加速工具
|
||||
|
||||
免责声明:列出以下内容仅仅是提供应急所需,不对服务的稳定性提供保证。
|
||||
|
||||
- [一元机场](https://xn--4gq62f52gdss.com/#/register?code=a2ZU70bj)
|
||||
- [efc-cloud](https://invite.fastconnect.cc/#/register?code=ndwVZL5l)
|
||||
|
||||
## 终端设置代理
|
||||
|
||||
在你的代理软件中找到`http`端口对应的值,替换下面设置脚本中的`1080`,然后在终端里执行。
|
||||
@ -244,6 +251,20 @@ To retry an incomplete download, remove the file above.
|
||||
|
||||
遇到该问题时请尝试该方案:https://blog.csdn.net/lemostic/article/details/107101219
|
||||
|
||||
## homebrew-bundle错误
|
||||
|
||||
```shell
|
||||
fatal: unable to access 'https://github.com/homebrew/homebrew-bundle/': Recv failure: Operation timed out
|
||||
Error: Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-bundle failed!
|
||||
Failed during: /usr/local/bin/brew update --force --quiet
|
||||
```
|
||||
|
||||
这个错误是因为`bundle`工具默认内置的`GitHub`资源,这很容易导致出现方式失败的情况,请直接执行以下命令:
|
||||
|
||||
```shell
|
||||
git -C "$(brew --repo)/Library/Taps/homebrew/homebrew-bundle" remote set-url origin https://gitee.com/imirror/homebrew-bundle.git
|
||||
```
|
||||
|
||||
## 如何判断终端类型
|
||||
|
||||
在终端执行命令`echo $SHELL`,根据显示的结果判断:
|
||||
|
||||
@ -1,4 +1,21 @@
|
||||
# GitHub 加速教程
|
||||
# GitHub 加速方案
|
||||
|
||||
|
||||
## GitHub文件加速
|
||||
|
||||
请访问 [https://gh.idayer.com](https://gh.idayer.com)
|
||||
|
||||
GitHub 文件 , Releases , archive , gist , raw.githubusercontent.com 文件代理加速下载服务。
|
||||
|
||||
支持以下资源:
|
||||
|
||||
- Raw 文件:`https://raw.githubusercontent.com/ineo6/hosts/master/hosts`
|
||||
- 分支源码:`https://github.com/ineo6/hosts/archive/master.zip`
|
||||
- Releases 源码:`https://github.com/stilleshan/ServerStatus/archive/v1.0.tar.gz`
|
||||
- Releases 文件:`https://github.com/fatedier/frp/releases/download/v0.33.0/frp_0.33.0_linux_amd64.tar.gz`
|
||||
|
||||
|
||||
## Hosts加速
|
||||
|
||||
[GitHub Hosts](https://github.com/ineo6/hosts) 仓库提供最新的`GitHub hosts`地址。
|
||||
|
||||
|
||||
230
docs/install/game-porting-toolkit.md
Normal file
230
docs/install/game-porting-toolkit.md
Normal file
@ -0,0 +1,230 @@
|
||||
---
|
||||
keywords: [mac,game-porting-toolkit]
|
||||
---
|
||||
|
||||
# Game Porting Toolkit 安装指南
|
||||
|
||||
`Game Porting Toolkit`游戏移植工具包于2023年6月6日在`WWDC`大会上发布,`Game Porting Toolkit` 将`Wine`与苹果自家的`D3DMetal`技术相结合,实现对`DirectX` 11和12的支持。
|
||||
|
||||
与`CrossOver`或`Parallels`这类结束相比,虽然通过`GPTK`安装`Windows`游戏对用户有使用门槛,但它却有解锁支持更多`DirectX`游戏的能力。
|
||||
|
||||
虽说很多游戏都可以通过`GPTK`运行,但是那些包含了反作弊或`DRMs`,以及使用`A1VX`/`AVX 2`指令集的游戏不在可玩范围之内。
|
||||
|
||||
## 准备
|
||||
|
||||
### 关于支持的系统,macOS 14 beta?
|
||||
|
||||
貌似只能使用`macOS Sonoma beta`版本,即 `macOS 14 beta`。但是也有说法是`macOS 13`也是可以的,不愿意尝试的用户可以试下。
|
||||
|
||||
另外注意如果遇到问题也可以尝试把系统改为英文。
|
||||
|
||||
## Homebrew
|
||||
|
||||
只有`x86`版本的`Homebrew`才能满足安装要求,我们需要新安装`x86`版本,如果已经安装过`arm`版本的`Homebrew`,我们是可以让两者同存的。
|
||||
|
||||
1. 打开终端
|
||||
2. 安装`Rosetta`转译
|
||||
```shell
|
||||
softwareupdate --install-rosetta
|
||||
```
|
||||
1. 打开`x86`模式的`zsh`终端,**注意:教程里的操作都需要在`x86`下操作**
|
||||
```shell
|
||||
# 启动 x86 版本的 shell
|
||||
arch -x86_64 zsh
|
||||
```
|
||||
2. 安装`x86`版本`Homebrew`
|
||||
|
||||
```shell
|
||||
/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"
|
||||
```
|
||||
|
||||
请认准 [Homebrew中文网](https://brew.idayer.com/)
|
||||
|
||||
1. 设置`brew`环境自动切换
|
||||
```shell
|
||||
cat << 'EOF' >> ~/.zshrc
|
||||
if [ "$(arch)" = "arm64" ]; then
|
||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
else
|
||||
eval "$(/usr/local/bin/brew shellenv)"
|
||||
fi
|
||||
EOF
|
||||
|
||||
source ~/.zshrc
|
||||
```
|
||||
|
||||
后续只需要在终端先执行`arch -x86_64 zsh`,就能自动切换到`x86`,不执行这段命令就会默认用`arm`版本。
|
||||
|
||||
安装结束后,执行命令:
|
||||
|
||||
```shell
|
||||
which brew
|
||||
```
|
||||
|
||||
如果看到一下目录就说明`Homebrew`安装对了。
|
||||
|
||||
```shell
|
||||
/usr/local/bin/brew
|
||||
```
|
||||
|
||||
## 构建 game-porting-toolkit
|
||||
|
||||
确保还在上述终端里,继续执行命令安装:
|
||||
|
||||
```shell
|
||||
brew tap apple/apple https://gitee.com/ineo6/homebrew-apple.git
|
||||
```
|
||||
|
||||
该`tap`仓库使用的国内镜像,能够安装时不会遇到网络问题。
|
||||
|
||||
然后编译`game-porting-toolkit`,这一步的耗时会很久,请耐心等待。
|
||||
|
||||
```shell
|
||||
brew -v install apple/apple/game-porting-toolkit
|
||||
```
|
||||
|
||||
具体的时间取决于你的电脑性能和网速,以下数据仅供参考。
|
||||
|
||||
在`M1`上首次安装可能需要75分钟,更新需要48分钟,在`M2 Max`上首次安装需要36分钟,更新需要19分钟。
|
||||
|
||||
### 准备 Game Porting Toolkit
|
||||
|
||||
访问 [Apple开发者下载网站](https://developer.apple.com/download/all/),登录你的苹果帐号后,在输入框搜索`Game Porting Toolkit`。
|
||||
|
||||

|
||||
|
||||
|
||||
下载好后双击`dmg`进行挂载。
|
||||
|
||||
- Game_porting_toolkit_1_beta_3以及之前版本请执行:
|
||||
|
||||
请执行:
|
||||
|
||||
```shell
|
||||
ditto /Volumes/Game\ Porting\ Toolkit-1.0/lib/ `brew --prefix game-porting-toolkit`/lib/
|
||||
```
|
||||
|
||||
- Game_porting_toolkit_1_beta_4版本请执行:
|
||||
|
||||
```shell
|
||||
ditto /Volumes/Game\ Porting\ Toolkit-1.0/redist/lib/ `brew --prefix game-porting-toolkit`/lib/
|
||||
```
|
||||
|
||||
继续执行:
|
||||
|
||||
```shell
|
||||
cp /Volumes/Game\ Porting\ Toolkit*/gameportingtoolkit* /usr/local/bin
|
||||
```
|
||||
|
||||
## 配置 Wine prefix
|
||||
|
||||
```shell
|
||||
WINEPREFIX=~/my-game-prefix `brew --prefix game-porting-toolkit`/bin/wine64 winecfg
|
||||
```
|
||||
|
||||

|
||||
|
||||
执行后,会弹出`Wine configuration`,我们要把里面的`Windows Version`里面的值改为`Windows 10`,并点击`OK`保存。
|
||||
|
||||
如果没有显示`Wine configuration`窗口,在`Dock`里也没有新增的应用,有可能就是因为没有安装上`x86`版本的`Homebrew`以及对应的`game-porting-toolkit`。
|
||||
|
||||
请重新检视**构建 game-porting-toolkit**这一章节内容。
|
||||
|
||||
如果一切顺利到此,那接下来就可以安装游戏了。
|
||||
|
||||
## 下载&安装 Steam
|
||||
|
||||
下载 [Steam](https://cdn.cloudflare.steamstatic.com/client/installer/SteamSetup.exe)(Windows)并放放在你的"下载"文件夹内,英文版叫"Downloads"。
|
||||
|
||||
### 安装
|
||||
|
||||
```shell
|
||||
gameportingtoolkit ~/my-game-prefix ~/Downloads/SteamSetup.exe
|
||||
```
|
||||
|
||||
这里的`~/Downloads/SteamSetup.exe`就是你要安装或运行的`Windows`程序,如果是其他游戏,可以自己替换。
|
||||
|
||||
### 用gptk启动Steam
|
||||
|
||||
```shell
|
||||
gameportingtoolkit ~/my-game-prefix 'C:\Program Files (x86)/Steam/steam.exe'
|
||||
```
|
||||
|
||||
### 登录Steam
|
||||
|
||||
启动`Steam`后,很可能会出现黑色的弹窗,无法进行任何操作,这样我们也没法登录帐号,可以参考下面的方案。
|
||||
|
||||
#### 解决方案1
|
||||
|
||||
换以下启动命令:
|
||||
|
||||
```shell
|
||||
MTL_HUD_ENABLED=1 WINEESYNC=1 WINEPREFIX=~/my-game-prefix /usr/local/Cellar/game-porting-toolkit/1.0.3/bin/wine64 'C:\Program Files (x86)\Steam\steam.exe'
|
||||
```
|
||||
|
||||
#### 解决方案2
|
||||
|
||||
安装`mac`版本的`Steam`,登录帐号并保证能看到游戏。
|
||||
|
||||
打开以下目录:
|
||||
|
||||
```shell
|
||||
~/Library/Application Support/Steam
|
||||
```
|
||||
|
||||
复制`config`、`userdata`、`registry.vdf`三个文件到下面这个目录:
|
||||
|
||||
```shell
|
||||
~/my-game-prefix/drive_c/Program Files (x86)/Steam
|
||||
```
|
||||
|
||||
重新启动`Windows`版本`Steam`:
|
||||
|
||||
```shell
|
||||
gameportingtoolkit ~/my-game-prefix 'C:\Program Files (x86)/Steam/steam.exe'
|
||||
```
|
||||
|
||||
现在可以正常登录,但是可能还是有黑屏部分,可以通过点击菜单`View`-`Small Model`进行调整。
|
||||
|
||||
接下来就可以安装游戏了
|
||||
|
||||
### 启动游戏:赛博朋克2077
|
||||
|
||||
这里我们以为例,假设你在`Steam`里下载并安装了`赛博朋克2077`,可以尝试直接在`Steam`启动游戏,如果不行的话可以用下面的命令启动游戏。
|
||||
|
||||
```shell
|
||||
MTL_HUD_ENABLED=1 WINEESYNC=1 WINEPREFIX=~/my-game-prefix /usr/local/Cellar/game-porting-toolkit/1.0/bin/wine64 ~/my-game-prefix/drive_c/Program\ Files\ \(x86\)/Steam/steamapps/common/Cyberpunk\ 2077/bin/x64/Cyberpunk2077.exe
|
||||
```
|
||||
|
||||
上面命令的最后部分是你的游戏安装目录,启动不同的游戏可以自行替换游戏启动`exe`的路径。
|
||||
|
||||
```shell
|
||||
~/my-game-prefix/drive_c/Program\ Files\ \(x86\)/Steam/steamapps/common/Cyberpunk\ 2077/bin/x64/Cyberpunk2077.exe
|
||||
```
|
||||
|
||||
## 更多解决方案
|
||||
|
||||
### Steam 黑屏解决方案汇总
|
||||
|
||||
#### 其他Steam启动命令
|
||||
|
||||
1. 关闭终端,重新打开终端和执行启动`Steam`,多尝试几次。
|
||||
2. 更换启动`Steam`命令:
|
||||
```shell
|
||||
MTL_HUD_ENABLED=1 WINEESYNC=1 WINEPREFIX=~/my-game-prefix /usr/local/Cellar/game-porting-toolkit/1.0.3/bin/wine64 'C:\Program Files (x86)/Steam/steam.exe'
|
||||
```
|
||||
3. 使用`CrossOver`
|
||||
```shell
|
||||
WINEPREFIX="/Users/$USER/Library/Application Support/CrossOver/Bottles/Steam/"
|
||||
```
|
||||
|
||||
#### 通过mac Steam登录
|
||||
|
||||
1. 登录`mac`版`Steam`。
|
||||
2. 打开`~/Library/Application Support/Steam`,复制这三个文件: `config`, `registry.vdf`, `userdata`。
|
||||
3. 粘贴到`~/my-game-prefix/drive_c/Program Files (x86)/Steam/`
|
||||
|
||||
|
||||
#### 打开Steam后直接闪退
|
||||
|
||||
移除扩展显示器,或者停止屏幕镜像。
|
||||
@ -39,6 +39,28 @@ then
|
||||
abort 'Bash must not run in POSIX mode. Please unset POSIXLY_CORRECT and try again.'
|
||||
fi
|
||||
|
||||
usage() {
|
||||
cat <<EOS
|
||||
Homebrew Installer
|
||||
Usage: [NONINTERACTIVE=1] [CI=1] install.sh [options]
|
||||
-h, --help Display this message.
|
||||
NONINTERACTIVE Install without prompting for user input
|
||||
CI Install in CI mode (e.g. do not prompt for user input)
|
||||
EOS
|
||||
exit "${1:-0}"
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
case "$1" in
|
||||
-h | --help) usage ;;
|
||||
*)
|
||||
warn "Unrecognized option: '$1'"
|
||||
usage 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# string formatters
|
||||
if [[ -t 1 ]]
|
||||
then
|
||||
@ -181,9 +203,9 @@ fi
|
||||
export HOMEBREW_{BREW,CORE}_GIT_REMOTE
|
||||
|
||||
# TODO: bump version when new macOS is released or announced
|
||||
MACOS_NEWEST_UNSUPPORTED="14.0"
|
||||
MACOS_NEWEST_UNSUPPORTED="15.0"
|
||||
# TODO: bump version when new macOS is released
|
||||
MACOS_OLDEST_SUPPORTED="11.0"
|
||||
MACOS_OLDEST_SUPPORTED="12.0"
|
||||
|
||||
# For Homebrew on Linux
|
||||
REQUIRED_RUBY_VERSION=2.6 # https://github.com/Homebrew/brew/pull/6556
|
||||
@ -833,28 +855,28 @@ EOABORT
|
||||
)"
|
||||
fi
|
||||
|
||||
USABLE_GIT="$(command -v git)"
|
||||
if [[ -z "${USABLE_GIT}" ]]
|
||||
USABLE_GIT=/usr/bin/git
|
||||
if [[ -n "${HOMEBREW_ON_LINUX-}" ]]
|
||||
then
|
||||
abort "$(
|
||||
cat <<EOABORT
|
||||
You must install Git before installing Homebrew. See:
|
||||
${tty_underline}https://docs.brew.sh/Installation${tty_reset}
|
||||
EOABORT
|
||||
)"
|
||||
elif [[ -n "${HOMEBREW_ON_LINUX-}" ]]
|
||||
then
|
||||
suitable_git="$(find_tool git)"
|
||||
if [[ -z "${suitable_git}" ]]
|
||||
USABLE_GIT="$(find_tool git)"
|
||||
if [[ -z "$(command -v git)" ]]
|
||||
then
|
||||
abort "$(
|
||||
cat <<EOABORT
|
||||
The version of Git that was found does not satisfy requirements for Homebrew.
|
||||
Please install Git ${REQUIRED_GIT_VERSION} or newer and add it to your PATH.
|
||||
You must install Git before installing Homebrew. See:
|
||||
${tty_underline}https://docs.brew.sh/Installation${tty_reset}
|
||||
EOABORT
|
||||
)"
|
||||
fi
|
||||
if [[ -z "${USABLE_GIT}" ]]
|
||||
then
|
||||
abort "$(
|
||||
cat <<EOABORT
|
||||
The version of Git that was found does not satisfy requirements for Homebrew.
|
||||
Please install Git ${REQUIRED_GIT_VERSION} or newer and add it to your PATH.
|
||||
EOABORT
|
||||
)"
|
||||
fi
|
||||
USABLE_GIT="${suitable_git}"
|
||||
if [[ "${USABLE_GIT}" != /usr/bin/git ]]
|
||||
then
|
||||
export HOMEBREW_GIT_PATH="${USABLE_GIT}"
|
||||
@ -992,22 +1014,27 @@ EOS
|
||||
ohai "Next steps:"
|
||||
case "${SHELL}" in
|
||||
*/bash*)
|
||||
if [[ -r "${HOME}/.bash_profile" ]]
|
||||
if [[ -n "${HOMEBREW_ON_LINUX-}" ]]
|
||||
then
|
||||
shell_profile="${HOME}/.bash_profile"
|
||||
shell_rcfile="${HOME}/.bashrc"
|
||||
else
|
||||
shell_profile="${HOME}/.profile"
|
||||
shell_rcfile="${HOME}/.bash_profile"
|
||||
fi
|
||||
;;
|
||||
*/zsh*)
|
||||
shell_profile="${HOME}/.zprofile"
|
||||
if [[ -n "${HOMEBREW_ON_LINUX-}" ]]
|
||||
then
|
||||
shell_rcfile="${ZDOTDIR:-"${HOME}"}/.zshrc"
|
||||
else
|
||||
shell_rcfile="${ZDOTDIR:-"${HOME}"}/.zprofile"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
shell_profile="${HOME}/.profile"
|
||||
shell_rcfile="${ENV:-"${HOME}/.profile"}"
|
||||
;;
|
||||
esac
|
||||
|
||||
if grep -qs "eval \"\$(${HOMEBREW_PREFIX}/bin/brew shellenv)\"" "${shell_profile}"
|
||||
if grep -qs "eval \"\$(${HOMEBREW_PREFIX}/bin/brew shellenv)\"" "${shell_rcfile}"
|
||||
then
|
||||
if ! [[ -x "$(command -v brew)" ]]
|
||||
then
|
||||
@ -1019,7 +1046,7 @@ EOS
|
||||
else
|
||||
cat <<EOS
|
||||
- Run these two commands in your terminal to add Homebrew to your ${tty_bold}PATH${tty_reset}:
|
||||
(echo; echo 'eval "\$(${HOMEBREW_PREFIX}/bin/brew shellenv)"') >> ${shell_profile}
|
||||
(echo; echo 'eval "\$(${HOMEBREW_PREFIX}/bin/brew shellenv)"') >> ${shell_rcfile}
|
||||
eval "\$(${HOMEBREW_PREFIX}/bin/brew shellenv)"
|
||||
EOS
|
||||
fi
|
||||
@ -1032,8 +1059,8 @@ then
|
||||
plural="s"
|
||||
fi
|
||||
printf -- "- Run these commands in your terminal to add the non-default Git remote%s for %s:\n" "${plural}" "${non_default_repos}"
|
||||
printf " echo '# Set PATH, MANPATH, etc., for Homebrew.' >> %s\n" "${shell_profile}"
|
||||
printf " echo '%s' >> ${shell_profile}\n" "${additional_shellenv_commands[@]}"
|
||||
printf " echo '# Set PATH, MANPATH, etc., for Homebrew.' >> %s\n" "${shell_rcfile}"
|
||||
printf " echo '%s' >> ${shell_rcfile}\n" "${additional_shellenv_commands[@]}"
|
||||
printf " %s\n" "${additional_shellenv_commands[@]}"
|
||||
fi
|
||||
|
||||
|
||||
75
install.sh
75
install.sh
@ -39,6 +39,28 @@ then
|
||||
abort 'Bash must not run in POSIX mode. Please unset POSIXLY_CORRECT and try again.'
|
||||
fi
|
||||
|
||||
usage() {
|
||||
cat <<EOS
|
||||
Homebrew Installer
|
||||
Usage: [NONINTERACTIVE=1] [CI=1] install.sh [options]
|
||||
-h, --help 显示帮助信息.
|
||||
NONINTERACTIVE 安装时不需要用户确认输入
|
||||
CI CI模式安装
|
||||
EOS
|
||||
exit "${1:-0}"
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
case "$1" in
|
||||
-h | --help) usage ;;
|
||||
*)
|
||||
warn "Unrecognized option: '$1'"
|
||||
usage 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# string formatters
|
||||
if [[ -t 1 ]]
|
||||
then
|
||||
@ -73,14 +95,14 @@ ohai() {
|
||||
printf "${tty_blue}==>${tty_bold} %s${tty_reset}\n" "$(shell_join "$@")"
|
||||
}
|
||||
|
||||
highlight() {
|
||||
printf "${tty_green} %s${tty_reset}\n" "$(shell_join "$@")"
|
||||
}
|
||||
|
||||
warn() {
|
||||
printf "${tty_red}Warning${tty_reset}: %s\n" "$(chomp "$1")" >&2
|
||||
}
|
||||
|
||||
highlight() {
|
||||
printf "${tty_green} %s${tty_reset}\n" "$(shell_join "$@")"
|
||||
}
|
||||
|
||||
checkExecute() {
|
||||
if [ $? -ne 0 ];then
|
||||
echo "${tty_red}执行成功 '$1'${tty_reset}"
|
||||
@ -189,7 +211,7 @@ HOMEBREW_BREW_DEFAULT_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"
|
||||
HOMEBREW_CORE_DEFAULT_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git"
|
||||
|
||||
HOMEBREW_CASK_DEFAULT_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-cask.git"
|
||||
HOMEBREW_SERVICES_DEFAULT_GIT_REMOTE="https://gitee.com/imirror/homebrew-services.git"
|
||||
HOMEBREW_SERVICES_DEFAULT_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-services.git"
|
||||
|
||||
HOMEBREW_API_DEFAULT_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles/api"
|
||||
HOMEBREW_BOTTLE_DEFAULT_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles/bottles"
|
||||
@ -218,9 +240,9 @@ export HOMEBREW_API_DOMAIN
|
||||
export HOMEBREW_BOTTLE_DOMAIN
|
||||
|
||||
# TODO: bump version when new macOS is released or announced
|
||||
MACOS_NEWEST_UNSUPPORTED="14.0"
|
||||
MACOS_NEWEST_UNSUPPORTED="15.0"
|
||||
# TODO: bump version when new macOS is released
|
||||
MACOS_OLDEST_SUPPORTED="11.0"
|
||||
MACOS_OLDEST_SUPPORTED="12.0"
|
||||
|
||||
# For Homebrew on Linux
|
||||
REQUIRED_RUBY_VERSION=2.6 # https://github.com/Homebrew/brew/pull/6556
|
||||
@ -589,13 +611,21 @@ EOABORT
|
||||
|
||||
echo "$(
|
||||
cat <<EOS
|
||||
系统版本太旧,可能会遇到一些未知问题
|
||||
因为系统版本,可能会遇到一些未知问题
|
||||
EOS
|
||||
)
|
||||
" | tr -d "\\"
|
||||
fi
|
||||
fi
|
||||
|
||||
ohai "脚本会安装以下内容:"
|
||||
echo "${HOMEBREW_PREFIX}/bin/brew"
|
||||
echo "${HOMEBREW_PREFIX}/share/doc/homebrew"
|
||||
echo "${HOMEBREW_PREFIX}/share/man/man1/brew.1"
|
||||
echo "${HOMEBREW_PREFIX}/share/zsh/site-functions/_brew"
|
||||
echo "${HOMEBREW_PREFIX}/etc/bash_completion.d/brew"
|
||||
echo "${HOMEBREW_REPOSITORY}"
|
||||
|
||||
# Keep relatively in sync with
|
||||
# https://github.com/Homebrew/brew/blob/master/Library/Homebrew/keg.rb
|
||||
directories=(
|
||||
@ -1133,29 +1163,34 @@ EOS
|
||||
ohai "Next steps:"
|
||||
case "${SHELL}" in
|
||||
*/bash*)
|
||||
if [[ -r "${HOME}/.bash_profile" ]]
|
||||
if [[ -n "${HOMEBREW_ON_LINUX-}" ]]
|
||||
then
|
||||
shell_profile="${HOME}/.bash_profile"
|
||||
shell_rcfile="${HOME}/.bashrc"
|
||||
else
|
||||
shell_profile="${HOME}/.profile"
|
||||
shell_rcfile="${HOME}/.bash_profile"
|
||||
fi
|
||||
;;
|
||||
*/zsh*)
|
||||
shell_profile="${HOME}/.zprofile"
|
||||
if [[ -n "${HOMEBREW_ON_LINUX-}" ]]
|
||||
then
|
||||
shell_rcfile="${ZDOTDIR:-"${HOME}"}/.zshrc"
|
||||
else
|
||||
shell_rcfile="${ZDOTDIR:-"${HOME}"}/.zprofile"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
shell_profile="${HOME}/.profile"
|
||||
shell_rcfile="${ENV:-"${HOME}/.profile"}"
|
||||
;;
|
||||
esac
|
||||
|
||||
# clean existed env
|
||||
if [[ -e "${shell_profile}" ]]; then
|
||||
if [[ -e "${shell_rcfile}" ]]; then
|
||||
if [[ -z "${HOMEBREW_ON_LINUX-}" ]]; then
|
||||
#Mac
|
||||
sed -i "" "/brew\.idayer\.com/d" ${shell_profile}
|
||||
sed -i "" "/brew\.idayer\.com/d" ${shell_rcfile}
|
||||
else
|
||||
#Linux
|
||||
sed -i "/brew\.idayer\.com/d" ${shell_profile}
|
||||
sed -i "/brew\.idayer\.com/d" ${shell_rcfile}
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -1166,24 +1201,24 @@ echo "自动配置环境变量"
|
||||
# shellcheck disable=SC2230
|
||||
if [[ "$(which brew)" != "${HOMEBREW_PREFIX}/bin/brew" ]]
|
||||
then
|
||||
cat >> ${shell_profile} <<EOS
|
||||
cat >> ${shell_rcfile} <<EOS
|
||||
eval \$(${HOMEBREW_PREFIX}/bin/brew shellenv) #brew.idayer.com
|
||||
export HOMEBREW_API_DOMAIN=${HOMEBREW_API_DOMAIN} #brew.idayer.com
|
||||
export HOMEBREW_BOTTLE_DOMAIN=${HOMEBREW_BOTTLE_DOMAIN} #brew.idayer.com
|
||||
EOS
|
||||
else
|
||||
cat >> ${shell_profile} <<EOS
|
||||
cat >> ${shell_rcfile} <<EOS
|
||||
export HOMEBREW_API_DOMAIN=${HOMEBREW_API_DOMAIN} #brew.idayer.com
|
||||
export HOMEBREW_BOTTLE_DOMAIN=${HOMEBREW_BOTTLE_DOMAIN} #brew.idayer.com
|
||||
EOS
|
||||
fi
|
||||
|
||||
checkExecute
|
||||
source "${shell_profile}"
|
||||
source "${shell_rcfile}"
|
||||
if [ $? -ne 0 ];then
|
||||
echo "$(
|
||||
cat <<EOS
|
||||
${tty_red}${shell_profile} 文件存在错误,请仔细查看提示进行修改${tty_reset}
|
||||
${tty_red}${shell_rcfile} 文件存在错误,请仔细查看提示进行修改${tty_reset}
|
||||
EOS
|
||||
)
|
||||
"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user