-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathINSTALL.osx.sh
executable file
·67 lines (50 loc) · 1.65 KB
/
INSTALL.osx.sh
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
set -e # bail on first error
set -u # bail on unbound variable reference
set -x # print command before executing it
DEVELOPMENT_DIRECTORY=~/dev
# virtualbox 4.2.12
VIRTUAL_BOX_URL='http://download.virtualbox.org/virtualbox/4.2.12/VirtualBox-4.2.12-84980-OSX.dmg'
# vagrant 1.1.5
VAGRANT_URL='http://files.vagrantup.com/packages/7e400d00a3c5a0fdf2809c8b5001a035415a607b/Vagrant-1.2.2.dmg'
InstallVirtualBox() {
curl -Lo virtualbox.dmg $VIRTUAL_BOX_URL
hdiutil mount virtualbox.dmg
sudo installer -package /Volumes/VirtualBox/VirtualBox.pkg -target /
hdiutil unmount /Volumes/VirtualBox
}
InstallVagrant() {
curl -Lo vagrant.dmg $VAGRANT_URL
hdiutil mount vagrant.dmg
sudo installer -package /Volumes/Vagrant/Vagrant.pkg -target /
hdiutil unmount /Volumes/Vagrant
}
InstallVagrantPlugins() {
# Must not be in the same directory as a Vagrantfile
# or it might try to load plugins that don't exist
pushd / 2>&1 >/dev/null
vagrant plugin install vagrant-omnibus
vagrant plugin install vagrant-berkshelf
vagrant plugin install vagrant-vbguest
popd / 2>&1 >/dev/null
}
CloneLinuxVmRepository() {
mkdir -p "$DEVELOPMENT_DIRECTORY"
if [[ ! -d "$DEVELOPMENT_DIRECTORY/linux-vm" ]]; then
git clone https://github.com/webcoyote/linux-vm "$DEVELOPMENT_DIRECTORY/linux-vm"
fi
}
MakeVirtualMachine() {
pushd "$DEVELOPMENT_DIRECTORY/linux-vm"
vagrant up --provider=virtualbox
vagrant ssh -c "sudo /sbin/init 5"
vagrant vbguest --auto-reboot
popd
}
# Ask for the password now so the rest of the install is uninterrupted
sudo true
InstallVirtualBox
InstallVagrant
InstallVagrantPlugins
CloneLinuxVmRepository
MakeVirtualMachine