Created
November 12, 2014 07:01
-
-
Save lancelakey/8f87479e0a43961db78e to your computer and use it in GitHub Desktop.
FPM Ruby 2.0.x
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 | |
# Target OS: Debian | |
# On a new / clean installation of debian squeeze | |
# Install Ruby from source | |
# Create a Debian package using FPM | |
# Update apt | |
apt-get update -y | |
# Install FPM dependencies | |
# We need Ruby in order to use FPM | |
apt-get install -y ruby2.0 ruby2.0-dev | |
# Install FPM | |
gem2.0 install fpm --no-ri --no-rdoc | |
# Install dependencies for compiling Ruby | |
# apt-get install -y ruby-dev python-dev python-setuptools bison autoconf | |
apt-get install -y build-essential autoconf openssl \ | |
libffi-dev libgdbm-dev libreadline6-dev zlib1g-dev libssl-dev ncurses-dev libyaml-dev | |
# Download Ruby source | |
VERSION=2.0.0-p353 | |
url=ftp://ftp.ruby-lang.org/pub/ruby/ruby-$VERSION.tar.gz | |
tarfile=${url##*/} | |
dir=${tarfile%.tar.gz} | |
cd /tmp/ | |
wget "$url" | |
tar zxvf "$tarfile" | |
cd "$dir" | |
# Compile Ruby | |
rm -rf /tmp/fpm_installdir | |
time (make clean ; make distclean ; ./configure --prefix=/usr --disable-install-doc && make --jobs && make install DESTDIR=/tmp/fpm_installdir) | |
# Create a Debian package using FPM | |
cd /tmp/ | |
fpm \ | |
-s dir \ | |
-t deb \ | |
-C /tmp/fpm_installdir \ | |
--name ruby$VERSION \ | |
--version $VERSION \ | |
--vendor "Lance Lakey" \ | |
--maintainer "Lance Lakey <[email protected]>" \ | |
--description "Ruby $VERSION Packaged by Lance Lakey" \ | |
--url http://www.ruby-lang.org/ \ | |
--package /tmp/ruby-VERSION_ARCH.deb \ | |
-d "libc6-dev" \ | |
-d "libffi-dev" \ | |
-d "libgdbm-dev" \ | |
-d "libncurses5-dev" \ | |
-d "libreadline-dev" \ | |
-d "libssl-dev" \ | |
-d "libyaml-dev" \ | |
-d "zlib1g-dev" \ | |
usr/bin usr/lib usr/share/man usr/include | |
# Post installation test | |
cd /tmp/ | |
# Remove all ruby related packages | |
apt-get -qy purge $(dpkg -l | grep -i ruby | cut -d " " -f 3) | |
echo "About to install package" | |
echo `pwd` | |
dpkg -i /tmp/ruby-$VERSION\_amd64.deb | |
ruby -ropenssl -rzlib -rreadline -ryaml -e "puts :success" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment