Creating directories with `mender-artifact install` or `mender-artifact cp`

In our workflow we generate a mender update artifact from Yocto with our base operating system. We then compile our application code after and want to use mender-artifact to copy the application and its resources into the existing mender update. The problem I’m running into is that I can’t find a way to create new directories with mender-artifact. With either cp or install I get an error message when trying to copy into a path that doesn’t exist.

$ mender-artifact install -m 644 ./foo test.mender:/bar/foo
The directory: /bar does not exist in the image

I tried looking at the source for mender-artifact, but I’m not up to speed on golang, so I wasn’t able to get too far. Is there a way to pull this off that I’m missing?

mender-artifact install is a very simple interface, primarily designed to update config files and primarily during evaluation. Do not think that there is a way to create directories.

So my recommendation would instead be:

  • take the ext4 image from your Yocto build
  • loopback mount it and install your application and any other changes you would like to make
  • use mender-artifact create a Mender Artifact based on above modified ext4image. You would use themender-artifact write rootfs-image command for this.

Though I would recommend you to integrate the build of your application in Yocto as well to streamline the the workflow, but above should also work.

Thanks for the quick reply! You all have blown me away with your community support at every turn.

I hadn’t thought of keeping around the ext4 as an artifact and modifying that, I like that idea. As for an all in-Yocto build, our firmware and application teams are decoupled in our workflows and we don’t want to bog down the app folks with the Yocto builds. We used to do it this way, but the seperation has worked out well for us so we don’t want to move off of it.

Another thought, if I made a PR for mender artifact that added a mkdir command, would that have a chance of being accepted?

Thanks for the quick reply! You all have blown me away with your community support at every turn.

Thank you for being part of the community as well

We used to do it this way, but the separation has worked out well for us so we don’t want to move off of it.

:+1:

I will let @kacf and @oleorhagen comment on this as they have primarily worked on this tool.

A mender-artifact install -d option could also be a way to implement this, as this interface mimics the install util.

Yes, that sounds like a good addition to me. I would consider waiting a week or so to start though. There is a big refactoring going on in that part of the tool, so you would risk conflicts. It’s due to be submitted very soon.