-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathbuild-vagrant
executable file
·38 lines (30 loc) · 1021 Bytes
/
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
#!/bin/sh
set -e
. "$(dirname $0)/config.sh"
VBOX="$NICKNAME-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" \
"$NICKNAME$([ "$ARCH" = "i386" ] && echo 32 || echo 64).box"
# Creating Vagrant boxes ruins the normal VM setup so get rid of them.
eval "$(dirname $0)/clean-vbox"