]>
Commit | Line | Data |
---|---|---|
2fe4e4ef ER |
1 | #!/bin/sh |
2 | # | |
3 | # This is a wrapper to properly execute Vagrant so that it sees system gems and | |
4 | # merges with it's own gems. | |
5 | # | |
6 | # This sets up proper environmental variables so that everything loads and | |
7 | # compiles to proper directories. | |
8 | ||
9 | # Set the path to the Ruby executable | |
10 | RUBY_EXECUTABLE="/usr/bin/ruby" | |
11 | ||
12 | GEM_PATH=$($RUBY_EXECUTABLE -r rubygems -e 'puts Gem.respond_to?(:default_dirs) ? Gem.default_dirs[:system][:gem_dir] : Gem.path.first') | |
13 | export GEM_PATH | |
14 | ||
15 | # Export gem paths so it can find vagrant own gem | |
16 | export GEM_HOME="${GEM_PATH}" | |
17 | ||
2fe4e4ef ER |
18 | # Unset any RUBYOPT and RUBYLIB, we don't want these bleeding into our |
19 | # runtime. | |
20 | unset RUBYOPT | |
21 | unset RUBYLIB | |
22 | ||
23 | # Find the Vagrant executable | |
24 | for needle in "${GEM_PATH}/gems/vagrant-"*; do | |
6c09bd0b | 25 | if [ -f "${needle}/lib/vagrant/version.rb" ]; then |
2fe4e4ef ER |
26 | VAGRANT_GEM_PATH="${needle}" |
27 | fi | |
28 | done | |
29 | ||
30 | VAGRANT_EXECUTABLE="${VAGRANT_GEM_PATH}/bin/vagrant" | |
2fe4e4ef ER |
31 | |
32 | # Call the actual Vagrant bin with our arguments | |
6c09bd0b | 33 | exec "$RUBY_EXECUTABLE" -r rubygems "$VAGRANT_EXECUTABLE" "$@" |