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

This commit is contained in:
Anton Shubin 2022-01-27 19:00:14 +03:00 committed by GitHub
commit 6748b510b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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