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

时间:2015-06-25 19:13:10

标签: linux bash shell vagrant provisioning

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 个答案:

答案 0 :(得分:1)

你早先在脚本中找到了/usr/local/src/libuv-1.4.2

然后你使用curl将dnvm下载到该目录中,然后尝试运行该文件,就好像它在/root/.dnx/dnvm/dnvm.sh中一样,当它实际位于/usr/local/src/libuv-1.4.2

下的某个地方时

在使用curl获取dnvm之前,您只需要回到/root。所以...

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

希望这有帮助!