Each shell provisioning line runs as its own process. Directory changes do
not persist from one line to the next. You will need to gather your
individual lines into an actual script to get the result you want. For more
info, see

    https://developer.hashicorp.com/vagrant/docs/provisioning/shell

 -- jmcg

On Thu, Jun 29, 2023 at 9:51 AM Giacomo Tommaso Petrucci <
[email protected]> wrote:

> Greetings,
>
> I wrote the following Vagrantfile:
>
> Vagrant.configure("2") do |config|
>   config.vm.box = "ubuntu/jammy64"
>   config.vm.synced_folder "pep_code", "/home/vagrant/pep_code"
>
>   # Update and install dependencies
>   config.vm.provision "shell", inline: "echo Updating..."
>   config.vm.provision "shell", inline: "sudo apt-get update && sudo
> apt-get -y upgrade"
>   config.vm.provision "shell", inline: "sudo apt-get -y install  clang
> ninja-build golang golang-goprotobuf-dev ccache distcc git cmake valgrind
> libboost-all-dev zlib1g-dev libbz2-dev libsqlite3-dev libcurl4-openssl-dev
> curl libpam0g-dev libssl-dev libreadline-dev patch vim flex qtbase5-dev
> qtdeclarative5-dev qttools5-dev qttools5-dev-tools libunwind-dev libc6-dev
> libc6-dev-i386 software-properties-common gcc-multilib"
>   config.vm.provision "file", source: "pep_code", destination:
> "/home/vagrant/pep_code"
>   config.vm.provision "shell", inline: "cd /home/vagrant/pep_code"
>   config.vm.provision "shell", inline: "git init"
>   config.vm.provision "shell", inline: "git config --global user.name
> \"Giacomo\""
>   config.vm.provision "shell", inline: "git config --global user.email
> \"[redacted]\""
>   config.vm.provision "shell", inline: "git add * && git commit -m \"fix\""
>   config.vm.provision "shell", inline: "mkdir build && cd build"
>   config.vm.provision "shell", inline: "CC=clang CXX=clang++ cmake
> -DWITH_CASTOR=OFF .."
>   config.vm.provision "shell", inline: "ninja"
> end
>
> It fails while provisioning with the following message:
>
> default: CMake Error: The source directory "/home" does not appear to
> contain CMakeLists.txt.
>    default: Specify --help for usage, or press the help button on the
> CMake GUI.
> The SSH command responded with a non-zero exit status. Vagrant
> assumes that this means the command failed. The output for this command
> should be in the log above. Please read the output to determine what
> went wrong.
>
>
> I was expecting the lines
>
> config.vm.provision "shell", inline: "cd /home/vagrant/pep_code"
>
> and
>
> config.vm.provision "shell", inline: "mkdir build && cd build"
>
> to change the working directory of the provisioning process, but this
> doesn't seem the case. Docker has an instruction for this, WORKDIR. Does
> Vagrant have something similar? A quick Google search didn't turn up
> anything.
> Thank you for your help,
>
> Giacomo Tommaso Petrucci
>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/hashicorp/vagrant/issues
> Discuss: https://discuss.hashicorp.com/c/vagrant/24
> ---
> 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].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vagrant-up/5ab0c5fe-f707-474a-9e3a-4720f31f331dn%40googlegroups.com
> <https://groups.google.com/d/msgid/vagrant-up/5ab0c5fe-f707-474a-9e3a-4720f31f331dn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/hashicorp/vagrant/issues
Discuss: https://discuss.hashicorp.com/c/vagrant/24
--- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/CACEPCkQLCoDBmf3%3D4kZ3DuRUWMyYj26YJ2v1sLHniaYKtyGeoQ%40mail.gmail.com.

Reply via email to