Profile file, cwd

Hello,

In the profile file we create, for example the statement:

  • [sh, ‘-c’, ‘sudo -u ubuntu rosdep update’]

how can I execute something as user ubuntu, at working directory lets say /home/ubuntu/catkin_ws

I want to cd into a dir, and then execute catkin_make basically.

Best Regards,
C.

Hi Can,
Have you ever visited well documented page which mentions cloud-init and configuration options.
https://blog.simos.info/how-to-preconfigure-lxd-containers-with-cloud-init/
Regards.

Hello Cem,

Yes indeed, I started my lxd setup reading simos’s blog.

Let me rephrase my question: in a cloud-init file, how can I execute a command, with a working directory?

Best Regards,
Can

bootcmd:
 - cd /blah && do something

Should work fine.

If not, then the rather uglier sh -c "cd /blah && do something" should work.