#!/bin/bash echo "Setting up your dotfiles..." echo "---"; echo echo "You are: $USER"; echo cd ~ echo "What is your full name?" echo -n "> " read name echo "What is your email?" echo -n "> " read email echo "---"; echo # clone repo [ -d dotfiles ] && mv dotfiles dotfiles~ git clone https://github.com/kballenegger/dotfiles.git # move files in place for e in `ls -a dotfiles` ; do if [ "$e" != '.' -a "$e" != '..' ]; then [ -e "$e" ] && mv "$e" "$e~" mv "dotfiles/$e" "$e" fi done rm -rf dotfiles # everything has been moved, ~ is now a git repo :) # get submodules git submodule update --init --recursive # create a new branch git checkout -b "dotfiles-$USER" # replace gitconfig mv ~/.gitconfig ~/.gitconfig~ cp ~/.gitconfig.generic ~/.gitconfig sed -i '' -e "s/New User/$name/" ~/.gitconfig sed -i '' -e "s/email@domain.com/$email/" ~/.gitconfig git add ~/.gitconfig git commit -m "Updating .gitconfig for $USER""..." echo; echo; echo "---"; echo echo "All done... Enjoy!" echo "It is recommended that you change your shell to zsh for extra awesomeness:" echo " chsh -s /bin/zsh" echo "Also, please login again for changes to take effect."