fix(install.sh): fix paths to Brew, return to current folder after execute .zshrc

This commit is contained in:
Artem 2022-01-27 17:44:32 +03:00
parent 300d9bf7d8
commit 451d1e8378

View File

@ -1,10 +1,12 @@
#!/bin/bash
set -e
script_dir="$PWD"
echo '▶️ Installing Brew...'
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
echo 'eval "$($(brew --prefix)/bin/brew shellenv)"' >> ~/.zprofile
eval "$($(brew --prefix)/bin/brew shellenv)"
echo '✅ Brew installation complete \n'
echo '▶️ Installing Apps with Brew...'
@ -17,8 +19,8 @@ echo '✅ Apps installation complete \n'
echo '▶️ Installing Node.js via NVM...'
# Put NVM dir into .zshrc
echo 'export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && . "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && . "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion' >> ~/.zshrc
[ -s "$(brew --prefix)/opt/nvm/nvm.sh" ] && \. "$(brew --prefix)/opt/nvm/nvm.sh" # This loads nvm
[ -s "$(brew --prefix)/opt/nvm/etc/bash_completion.d/nvm" ] && \. "$(brew --prefix)/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion' >> ~/.zshrc
source ~/.zshrc
# Install Node.js
nvm install node
@ -26,6 +28,7 @@ npm i -g yarn
echo '✅ Node.js installation complete \n'
echo '▶️ Configuring custom Spy4x theme for Oh-my-zsh...'
cd "$script_dir"
cp -R oh-my-zsh-theme/* ~/.oh-my-zsh/custom/
echo 'ZSH_THEME="spy4x"' >> ~/.zshrc
echo 'source $ZSH/oh-my-zsh.sh' >> ~/.zshrc