Created
November 22, 2012 14:24
-
-
Save out-of-nice-names/4131420 to your computer and use it in GitHub Desktop.
basic provision for the newly-created os
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
#!/usr/bin/env bash | |
if [ -z "$RUBY_VERSION" ]; then | |
RUBY_VERSION='1.9.3-p327' | |
fi | |
which lsb_release > /dev/null | |
if [ $? -ne 0 ] || [ `lsb_release -s -i` != 'Ubuntu' ]; then | |
echo -e 'Sorry, this script only works in Ubuntu'; | |
exit 1 | |
fi | |
########## Cleanup of the box ########## | |
cd | |
if [ -d /opt/vagrant_ruby ]; then | |
echo "Removing Vagrant's embedded Ruby" | |
sudo rm -rf /opt/vagrant_ruby | |
fi | |
########## Install ubuntu packages ########## | |
echo 'deb mirror://mirrors.ubuntu.com/mirrors.txt precise main restricted universe multiverse | |
deb mirror://mirrors.ubuntu.com/mirrors.txt precise-updates main restricted universe multiverse | |
deb mirror://mirrors.ubuntu.com/mirrors.txt precise-backports main restricted universe multiverse | |
deb mirror://mirrors.ubuntu.com/mirrors.txt precise-security main restricted universe multiverse' \ | |
| sudo tee /etc/apt/sources.list > /dev/null | |
echo "Running apt-get update" | |
sudo apt-get update | |
echo "Installing packages" | |
sudo apt-get install -y build-essential openssl libreadline6 libreadline6-dev curl git zlib1g zlib1g-dev \ | |
libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev \ | |
automake libtool bison nodejs subversion | |
########## Install ruby ########## | |
echo "Installing Ruby" | |
cd | |
if [ ! -d "/tmp/ruby-build" ]; then | |
echo "Installing ruby-build to '/tmp/ruby-build'" | |
git clone git://github.com/sstephenson/ruby-build.git "/tmp/ruby-build" | |
pushd /tmp/ruby-build | |
sudo "./install.sh" | |
popd | |
fi | |
which ruby > /dev/null | |
if [ $? -ne 0 ]; then | |
echo "Installing Ruby $RUBY_VERSION." | |
sudo ruby-build "$RUBY_VERSION" /usr/local/ | |
fi | |
########## Install gems ########## | |
echo "install: --no-rdoc --no-ri | |
update: --no-rdoc --no-ri" | sudo tee "/usr/local/etc/gemrc" > /dev/null | |
gem list --local | grep -q bundler | |
if [ $? -ne 0 ]; then | |
echo 'Installing bundler' | |
sudo gem install bundler > /dev/null | |
fi | |
gem list --local | grep -q chef | |
if [ $? -ne 0 ]; then | |
echo "Installing Chef" | |
sudo gem install chef | |
fi | |
gem list --local | grep -q librarian | |
if [ $? -ne 0 ]; then | |
echo "Installing Librarian" | |
sudo gem install librarian | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment