forked from dreamcat4/ubuntu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-vagrant
executable file
·42 lines (33 loc) · 1.04 KB
/
build-vagrant
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
set -e
. "$(dirname $0)/config.sh"
for ARCH in $ARCHS
do
VBOX="devstructure-ubuntu-$VERSION-$DISTRO-$ARCH"
# 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-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" \
"maverick$([ "$ARCH" = "i386" ] && echo 32 || echo 64).box"
done
# Creating Vagrant boxes ruins the normal VM setup so get rid of them.
eval "$(dirname $0)/clean-vbox"