Skip to content

Instantly share code, notes, and snippets.

@lancelakey
Created September 16, 2012 01:40
Show Gist options
  • Save lancelakey/3730711 to your computer and use it in GitHub Desktop.
Save lancelakey/3730711 to your computer and use it in GitHub Desktop.
Create Ruby 1.9.3-rc1 Debian package using FPM
#!/usr/bin/env bash
# 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 ruby rubygems
# Install FPM
gem1.8 install fpm --no-ri --no-rdoc
# Install dependencies for compiling Ruby
apt-get install -y build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev ncurses-dev libyaml-dev
# Download Ruby source, compile Ruby
url=ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-rc1.tar.gz
tarfile=${url##*/}
dir=${tarfile%.tar.gz}
cd /tmp/
wget "$url"
tar zxvf "$tarfile"
cd "$dir"
rm -rf /tmp/installdir
time (./configure --prefix=/usr && make && make install DESTDIR=/tmp/installdir)
# Create a Debian package using FPM
cd /tmp/
/var/lib/gems/1.8/bin/fpm --name ruby1.9.3-rc1 --version 1.9.3-rc1 \
--vendor "Lance Lakey" \
--maintainer "Lance Lakey <[email protected]>" \
--description "Ruby 1.9.3-rc1 Packaged by Lance Lakey" \
--url http://www.ruby-lang.org/ \
-s dir -t deb \
-C /tmp/installdir \
--package /tmp/ruby-VERSION_ARCH.deb \
-d "libstdc++6 (>= 4.4.3)" \
-d "libc6 (>= 2.6)" -d "libffi5 (>= 3.0.4)" -d "libgdbm3 (>= 1.8.3)" \
-d "libncurses5 (>= 5.7)" -d "libreadline6 (>= 6.1)" \
-d "libssl0.9.8 (>= 0.9.8)" -d "zlib1g (>= 1:1.2.2)" \
-d "libyaml-0-2 (>= 0.1.3)" \
usr/bin usr/lib usr/share/man usr/include
# Post installation test
cd /tmp/
apt-get purge -y ruby rubygems
apt-get install -y libffi5 libyaml-0-2
echo "About to install package"
echo `pwd`
dpkg -i /tmp/ruby-1.9.3-rc1_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