dotfiles/setup
2012-11-18 19:39:39 -05:00

171 lines
5.5 KiB
Bash
Executable file

#!/bin/bash
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 macvim memcached multitail mysql nginx nmap redis ssh-copy-id wget flex_sdk postgresql p7zip
# Allows htop to show all processes
sudo chown root:wheel /usr/local/Cellar/htop-osx/0.8.2/bin/htop
sudo chmod u+s /usr/local/Cellar/htop-osx/0.8.2/bin/htop
# # Initializes databases
# mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
# initdb /usr/local/var/postgres
# # 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 as an Apache module
# brew install php53 --with-mysql --with-suhosin
# sudo cp /usr/local/Cellar/php53/5.3.16/libexec/apache2/libphp5.so /usr/libexec/apache2/libphp5.so
# brew remove php53
#
# # Installs PHP for Nginx (via FPM)
# brew install php53 --with-fpm --with-mysql --with-pgsql --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
else
# Gives us access to `add-apt-repository`
sudo apt-get install python-software-properties
# # Adds the PostgreSQL repository so we can install 9.2
# sudo add-apt-repository ppa:pitti/postgresql
#
# # Updates the package list
# sudo apt-get update
#
# # Purges PostgreSQL 9.1 just in case
# # Seems this tries to remove 9.2 as well, leaving in just in case I need to run it
# # sudo apt-get --purge remove postgresql postgresql-9.1 postgresql-client-9.1 postgresql-client-common postgresql-common postgresql-doc postgresql-doc-9.1
#
# # 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 redis-server memcached php5-memcache php5-memcached php5-gd php5-curl php5-imagick php5-pgsql exim4-daemon-light postgresql-9.2
fi
# Links .vimrc
if [ -e ~/.vimrc ] || [ -h ~/.vimrc ];
then
rm ~/.vimrc
fi
ln -s $DOTFILES/vimrc ~/.vimrc
# Pulls down and installs vim plugins
DOTVIM=~/.vim
if [ -d $DOTVIM ];
then
rm -r $DOTVIM
fi
mkdir $DOTVIM
OWNERS=( "ervandew" "msanders" "scrooloose" "scrooloose" "tpope" "vim-scripts" "vim-scripts" )
REPOS=( "supertab" "snipmate.vim" "nerdtree" "syntastic" "vim-fugitive" "Command-T" "Flex-Development-Support" )
for (( i = 0; i < ${#OWNERS[@]}; i++ ))
do
cp -R $DOTFILES/vim/plugins/${OWNERS[$i]}/${REPOS[$i]}/* $DOTVIM
done
cp $DOTFILES/vim/less.vim $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
echo; echo "SETUP COMPLETE!!~!"