Created
July 23, 2012 20:22
-
-
Save dipth/3166017 to your computer and use it in GitHub Desktop.
Bootstrap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
DROPBOX_PATH=~/Dropbox | |
############################################################################### | |
# Dropbox | |
############################################################################### | |
echo "Checking for existing Dropbox installation..." | |
if [ -d $DROPBOX_PATH ] | |
then | |
echo "Found!" | |
DROPBOX_INSTALLED=true | |
else | |
echo "Not Found!" | |
read -n1 -p "Download Dropbox? (y/n)" | |
echo | |
if [ "$REPLY" = 'y' ] | |
then | |
echo | |
echo "Downloading Dropbox..." | |
curl -L -o Dropbox.dmg https://www.dropbox.com/download\?plat\=mac | |
echo "Launching Dropbox installer..." | |
open Dropbox.dmg | |
echo "Press any key when Dropbox is installed and ready..." | |
read -n1 | |
echo | |
DROPBOX_INSTALLED=true | |
else | |
DROPBOX_INSTALLED=false | |
fi | |
fi | |
############################################################################### | |
# Command Line Tools for Xcode | |
############################################################################### | |
echo "Checking for existing Command Line Tools for Xcode installation..." | |
if which gcc &> /dev/null | |
then | |
echo "Found!" | |
CLT_INSTALLED=true | |
else | |
echo "Not Found!" | |
read -n1 -p "Install Command Line Tools for Xcode? (y/n)" | |
echo | |
if [ "$REPLY" = 'y' ] | |
then | |
echo | |
open https://developer.apple.com/downloads | |
echo "Please log in and download the Command Line Tools." | |
echo "Press any key to continue..." | |
echo | |
read -n1 | |
CLT_INSTALLED=true | |
else | |
CLT_INSTALLED=false | |
fi | |
fi | |
############################################################################### | |
# Homebrew | |
# | |
# Dependencies: | |
# - Command Line Tools for Xcode | |
############################################################################### | |
if $CLT_INSTALLED | |
then | |
echo "Checking for existing Homebrew installation..." | |
if which brew &> /dev/null | |
then | |
echo "Found!" | |
HOMEBREW_INSTALLED=true | |
else | |
echo "Not Found!" | |
read -n1 -p "Install Homebrew? (y/n)" | |
echo | |
if [ "$REPLY" = 'y' ] | |
then | |
echo "Downloading and installing Homebrew" | |
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)" | |
HOMEBREW_INSTALLED=true | |
else | |
HOMEBREW_INSTALLED=false | |
fi | |
fi | |
else | |
echo "Skipping Homebrew (Requires: Command Line Tools for Xcode)" | |
HOMEBREW_INSTALLED=false | |
fi | |
############################################################################### | |
# rbenv | |
# | |
# Dependencies: | |
# - Homebrew | |
############################################################################### | |
if $HOMEBREW_INSTALLED | |
then | |
echo "Checking for existing rbenv installation..." | |
if which rbenv &> /dev/null | |
then | |
echo "Found!" | |
RBENV_INSTALLED=true | |
else | |
echo "Not Found!" | |
read -n1 -p "Install rbenv? (y/n)" | |
echo | |
if [ "$REPLY" = 'y' ] | |
then | |
echo | |
echo "Downloading and installing rbenv and ruby-build" | |
brew install rbenv ruby-build | |
RBENV_INSTALLED=true | |
else | |
RBENV_INSTALLED=false | |
fi | |
fi | |
else | |
echo "Skipping rbenv (Requires: Homebrew)" | |
RBENV_INSTALLED=false | |
fi | |
############################################################################### | |
# grc | |
# | |
# Dependencies: | |
# - Homebrew | |
############################################################################### | |
if $HOMEBREW_INSTALLED | |
then | |
echo "Checking for existing GRC installation..." | |
if which grc &> /dev/null | |
then | |
echo "Found!" | |
GRC_INSTALLED=true | |
else | |
echo "Not Found!" | |
read -n1 -p "Install grc? (y/n)" | |
echo | |
if [ "$REPLY" = 'y' ] | |
then | |
echo | |
echo "Downloading and installing grc" | |
brew install grc | |
GRC_INSTALLED=true | |
else | |
GRC_INSTALLED=false | |
fi | |
fi | |
else | |
echo "Skipping grc (Requires: Homebrew)" | |
GRC_INSTALLED=false | |
fi | |
############################################################################### | |
# Git | |
# | |
# Dependencies: | |
# - Homebrew | |
############################################################################### | |
if $HOMEBREW_INSTALLED | |
then | |
echo "Checking for existing Git installation" | |
if [ `which git` = '/usr/local/bin/git' ] | |
then | |
echo "Found!" | |
GIT_INSTALLED=true | |
else | |
echo "Not Found!" | |
read -n1 -p "Install Git? (y/n)" | |
echo | |
if [ "$REPLY" = 'y' ] | |
then | |
echo | |
echo "Downloading and installing git" | |
brew install git | |
GIT_INSTALLED=true | |
else | |
GIT_INSTALLED=false | |
fi | |
fi | |
else | |
echo "Skipping Git (Requires: Homebrew)" | |
GIT_INSTALLED=false | |
fi | |
if $DROPBOX_INSTALLED && $GIT_INSTALLED | |
then | |
if [[ `readlink ~/.gitconfig` =~ Dropbox\/Configuration\/dotfiles\/\.gitconfig ]] | |
then | |
echo "Skipping .gitconfig - Already symlinked from Dropbox" | |
else | |
read -n1 -p "Use .gitconfig from Dropbox? (y/n)" | |
echo | |
if [ "$REPLY" = 'y' ] | |
then | |
if [ -e ~/.gitconfig ] | |
then | |
echo "Removing existing .gitconfig" | |
rm ~/.gitconfig | |
fi | |
echo "Symlinking ~/.gitconfig from Dropbox" | |
ln -s ~/Dropbox/Configuration/dotfiles/.gitconfig ~/.gitconfig | |
fi | |
fi | |
fi | |
############################################################################### | |
# Oh My ZSH | |
############################################################################### | |
echo "Checking for existing oh-my-zsh installation..." | |
if [ -d $ZSH ] | |
then | |
echo "Found!" | |
OMZSH_INSTALLED=true | |
else | |
echo "Not Found!" | |
read -n1 -p "Install oh-my-zsh? (y/n)" | |
echo | |
if [ "$REPLY" = 'y' ] | |
then | |
echo | |
echo "Downloading and installing oh-my-zsh" | |
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh | |
OMZSH_INSTALLED=true | |
else | |
OMZSH_INSTALLED=false | |
fi | |
fi | |
if $DROPBOX_INSTALLED && $OMZSH_INSTALLED | |
then | |
if [[ `readlink ~/.zshrc` =~ Dropbox\/Configuration\/dotfiles\/\.zshrc ]] | |
then | |
echo "Skipping .zshrc - Already symlinked from Dropbox" | |
else | |
read -n1 -p "Use .zshrc from Dropbox? (y/n)" | |
echo | |
if [ "$REPLY" = 'y' ] | |
then | |
if [ -e ~/.zshrc ] | |
then | |
echo "Removing existing .zshrc" | |
rm ~/.zshrc | |
fi | |
echo "Symlinking ~/.zshrc from Dropbox" | |
ln -s ~/Dropbox/Configuration/dotfiles/.zshrc ~/.zshrc | |
fi | |
fi | |
fi | |
############################################################################### | |
# iTerm | |
############################################################################### | |
echo "Checking for existing iterm installation..." | |
if [ -e /Applications/iTerm.app ] | |
then | |
echo "Found!" | |
ITERM_INSTALLED=true | |
else | |
echo "Not Found!" | |
read -n1 -p "Install iterm? (y/n)" | |
echo | |
if [ "$REPLY" = 'y' ] | |
then | |
echo | |
open http://code.google.com/p/iterm2/downloads/list | |
echo "Please download and install iTerm." | |
echo "Press any key to continue..." | |
echo | |
read -n1 | |
ITERM_INSTALLED=true | |
else | |
ITERM_INSTALLED=false | |
fi | |
fi | |
if $DROPBOX_INSTALLED && $ITERM_INSTALLED | |
then | |
if [[ `readlink ~/Library/Preferences/com.googlecode.iterm2.plist` =~ Dropbox\/Configuration\/iTerm\/com\.googlecode\.iterm2\.plist ]] | |
then | |
echo "Skipping iTerm preferences - Already linked from Dropbox" | |
else | |
read -n1 -p "Use iTerm preferences from Dropbox? (y/n)" | |
echo | |
if [ "$REPLY" = 'y' ] | |
then | |
if [ -e ~/.zshrc ] | |
then | |
echo "Removing existing iTerm preferences" | |
rm ~/Library/Preferences/com.googlecode.iterm2.plist | |
fi | |
echo "Symlinking iTerm preferences from Dropbox" | |
ln -s ~/Dropbox/Configuration/iTerm/com.googlecode.iterm2.plist ~/Library/Preferences/com.googlecode.iterm2.plist | |
fi | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment