dotfiles/setup
2013-12-14 15:36:03 -05:00

176 lines
5.4 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
git submodule init
git submodule update --remote
DOTFILES="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Links .gitconfig
if [ -e ~/.gitconfig ] || [ -h ~/.gitconfig ];
then
rm ~/.gitconfig
fi
ln -s $DOTFILES/git/gitconfig ~/.gitconfig
if [ `uname` == 'Darwin' ];
then
# Links .gitshots
if [ -e ~/.gitshots ] || [ -h ~/.gitshots ];
then
ln -s ~/Dropbox/Pictures/Git\ Shots ~/.gitshots
fi
# Initialize the `locate` database
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
# Installs Homebrew
if [ `which brew` == '' ];
then
ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
mkdir -p ~/Library/LaunchAgents
fi
# Gets our `brew` on
brew install bash-completion git htop imagemagick imagesnap vim macvim \
memcached multitail mysql nginx nmap redis ssh-copy-id wget \
p7zip node npm
# Allows htop to show all processes
# TODO Need to find a better way to run these that sniffs the current version
sudo chown root:wheel /usr/local/Cellar/htop-osx/0.8.2.2/bin/htop
sudo chmod u+s /usr/local/Cellar/htop-osx/0.8.2.2/bin/htop
# TODO Establish some conditionals so this isn't run all the time
# # Initializes databases
# mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
# # Sets up our LaunchAgent
# launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist
# cp /usr/local/Cellar/memcached/1.4.15/homebrew.mxcl.memcached.plist ~/Library/LaunchAgents/
# launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist
#
# launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
# cp /usr/local/Cellar/redis/2.4.17/homebrew.mxcl.redis.plist ~/Library/LaunchAgents/
# launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
#
# launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
# cp /usr/local/Cellar/postgresql/9.2.1/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
# launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
#
# # `brew`s up some PHP 5.3
# brew tap homebrew/dupes
# brew tap josegonzalez/homebrew-php
#
# # Backs up the stock OSX version of PHP
# if [ ! -f /usr/libexec/apache2/libphp5.so.orig ];
# then
# sudo mv /usr/libexec/apache2/libphp5.so /usr/libexec/apache2/libphp5.so.orig
# fi
#
# brew remove php53
# rm ~/.pearrc
# launchctl unload -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php53.plist
# rm ~/Library/LaunchAgents/homebrew-php.josegonzalez.php53.plist
#
# # Installs PHP for Nginx (via FPM)
# brew install php53 --with-fpm --with-mysql --with-suhosin
# cp /usr/local/Cellar/php53/5.3.16/homebrew-php.josegonzalez.php53.plist ~/Library/LaunchAgents/
# launchctl load -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php53.plist
#
# # Gets PHP how we like it
# brew install php53-imagick php53-mcrypt php53-memcache php53-xdebug --with-homebrew-php
#
# # Adds some PEAR to the recipe
# pear update-channels
# sudo pear upgrade-all
# sudo pear channel-discover pear.phpunit.de
# sudo pear channel-discover components.ez.no
# sudo pear channel-discover pear.symfony.com
# sudo pear install --alldeps phpunit/PHPUnit
# sudo pear install --alldeps phpdocumentor
# Links the homebrew apps
#brew linkapps
# Installs git hooks
sudo ln -s $PWD/git/hooks/post-commit \
/usr/local/share/git-core/templates/hooks/post-commit
# Go mining for some gems
sudo gem install terminal-notifier sass
# Installs LESS (with CLI lessc)
npm install -g less@1.3
else
sudo apt-get install python-software-properties zsh
chsh -s /bin/zsh josh
# Adds PPA to get nginx to a more recent stable release
sudo add-apt-repository ppa:nginx/stable && apt-get update
# Installs CLI apps
sudo apt-get install vim ssh multitail htop iotop git-core ruby1.8-dev \
nginx php5 php5-cgi php5-cli php-pear php5-suhosin \
php5-fpm php5-dev redis-server memcached \
php5-memcache php5-memcached php5-gd php5-curl \
php5-imagick exim4-daemon-light
fi
# Links .vimrc
if [ -e ~/.vimrc ] || [ -h ~/.vimrc ];
then
rm ~/.vimrc
fi
ln -s $DOTFILES/vim/vimrc ~/.vimrc
# Gets our Vundle on!
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
vim +BundleInstall +qall
mkdir $DOTVIM/colors
cp -R $DOTFILES/vim/colors/* $DOTVIM/colors
cp -R $DOTFILES/vim/syntax/* $DOTVIM/syntax
# Finish up Command-T installation
cd $DOTVIM/ruby/command-t
ruby extconf.rb
make
# Installs Oh my zsh!
if [ ! -d ~/.oh-my-zsh ];
then
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
fi
# Links theme
if [ -e ~/.oh-my-zsh/themes/joshtronic.zsh-theme ] || [ -h ~/.oh-my-zsh/themes/joshtronic.zsh-theme ];
then
rm ~/.oh-my-zsh/themes/joshtronic.zsh-theme
fi
ln -s $DOTFILES/zsh/zsh-theme ~/.oh-my-zsh/themes/joshtronic.zsh-theme
# Links .zshrc
if [ -e ~/.zshrc ] || [ -h ~/.zshrc ];
then
rm ~/.zshrc
fi
ln -s $DOTFILES/zsh/zshrc ~/.zshrc
# TODO Move away from submodule and add logic to only do this if it's me
# Perhaps only run this is the dotfiles-private directory is avail
# Links .zshrc-private
if [ -e ~/.zshrc-private ] || [ -h ~/.zshrc-private ];
then
rm ~/.zshrc-private
fi
if [ -e $DOTFILES/private/zsh/zshrc ]
then
ln -s $DOTFILES/private/zsh/zshrc ~/.zshrc-private
fi
echo; echo 'WERE GOLDEN!'