Skip to content

Commit

Permalink
Add squeeze32 template with package-installed ruby.
Browse files Browse the repository at this point in the history
  • Loading branch information
fnichol authored and jedi4ever committed Apr 27, 2011
1 parent 6a16d25 commit 678887a
Show file tree
Hide file tree
Showing 3 changed files with 415 additions and 0 deletions.
42 changes: 42 additions & 0 deletions templates/Debian-6.0-i386-netboot-rbapt/definition.rb
@@ -0,0 +1,42 @@
Veewee::Session.declare( {
:cpu_count => '1',
:memory_size=> '256',
:disk_size => '10140',
:disk_format => 'VDI',
:disk_size => '10240' ,
:os_type_id => 'Debian',
:iso_file => "debian-6.0.0-i386-netinst.iso",
:iso_src => "http://ftp.acc.umu.se/debian-cd/current/i386/iso-cd/debian-6.0.0-i386-netinst.iso",
:iso_md5 => "2840eea06e9cdd2e125f32cefa25fa1d",
:iso_download_timeout => "1000",
:boot_wait => "10",:boot_cmd_sequence => [
'<Esc>',
'install ',
'preseed/url=http://%IP%:%PORT%/preseed.cfg ',
'debian-installer=en_US ',
'auto ',
'locale=en_US ',
'kbd-chooser/method=us ',
'netcfg/get_hostname=%NAME% ',
'netcfg/get_domain=vagrantup.com ',
'fb=false ',
'debconf/frontend=noninteractive ',
'console-setup/ask_detect=false ',
'console-keymaps-at/keymap=us ',
'<Enter>'
],
:kickstart_port => "7122",
:kickstart_timeout => "10000",
:kickstart_file => "preseed.cfg",
:ssh_login_timeout => "10000",
:ssh_user => "vagrant",
:ssh_password => "vagrant",
:ssh_key => "",
:ssh_host_port => "7222",
:ssh_guest_port => "22",
:sudo_cmd => "echo '%p'|sudo -S sh '%f'",
:shutdown_cmd => "halt -p",
:postinstall_files => [ "postinstall.sh" ],
:postinstall_timeout => "10000"
}
)
61 changes: 61 additions & 0 deletions templates/Debian-6.0-i386-netboot-rbapt/postinstall.sh
@@ -0,0 +1,61 @@
#http://adrianbravo.tumblr.com/post/644860401

# Update the box
apt-get -y update
apt-get -y install linux-headers-$(uname -r) build-essential
apt-get -y install zlib1g-dev libssl-dev libreadline5-dev
apt-get -y install curl unzip
apt-get clean

# Set up sudo
cp /etc/sudoers /etc/sudoers.orig
sed -i -e 's/%sudo ALL=(ALL) ALL/%sudo ALL=NOPASSWD:ALL/g' /etc/sudoers

# Install Ruby from packages
apt-get -y install ruby ruby-dev libopenssl-ruby1.8 irb ri rdoc

# Install Rubygems from source
rg_ver=1.6.2
curl -o /tmp/rubygems-${rg_ver}.zip \
"http://production.cf.rubygems.org/rubygems/rubygems-${rg_ver}.zip"
(cd /tmp && unzip rubygems-${rg_ver}.zip && \
cd rubygems-${rg_ver} && ruby setup.rb --no-format-executable)
rm -rf /tmp/rubygems-${rg_ver} /tmp/rubygems-${rg_ver}.zip

# Install Chef & Puppet
gem install chef --no-ri --no-rdoc
gem install puppet --no-ri --no-rdoc

# Install vagrant keys
mkdir -p /home/vagrant/.ssh
chmod 700 /home/vagrant/.ssh
cd /home/vagrant/.ssh
curl -o /home/vagrant/.ssh/authorized_keys \
'http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub'
chmod 0600 /home/vagrant/.ssh/authorized_keys
chown -R vagrant:vagrant /home/vagrant/.ssh

# Tweak sshd to prevent DNS resolution (speed up logins)
echo 'UseDNS no' >> /etc/ssh/sshd_config

# Customize the message of the day
echo 'Welcome to your Vagrant-built virtual machine.' > /var/run/motd

# The netboot installs the VirtualBox support (old) so we have to remove it
apt-get -y remove virtualbox-ose-guest-dkms
apt-get -y remove virtualbox-ose-guest-utils

# Install the VirtualBox guest additions
VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
curl -Lo /tmp/VBoxGuestAdditions_$VBOX_VERSION.iso \
"http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso"
mount -o loop /tmp/VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
yes|sh /mnt/VBoxLinuxAdditions.run
umount /mnt

# Clean up
apt-get -y remove linux-headers-$(uname -r) build-essential
apt-get -y autoremove

rm /tmp/VBoxGuestAdditions_$VBOX_VERSION.iso
exit

0 comments on commit 678887a

Please sign in to comment.