This commit is contained in:
luk 2024-05-24 11:17:37 +08:00
parent 3289d846ad
commit fc712a068f
3 changed files with 14 additions and 10 deletions

View File

@ -4,6 +4,8 @@ echo "Installing Homebrew on MacOS"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# default brew path: /opt/homebrew for Apple Silicon, /usr/local/Homebrew for macOS Intel and /home/linuxbrew/.linuxbrew for Linux
echo "if `brew --repo homebrew/core` not exists, you may need to git clone https://github.com/Homebrew/homebrew-core.git as well as for homebrew-cask"
# add brew to path on Apple Silicon:
# (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/luk/.bash_profile
# eval "$(/opt/homebrew/bin/brew shellenv)"
@ -18,4 +20,4 @@ echo "Installing Homebrew on MacOS"
# uninstall: https://github.com/homebrew/install#uninstall-homebrew
# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
# install emacs: brew cask install emacs

View File

@ -4,25 +4,25 @@ read -p '>>> ' TARGET
if [ "$TARGET" = 'g' ]
then
git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git
git -C "$(brew --repo homebrew-core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git
git -C "$(brew --repo homebrew-cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask
git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask
elif [ "$TARGET" = 'z' ]
then
git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
git -C "$(brew --repo homebrew-core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
git -C "$(brew --repo homebrew-cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
elif [ "$TARGET" = 'q' ]
then
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
git -C "$(brew --repo homebrew-core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
git -C "$(brew --repo homebrew-cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
elif [ "$TARGET" = 'a' ]
then
git -C "$(brew --repo)" remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
git -C "$(brew --repo homebrew-core)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
git -C "$(brew --repo homebrew-cask)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-cask.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-cask.git
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles
else
exit 0

View File

@ -1,9 +1,11 @@
#!/bin/bash
echo "=== Please run with 'source proxy.sh', otherwise it has no effect on the current shell"
if [ -n "$1" ]; then
proxySwitch="$1"
else
echo "=== 开启或关闭网络代理? s or 1 for start, t or 0 for terminate, anything else for no change."
echo "=== 开启或关闭网络代理? [s/1] for start, [t/0] for terminate, [anything else] for no change."
read -p ">>> " proxySwitch
fi