Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 48 lines (37 sloc) 1.384 kb
b3ccc49 @rcrowley Build Vagrant box files.
rcrowley authored
1 #!/bin/sh
2
3 set -e
4
5 . "$(dirname $0)/config.sh"
6
7 for ARCH in $ARCHS
8 do
8f4d917 @jasherai Remove devstructure branding on files.
jasherai authored
9 VBOX="${LABEL}-ubuntu-$VERSION-$DISTRO-$ARCH"
b3ccc49 @rcrowley Build Vagrant box files.
rcrowley authored
10
f8e080f @jasherai Add snapshot after initial install and after install of vagrant deps
jasherai authored
11 # Reset to snapshot at time of initial build
12 VBoxManage snapshot "${VBOX}" restore "AUTO_${LABEL}_base_build #000001"
13
b3ccc49 @rcrowley Build Vagrant box files.
rcrowley authored
14 # Start the virtual machine. Spin slowly until SSH is usable.
15 VBoxManage startvm "$VBOX" --type gui
16 #VBoxHeadless --startvm "$VBOX" --vrdp config
17 until eval "$SSH exit"
18 do
19 sleep 1
20 done
21
22 # Install Ruby, RubyGems, and Chef as Vagrant requires.
23 eval "$SSH \"
24 set -e
27cd0a0 @dreamcat4 Add 'ruby' metapackage to base dependencies
authored
25 sudo apt-get -y install build-essential ruby ruby-dev rubygems
6168b64 @rcrowley Install RubyGems in /usr.
rcrowley authored
26 sudo gem install --no-rdoc --no-ri chef
3d24394 @rcrowley Set the default PATH.
rcrowley authored
27 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
b3ccc49 @rcrowley Build Vagrant box files.
rcrowley authored
28 \""
29
b4cc1cf @rcrowley Shutdown properly.
rcrowley authored
30 # Shutdown the virtual machine.
057b4fd @rcrowley Quote commands.
rcrowley authored
31 eval "$SSH \"sudo shutdown -h now\""
71dfc76 @rcrowley Pause for complete shutdown.
rcrowley authored
32 until VBoxManage showvminfo "$VBOX" | grep "^State: *powered off"
33 do
34 sleep 1
35 done
b3ccc49 @rcrowley Build Vagrant box files.
rcrowley authored
36
37 # Now build the Vagrant box file.
d300879 @rcrowley Package by the proper name.
rcrowley authored
38 vagrant package --base "$VBOX"
39 mv "package.box" \
90c36ee @dreamcat4 For output filename to follow the other .box filenames
authored
40 "${HOST}$([ "$ARCH" = "i386" ] && echo 32 || echo 64).box"
b3ccc49 @rcrowley Build Vagrant box files.
rcrowley authored
41
f8e080f @jasherai Add snapshot after initial install and after install of vagrant deps
jasherai authored
42 # Snapshot after vagrant dep install....
43 VBoxManage snapshot "${VBOX}" take "AUTO_${LABEL}_vagrant_base #000002" --description "Snapshot taken after installing vagrant dependencies"
b3ccc49 @rcrowley Build Vagrant box files.
rcrowley authored
44 done
f4de767 @rcrowley Clean up worthless VMs.
rcrowley authored
45
46 # Creating Vagrant boxes ruins the normal VM setup so get rid of them.
f8e080f @jasherai Add snapshot after initial install and after install of vagrant deps
jasherai authored
47 #eval "$(dirname $0)/clean-vbox"
Something went wrong with that request. Please try again.