Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 48 lines (37 sloc) 1.35 KB
#!/bin/sh
set -e
. "$(dirname $0)/config.sh"
for ARCH in $ARCHS
do
VBOX="${LABEL}-ubuntu-$VERSION-$DISTRO-$ARCH"
# Reset to snapshot at time of initial build
VBoxManage snapshot "${VBOX}" restore "AUTO_${LABEL}_base_build #000001"
# Start the virtual machine. Spin slowly until SSH is usable.
VBoxManage startvm "$VBOX" --type gui
#VBoxHeadless --startvm "$VBOX" --vrdp config
until eval "$SSH exit"
do
sleep 1
done
# Install Ruby, RubyGems, and Chef as Vagrant requires.
eval "$SSH \"
set -e
sudo apt-get -y install build-essential ruby ruby-dev rubygems
sudo gem install --no-rdoc --no-ri chef
echo 'PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/lib/gems/1.8/bin\"' | sudo tee /etc/environment >/dev/null
\""
# Shutdown the virtual machine.
eval "$SSH \"sudo shutdown -h now\""
until VBoxManage showvminfo "$VBOX" | grep "^State: *powered off"
do
sleep 1
done
# Now build the Vagrant box file.
vagrant package --base "$VBOX"
mv "package.box" \
"${HOST}$([ "$ARCH" = "i386" ] && echo 32 || echo 64).box"
# Snapshot after vagrant dep install....
VBoxManage snapshot "${VBOX}" take "AUTO_${LABEL}_vagrant_base #000002" --description "Snapshot taken after installing vagrant dependencies"
done
# Creating Vagrant boxes ruins the normal VM setup so get rid of them.
#eval "$(dirname $0)/clean-vbox"