#!/bin/bash if [ -f .veewee_params ] then . .veewee_params fi # postinstall.sh created from Mitchell's official lucid32/64 baseboxes date > /etc/vagrant_box_build_time # Apt-install various things necessary for Ruby, guest additions, # etc., and remove optional things to trim down the machine. apt-get -y update apt-get -y upgrade apt-get -y install linux-headers-$(uname -r) build-essential apt-get -y install zlib1g-dev libssl-dev libreadline-gplv2-dev apt-get -y install vim apt-get clean # Installing the virtualbox guest additions apt-get -y install dkms VBOX_VERSION=$(cat /home/vagrant/.vbox_version) cd /tmp wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso mount -o loop VBoxGuestAdditions_$VBOX_VERSION.iso /mnt sh /mnt/VBoxLinuxAdditions.run umount /mnt rm VBoxGuestAdditions_$VBOX_VERSION.iso rm /home/vagrant/VBoxGuestAdditions_$VBOX_VERSION.iso # Setup sudo to allow no-password sudo for "sudo" usermod -a -G sudo vagrant cp /etc/sudoers /etc/sudoers.orig sed -i -e 's/%sudo\tALL=(ALL:ALL) ALL/%sudo\tALL=(ALL:ALL) NOPASSWD:ALL/' /etc/sudoers # Add puppet user and group adduser --system --group --home /var/lib/puppet puppet # Install NFS client apt-get -y install nfs-common # Install Ruby from packages apt-get -y install ruby rubygems ruby-dev # Installing chef & Puppet gem install chef puppet --no-ri --no-rdoc # Add /opt/ruby/bin to the global path as the last resort so # Ruby, RubyGems, and Chef/Puppet are visible echo 'PATH=$PATH:/opt/ruby/bin/'> /etc/profile.d/vagrantruby.sh # Installing vagrant keys mkdir /home/vagrant/.ssh chmod 700 /home/vagrant/.ssh cd /home/vagrant/.ssh wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O authorized_keys chmod 600 /home/vagrant/.ssh/authorized_keys chown -R vagrant /home/vagrant/.ssh # Remove items used for building, since they aren't needed anymore apt-get -y remove linux-headers-$(uname -r) build-essential apt-get -y autoremove # Zero out the free space to save space in the final image: dd if=/dev/zero of=/EMPTY bs=1M rm -f /EMPTY # Removing leftover leases and persistent rules echo "cleaning up dhcp leases" rm /var/lib/dhcp/* # Make sure Udev doesn't block our network # http://6.ptmc.org/?p=164 echo "cleaning up udev rules" rm /etc/udev/rules.d/70-persistent-net.rules mkdir /etc/udev/rules.d/70-persistent-net.rules rm -rf /dev/.udev/ rm /lib/udev/rules.d/75-persistent-net-generator.rules echo "Adding a 2 sec delay to the interface up, to make the dhclient happy" echo "pre-up sleep 2" >> /etc/network/interfaces exit