Instantly share code, notes, and snippets.

@zenhob /-
Created Feb 4, 2014

Embed
What would you like to do?
#!/bin/sh
#
# Patches and installs Ruby to expose OpenSSL context options, using rbenv.
#
# Based on http://philippe.bourgau.net/how-to-install-a-patched-ruby-interpreter-wit/
#
VERSION=2.0.0-p247
PATCH_URL="https://bugs.ruby-lang.org/attachments/download/4210/0001-Expose-the-SSLContext-options-attribute-in-Net-HTTP.patch"
PATCH_NAME=ssloptions
mkdir /tmp/ruby-build-patch
cd /tmp/ruby-build-patch
wget http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-${VERSION}.tar.gz
tar xzf ruby-${VERSION}.tar.gz
cd ruby-$VERSION
curl $PATCH_URL | patch -p1
cd ..
mv ruby-$VERSION ruby-$VERSION-$PATCH_NAME
tar -cvf ruby-$VERSION-$PATCH_NAME.tar.gz ruby-$VERSION-$PATCH_NAME
wget https://raw.github.com/sstephenson/ruby-build/master/share/ruby-build/$VERSION
sed "s|\"ruby-${VERSION}.*|\"ruby-${VERSION}-${PATCH_NAME}\" \"file:///tmp/ruby-build-patch/ruby-${VERSION}-${PATCH_NAME}.tar.gz\"|" < $VERSION > $VERSION-$PATCH_NAME
rbenv install /tmp/ruby-build-patch/$VERSION-$PATCH_NAME
cd /tmp
rm -rf ruby-build-patch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment