#!/bin/bash ROOT="$(pwd)" # pre-run cleanup rm -rf bash/bash_magic vim/bundle/* "${HOME}"/.vimrc ### # shell ### # check for zsh, perform setup if it exists ZSH="$(which zsh)" if [ ! $? == 0 ]; then echo "Zsh not found, skipping shell setup" else echo "Zsh found, setting it as default shell" chsh -s $ZSH # install zimfw echo "Install zimfw?" read zfw if [ "$zfw" == "y" ]; then curl -fsSL https://raw.githubusercontent.com/zimfw/install/master/install.zsh | zsh fi fi ### # dotfiles ### # check for dotfiles, copy them to home if [ -d "${ROOT}/dotfiles" ]; then cd "${ROOT}/dotfiles" || exit for i in *; do # check if file exists, if so skip the copy if [ -f "${HOME}/.${i}" ]; then echo "File ${HOME}/.${i} already exists, skipping copy" else cp "${i}" "${HOME}/.${i}" fi done cd "${ROOT}" || exit fi ### # git ### # check for git GIT=$(which git) if [ ! $? == 0 ]; then echo "git not found, skipping git setup" else # add custom config and helpers cat "${ROOT}"/git/gitconfig >> "${HOME}"/.gitconfig cp "${ROOT}"/git/githelpers "${HOME}"/.githelpers # collect git user info, create config file echo "Enter you git auth details?" read GIT_AUTH if [ "$GIT_AUTH" == "y" ]; then echo -n "Enter your git name: " read NAME echo -n "Enter you git email: " read EMAIL git config --global user.name "${NAME}" git config --global user.email "${EMAIL}" fi fi ### # vim ### # install if [ -d "${HOME}/.vimrc" ]; then echo "Vim config already exists, skipping copy" else cp "${HOME}"/.vim/vimrc "${HOME}"/.vimrc fi echo Install complete, restart your terminal