Why isn't a script executed during provisioning an Ubuntu VM using Vagrant shell script?

246 views Asked by At

I'm trying to install dnvm on an Ubuntu VM using Vagrant. In my vagrantfile I have a shell script that includes this line:
curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source /root/.dnx/dnvm/dnvm.sh
which downloads and executes dnvminstall.sh which installs and puts dnvm.sh in /root/.dnx/dnvm. The source /root/.dnx/dnvm/dnvm.sh part doesn't seem to have worked because when I ssh into the machine I need to run it manually for dnvm to work. So the question is, why isn't source /root/.dnx/dnvm/dnvm.sh executed during provisioning?
Here's the vagrantfile in it's entirety.

1

There are 1 answers

4
tobuslieven On

You're cding into /usr/local/src/libuv-1.4.2 earlier in your script.

Then you're downloading dnvm into that directory using curl, then trying to run the file as if it was in /root/.dnx/dnvm/dnvm.sh, when it's actually somewhere under /usr/local/src/libuv-1.4.2

You just need to cd back into /root before you use curl to get dnvm. So ...

cd /root
curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source /root/.dnx/dnvm/dnvm.sh

Hope this helps!