I tried the IRC channel for this and didn't get a response. I'm curious if there any uniform way to detect if you are currently inside an environment that was started via `vagrant up`. Specifically in a scripting context, I'd like to be able to detect this case so a shell script could behave differently when run inside a vagrant-launched box vs otherwise.
Note that I'd like to be able to distinguish from launching the box manually via a provider (such as starting the VM from VirtualBox instead of vagrant launching the box *via* virtualbox.) I am wondering if there is a universal way to answer the question, *"was this machine started via `vagrant up`?"* Some suggestions that won't work (and why): - Check for a `vagrant` user. (If the same provisioning, say via puppet, is used for the vagrant box as for other machines, it's possible this user may exist in all environments. I agree that it's not a good idea to do this, but that doesn't change the possibility of it happening.) - Check for the shared `/vagrant` folder. (I have not been able to confirm that this is *always* present and not just "commonly specified" in most Vagrantfiles.) - Set something like a marker file or environment variable inside the *base *box. (The box may be used in environments other than vagrant. It may be launched directly via VirtualBox and not via `vagrant up`.) - Set a marker via the Vagrantfile using `config.vm.provision`. (If a given Vagrantfile omits this, the check will be inaccurate. The same for using a vagrant plugin to set some kind of marker-- the plugin may not be installed on a given host.) So we're back to my question: Does *vagrant itself* leave any clue inside the VM when it is specifically started via `vagrant up` regardless of provider or guest OS? Thanks. -- You received this message because you are subscribed to the Google Groups "Vagrant" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
