Hello,

What you need is something like this.

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"


each of those is a line, in case the long ones got cut in 2

check if profile or bash profile exits
check if the required path is already there if not, add it
source the file

when echo is a trouble, tee -a does the trick.


Alvaro.







On Sat, Feb 15, 2014 at 10:50 PM, Matej Macak <[email protected]> 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.

Reply via email to