From ff3b0b84d162f7674385305c22f611672030feea Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Wed, 11 Aug 2010 11:21:54 -0700 Subject: [PATCH] added a script to get up and running on a new box (overlaps with link-config-files) --- newbox | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 newbox diff --git a/newbox b/newbox new file mode 100755 index 0000000..6765140 --- /dev/null +++ b/newbox @@ -0,0 +1,32 @@ +#!/bin/sh + +fail() { + echo "error: $@" + exit 1 +} + +if ! which git >/dev/null 2>&1; then + if which aptitude >/dev/null 2>&1; then + sudo aptitude install git-core + elif which brew >/dev/null 2>&1; then + brew install git-core + else + echo "Don't know how to install git on this box. Install git and run this again." + exit 1 + fi +fi + +cd ~ +git clone git://github.com/samsonjs/config || fail "cannot clone config repo" + +for FILE in config/*; do + pushd "$HOME" + DOTFILE=".${FILE##*/}" + if [[ -e "$DOTFILE" ]]; then + mkdir original-dot-files >/dev/null 2>/dev/null + echo "Existing file found at $DOTFILE, moving to ~/original-dot-files." + mv "$DOTFILE" original-dot-files/ + fi + ln -s "$FILE" "$DOTFILE" + popd +done