Files
macbook_installer/mac_os_setup.sh
2023-06-23 12:21:45 -04:00

150 lines
3.5 KiB
Bash

function exists() {
command -v "$1" >/dev/null 2>&1
}
function install_brew () {
if exists brew
then
echo "Brew already installed..."
else
echo "Installing Brew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/michaelmarquez/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
}
function install_visual_studio_code () {
if exists code
then
echo "Visual Studio Code already installed..."
else
echo "Installing Visual Studio Code..."
brew install --cask visual-studio-code
fi
}
function install_iterm2 () {
if [ $(mdfind "kMDItemCFBundleIdentifier == com.googlecode.iterm2" /Applications/iTerm.app) ]
then
echo "Iterm2 already installed..."
else
echo "Installing Iterm2..."
brew install --cask iterm2
fi
}
function install_powerline_fonts () {
git clone https://github.com/powerline/fonts.git --depth=1
cd fonts
./install.sh
cd ..
rm -rf fonts
}
# TODO: Use AWK to overwrite the ZSH_THEME
function install_ohmyzsh () {
if [ -d $HOME/.oh-my-zsh ]
then
echo "Ohmyzsh already installed..."
else
echo "Installing Ohmyzsh..."
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
echo >> ~/.zshrc
echo "# Remove Host Text from Terminal" >> ~/.zshrc
echo "prompt_context() {}" >> ~/.zshrc
sed 's/^ZSH_THEME="robbyrusell"/ZSH_THEME="agnoster"/' ~/.zshrc
install_powerline_fonts
fi
}
function install_hackfont () {
if [[ $(ls ~/Library/Fonts/ | grep -i "hack") ]]
then
echo "Hack Font Already Installed..."
else
echo "Installing Hack Font..."
brew tap homebrew/cask-fonts
brew install --cask font-hack-nerd-font
fi
}
function install_docker () {
if exists docker
then
echo "Docker already installed..."
else
echo "Installing Docker..."
brew install --cask docker
fi
}
function install_1password() {
if [[ $(find /Applications -name "1Password.app" | grep .) ]]
then
echo "1Password already installed..."
else
echo "Installing 1Password..."
brew install --cask 1password
fi
}
function install_brave() {
if [[ $(find /Applications -name "Brave Browser.app" | grep .) ]]
then
echo "Brave already installed..."
else
echo "Installing Brave..."
brew install --cask brave-browser
fi
}
function install_1password_cli() {
if exists op
then
echo "1password CLI already installed..."
else
echo "Installing 1Password CLI..."
brew install --cask 1password/tap/1password-cli
fi
}
function install_fantastical() {
if [[ $(find /Applications -name "Fantastical.app" | grep .) ]]
then
echo "Fantastical already installed..."
else
echo "Installing Fantastical..."
brew install --cask fantastical
fi
}
function install_spotify() {
if [[ $(find /Applications -name "Spotify.app" | grep .) ]]
then
echo "Spotify already installed..."
else
echo "Installing Spotify..."
brew install --cask spotify
fi
}
#############################
# MAIN #
#############################
echo "==========================================================="
echo " STARTING APP INSTALLATION"
echo "==========================================================="
install_brew
install_visual_studio_code
install_iterm2
install_ohmyzsh
install_hackfont
install_docker
install_1password
install_brave
install_1password_cli
install_fantastical
install_spotify