Commit 3811d05deac678140d357cd438de9953597a29da

Authored by Antonio Terceiro
Committed by Sergio Oliveira
1 parent 7fac5932

move OS detection logic out of the Vagrantfile

Showing 2 changed files with 19 additions and 3 deletions   Show diff stats
Vagrantfile
... ... @@ -22,14 +22,13 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
22 22  
23 23 if distro == "precise64"
24 24 config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
25   - config.vm.provision "shell", path: "vagrant/ubuntu.sh"
26 25 elsif distro == "trusty64"
27 26 config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
28   - config.vm.provision "shell", path: "vagrant/ubuntu.sh"
29 27 elsif distro == "centos6.5"
30 28 config.vm.box_url = "https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box"
31   - config.vm.provision "shell", path: "vagrant/centos.sh"
32 29 end
  30 +
  31 + config.vm.provision "shell", keep_color: true, path: 'vagrant/bootstrap.sh'
33 32 config.vm.provision "shell", privileged: false, keep_color: true, path: "vagrant/provision.sh"
34 33  
35 34 config.vm.network :forwarded_port, guest: 8000, host: 8000 # Colab (runserver)
... ...
vagrant/bootstrap.sh 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +#!/bin/sh
  2 +
  3 +set -e
  4 +
  5 +if [ -d /vagrant/colab ]; then
  6 + basedir=/vagrant/colab
  7 +else
  8 + basedir=/vagrant
  9 +fi
  10 +
  11 +# very simple OS detection
  12 +if [ -x /usr/bin/apt-get ]; then
  13 + exec sh $basedir/vagrant/ubuntu.sh
  14 +fi
  15 +if [ -x /usr/bin/yum ]; then
  16 + exec sh $basedir/vagrant/centos.sh
  17 +fi
... ...