Skip to content

Instantly share code, notes, and snippets.

@kkdeploy
Created June 27, 2012 20:04
Show Gist options
  • Select an option

  • Save kkdeploy/3006511 to your computer and use it in GitHub Desktop.

Select an option

Save kkdeploy/3006511 to your computer and use it in GitHub Desktop.
rvm bootstrap
#!/bin/bash
DEFAULT_RUBY_VERSION="1.9.3-p125"
if [ -e /etc/redhat-release ]; then
echo "Rhel 5 based distr"
sudo yum update -y
sudo rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
sudo yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison git curl
else
echo "Debian based dist"
sudo apt-get update && sudo apt-get upgrade
sudo apt-get -y install curl git-core bzip2 build-essential zlib1g-dev libssl-dev autoconf
fi
if [ -x /usr/local/rvm/bin/rvm ]; then
echo "RVM Found..nothing to do";
else
echo "Installing RVM";
curl -L https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | sudo bash
has_rvm=`groups |grep -c rvm`;
if [ "$has_rvm" == "0" ]; then
sudo /usr/sbin/usermod -G `groups | tr ' ' ','`,rvm $USER
fi
fi
source /etc/profile
has_ruby_version=`rvm list | grep -c $DEFAULT_RUBY_VERSION`
if [ $has_ruby_version == "0" ]; then
rvm install $DEFAULT_RUBY_VERSION
rvm alias create default $DEFAULT_RUBY_VERSION
else
echo "RVM has already installed Ruby v$DEFAULT_RUBY_VERSION"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment