it works for me: I add at the end one echo PATH $PATH
check this output: alvaros-mini:matej alvarom$ vagrant provision .. [default] Running: inline script PATH /usr/local/x86_64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/vagrant_ruby/bin alvaros-mini:matej alvarom$ so, let's say i create that folder and I put something there. alvaros-mini:matej alvarom$ vagrant ssh Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64) * Documentation: https://help.ubuntu.com/ Welcome to your Vagrant-built virtual machine. Last login: Fri Sep 14 06:23:18 2012 from 10.0.2.2 vagrant@precise64:~$ sudo su - root@precise64:~# mkdir -p /usr/local/x86_64/bin root@precise64:~# vi /usr/local/x86_64/bin/runme.sh root@precise64:~# chmod +x /usr/local/x86_64/bin/runme.sh root@precise64:~# runme.sh it works root@precise64:~# logout vagrant@precise64:~$ logout Connection to 127.0.0.1 closed. You have new mail in /var/mail/alvarom alvaros-mini:matej alvarom$ vagrant ssh -c "sudo su - -c runme.sh" it works Connection to 127.0.0.1 closed. alvaros-mini:matej alvarom$ On Tue, Feb 18, 2014 at 1:30 PM, Matej Macak <[email protected]> wrote: > Here are the contents of my Vagrantfile (no reboot option, just tested) on > a precise 64 box: > > # -*- mode: ruby -*- > # vi: set ft=ruby : > > # Vagrantfile API/syntax version. Don't touch unless you know what you're > doing! > VAGRANTFILE_API_VERSION = "2" > > Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| > > config.vm.box = "precise64" > config.vm.box_url = "http://files.vagrantup.com/precise64.box" > > config.vm.provision :shell, :inline => "sudo apt-get update" > config.vm.provision :shell, :inline => "[ -f ~/.profile ] || touch > ~/.profile" > config.vm.provision :shell, :inline => "[ -f ~/.bash_profile ] || touch > ~/.bash_profile" > config.vm.provision :shell, :inline => "grep 'PATH=/usr/local/x86_64/bin' > ~/.profile || echo 'export PATH=/usr/local/x86_64/bin:$PATH' | tee -a > ~/.profile" > config.vm.provision :shell, :inline => "grep 'PATH=/usr/local/x86_64/bin' > ~/.bash_profile || echo 'export PATH=/usr/local/x86_64/bin:$PATH' | tee -a > ~/.bash_profile" > config.vm.provision :shell, :inline => ". ~/.profile" > config.vm.provision :shell, :inline => ". ~/.bash_profile" > > end > > > Thanks a lot! > > Matej > > On Tuesday, February 18, 2014 12:16:35 AM UTC, Alvaro Miranda Aguilera > wrote: >> >> it worked for me >> >> can you share your vagrantfile ? >> >> I can test with the vm you are using, i tested on Oracle Linux. >> >> >> >> On Tue, Feb 18, 2014 at 8:58 AM, Matej Macak <[email protected]> wrote: >> >>> Hi Alvaro, >>> >>> does this work for you? When I used this in my Vagrantfile, it did not >>> result in the export path being added to my .profile file (even after the >>> provisioning was finished). I have even used the following >>> code<https://github.com/exratione/vagrant-provision-reboot>to reboot during >>> my provisioning calls but even that did not help. Somehow, >>> I will need to disconnect the SSH as Mitchell suggested during the >>> provisioning. >>> >>> @Terrance - I think my problem is that my provisioning is not registered >>> in the .profile for some reason so bash -l shouldn't work because it should >>> just read the old .profile upon startup (if I understand my problem >>> correctly). >>> >>> Matej >>> >>> On Saturday, February 15, 2014 9:50:22 AM UTC, Matej Macak wrote: >>>> >>>> Running the following commands in the shell provisioning script does >>>> not change the system path (as it does when this is run in the terminal). I >>>> was using precise 64 box: >>>> >>>> echo 'export PATH="/usr/local/x86_64/bin:$PATH"' >> ~/.profile >>>> >>>> echo 'export PATH="/usr/local/x86_64/bin:$PATH"' >> ~/.bashrc >>>> >>>> export PATH="/usr/local/x86_64/bin:$PATH" >>>> >>>> >>>> The path is neither changed during provisioning so the later commands >>>> are not executed as if the path was modified nor are the lines from echo >>>> commands actually inserted into the .profile or .bashrc files. Running >>>> commands with root access (i.e. sudo) makes no difference. >>>> >>>> >>>> -- >>> 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/groups/opt_out. >>> >> >> -- > 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/groups/opt_out. > -- 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/groups/opt_out.
