mirror of
https://github.com/nmasur/dotfiles
synced 2024-12-27 05:14:53 +00:00
95 lines
2.0 KiB
Bash
Executable File
95 lines
2.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
DOTS=$(dirname "$0")/..
|
|
cd "$DOTS" || (echo "Directory not found: $DOTS"; exit 1)
|
|
DOTS="$PWD"
|
|
|
|
check_for_zsh() {
|
|
if ! (echo "$SHELL" | grep zsh > /dev/null)
|
|
then
|
|
echo "Switch to using zsh before continuing"
|
|
echo ""
|
|
echo "MacOS Instructions:"
|
|
echo "System Preferences > Users & Groups > Unlock"
|
|
echo "Right-click on user, Advanced Options..."
|
|
echo "Login shell: /bin/zsh"
|
|
exit 1
|
|
fi
|
|
|
|
echo "zsh ✓"
|
|
}
|
|
|
|
check_for_ohmyzsh() {
|
|
if [ ! -d ~/.oh-my-zsh ]
|
|
then
|
|
echo "oh-my-zsh ✕"
|
|
echo ""
|
|
echo "Install oh-my-zsh before continuing"
|
|
echo "You can run the script: install_ohmyzsh"
|
|
echo ""
|
|
exit 1
|
|
fi
|
|
|
|
echo "oh-my-zsh ✓"
|
|
}
|
|
|
|
install_xcode() {
|
|
if [ "$(uname)" = "Darwin" ]
|
|
then
|
|
if ! (xcode-select --version > /dev/null 2>&1)
|
|
then
|
|
xcode-select --install
|
|
fi
|
|
echo "xcode ✓"
|
|
fi
|
|
}
|
|
|
|
install_homebrew() {
|
|
if ! (which /usr/local/bin/brew > /dev/null)
|
|
then
|
|
printf "homebrew ✕\n\n"
|
|
printf "\ninstalling homebrew..."
|
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
|
|
echo ""
|
|
fi
|
|
|
|
echo "homebrew ✓"
|
|
}
|
|
|
|
install_brews() {
|
|
brewfile=$DOTS/homebrew/Brewfile
|
|
if ! (/usr/local/bin/brew bundle check --file "$brewfile" > /dev/null)
|
|
then
|
|
/usr/local/bin/brew bundle --file "$brewfile"
|
|
fi
|
|
|
|
echo "brews installed ✓"
|
|
}
|
|
|
|
install_spacemacs() {
|
|
emacsdir=~/.emacs.d
|
|
if ! (git -C "$emacsdir" pull > /dev/null 2>&1)
|
|
then
|
|
git clone -b develop https://github.com/syl20bnr/spacemacs "$emacsdir"
|
|
fi
|
|
|
|
echo "spacemacs ✓"
|
|
}
|
|
|
|
printf "\nbootstrapping...\n\n"
|
|
check_for_zsh
|
|
check_for_ohmyzsh
|
|
install_xcode
|
|
install_homebrew
|
|
install_brews
|
|
install_spacemacs
|
|
("$DOTS/scripts/setup_symlinks")
|
|
|
|
echo ""
|
|
echo "consider running other scripts:"
|
|
echo " - configure_macos"
|
|
echo " - setup_keybase"
|
|
echo " - install_python"
|
|
echo " - install_rust"
|
|
echo ""
|