Skip to content

Instantly share code, notes, and snippets.

@kmullin
Last active December 19, 2015 13:19
Show Gist options
  • Save kmullin/5961565 to your computer and use it in GitHub Desktop.
Save kmullin/5961565 to your computer and use it in GitHub Desktop.
script to install ruby from source curl -s https://gist.github.com/kmullin/5961565/raw/bootstrap_ruby.sh | bash -x
#!/bin/bash
RUBY_URL=${RUBY_URL:-"ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p429.tar.gz"}
RUBY_MD5=${RUBY_MD5:-"993c72f7f805a9eb453f90b0b7fe0d2b"}
LIBYAML_URL=${LIBYAML_URL:-"http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz"}
LIBYAML_MD5=${LIBYAML_MD5:-"36c852831d02cf90508c29852361d01b"}
get_source() {
# 1: url
# 2: md5
FILENAME=$(basename $1)
DIRNAME=$(basename $1 | cut -d . -f 1-3)
wget "$1" -O /tmp/$FILENAME && cd /tmp && \
if [ "$(md5sum $FILENAME | awk '{print $1}')" == "$2" ]; then
tar zfx $FILENAME && cd $DIRNAME && ./configure && make install && \
cd /tmp && rm -rf $FILENAME $DIRNAME
else
return 1
fi
}
get_source $LIBYAML_URL $LIBYAML_MD5 && \
get_source $RUBY_URL $RUBY_MD5 && \
gem install bundle unicorn --no-ri --no-rdoc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment