Skip to content

Instantly share code, notes, and snippets.

@lusis
Forked from jtimberman/gist:881058
Created March 22, 2011 11:14
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save lusis/881068 to your computer and use it in GitHub Desktop.
Save lusis/881068 to your computer and use it in GitHub Desktop.
bash -c '
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
yum install -q -y sudo gcc gcc-c++ automake autoconf make readline-devel.x86_64 libffi-devel.x86_64 libyaml-devel.x86_64 zlib-devel.x86_64 openssl-devel.x86_64 wget
# This may not be necessary for you
yum remove -q -y ruby-libs ec2-ami-tools
wget http://someurl.domain.com/ruby-1.9.2p180_x86_64.rpm -O /tmp/ruby-1.9.2p180_x86_64.rpm
yum localinstall --nogpgcheck -q -y /tmp/ruby-1.9.2p180_x86_64.rpm
if [ -f "/root/.gemrc" ]; then mv /root/.gemrc /root/.gemrc.orig; fi
gem update --system
gem update --no-ri --no-rdoc
gem install encrypted_strings ohai chef --no-rdoc --no-ri --verbose <%= '--prerelease' if @config[:prerelease] %>
mkdir -p /etc/chef
(
cat <<'EOP'
<%= IO.read(Chef::Config[:validation_key]) %>
EOP
) > /tmp/validation.pem
awk NF /tmp/validation.pem > /etc/chef/validation.pem
rm /tmp/validation.pem
(
cat <<'EOP'
log_level :info
log_location STDOUT
chef_server_url "<%= Chef::Config[:chef_server_url] %>"
validation_client_name "<%= Chef::Config[:validation_client_name] %>"
<% if @config[:chef_node_name] == nil %>
# Using default node name"
<% else %>
node_name "<%= @config[:chef_node_name] %>"
<% end %>
EOP
) > /etc/chef/client.rb
(
cat <<'EOP'
<%= { "run_list" => @run_list }.to_json %>
EOP
) > /etc/chef/first-boot.json
export PATH=$PATH:/usr/sbin/
/usr/bin/chef-client -j /etc/chef/first-boot.json'
# Packaging ruby with fpm is a bit meta
# You need ruby install to use fpm
# I used an RVM install on a VM install fpm in a packaging gemset
# Install EPEL if you don't have it already
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
# Install deps for ruby build
yum install rpm-build readline-devel.x86_64 libffi-devel.x86_64 libyaml-devel.x86_64 zlib-devel.x86_64 openssl-devel.x86_64
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz
tar -zxvf ruby-1.9.2-p180.tar.gz
cd src/ruby-1.9.2-p180
time (./configure --prefix=/usr && make && make install DESTDIR=/tmp/installdir)
fpm --prefix=/ -s dir -t rpm -n ruby -v 1.9.2p180 -C /tmp/installdir \
-p ruby-VERSION_ARCH.rpm \
-d "libstdc++ >= 4.1.2" \
-d "glibc >= 2.5" \
-d "libffi >= 3.0.5" \
-d "zlib >= 1.2.3" \
-d "readline >= 5.1" \
-d "libyaml >= 0.1.2" \
-d "openssl >= 0.9.8"
# When you're done, upload the generated RPM somewhere that your bootstrap node can wget it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment