SHA256
1
0
forked from pool/vagrant
vagrant/binstub

62 lines
2.1 KiB
Plaintext
Raw Normal View History

#!/bin/bash
#
# This is a wrapper to properly execute Vagrant within the embedded
# Vagrant installation directory. This sets up proper environment variables
# so that everything loads and compiles to proper directories.
# Load defaults, especially VAGRANT_PREFERRED_PROVIDERS
if [ -r /etc/default/vagrant ]; then
source /etc/default/vagrant
fi
# Export gem paths so that we use the isolated gems.
export GEM_PATH="@ruby_vagrant_gem_path@"
# Export GEM_HOME based on VAGRANT_HOME
#
# This needs to be set because Bundler includes gem paths
# from RubyGems' Gem.paths.
VAGRANT_HOME=${VAGRANT_HOME:-~/.vagrant.d}
export GEM_HOME="$VAGRANT_HOME/gems"
# SSL certs
# export SSL_CERT_FILE="${SSL_CERT_FILE:-/etc/pki/tls/cert.pem}"
# Export an enviroment variable to say we're in a Vagrant
# installer created environment.
export VAGRANT_INSTALLER_ENV=1
# This is currently used only in Vagrant::Plugin::Manager.system_plugins_file
# to locate plugins configuration file.
export VAGRANT_INSTALLER_EMBEDDED_DIR="@vagrant_embedded_dir@"
export VAGRANT_INSTALLER_VERSION="2"
# Determine the OS that we're on, which is used in some later checks.
# It is very important we do this _before_ setting the PATH below
# because uname dependencies can conflict on some platforms.
OS=$(uname -s 2>/dev/null)
# Export the OS as an environment variable that Vagrant can access
# so that it can behave better.
export VAGRANT_DETECTED_OS="${OS}"
# Export the VAGRANT_EXECUTABLE so that pre-rubygems can optimize a bit
export VAGRANT_EXECUTABLE="${VAGRANT_INSTALLER_EMBEDDED_DIR}/gems/bin/vagrant"
# Set providers' preferred order(priority) if not already set
if [ -z ${VAGRANT_PREFERRED_PROVIDERS+empty} ]; then
VAGRANT_PREFERRED_PROVIDERS=libvirt,docker
fi
export VAGRANT_PREFERRED_PROVIDERS
# Don't allow symlink in shared folders by default, the user can override it if
# they really want to (this is a security risk)
if [ -z "$VAGRANT_DISABLE_VBOXSYMLINKCREATE" ]; then
VAGRANT_DISABLE_VBOXSYMLINKCREATE=1
fi
export VAGRANT_DISABLE_VBOXSYMLINKCREATE
# Call the actual Vagrant bin with our arguments
exec ruby "${VAGRANT_EXECUTABLE}" "$@"