From c5a153f962ae0d248332ac4d6d18d98506df18ba Mon Sep 17 00:00:00 2001 From: Drew Short Date: Wed, 9 Sep 2015 16:17:07 -0500 Subject: [PATCH] Added a boostrapping script to convert an existing system to use the dotfile repository. --- bootstrap.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 bootstrap.sh diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..6c53e4d --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +# +# A script to convert the local system to use my dotfiles my local dotfiles over +# the provided ones already on the system. This script will backup any of the +# existing dot files, before linking to the ones in this repository. +# + +# Helper Functions + +# Make a backup of the existing file if it exists +# Then link to our supplied dotfile +link() { + if [ -f "$HOME/$1" ]; then + cp "$HOME/$1" "$HOME/$1.old" + echo "Backed up original $1 to $HOME/$1.old" + fi + ln -sf "$PWD/$2" "$HOME/$1" +} + +set -x +set -e + +# Configure .vimrc +link ".vimrc" "vimrc" + +# Configure .gitconfig +link ".gitconfig" "gitconfig"