bsdpot/pot

Please add flag to create directories for copy-in, if directories don't exist

bretton opened this issue · 4 comments

Is your feature request related to a problem? Please describe.
copy-in fails to create directories on destination if they don't exist

Describe the feature you'd like to have
I'd like a flag for the copy-in command to create directories at destination if they don't exist.

e.g. /usr/local/bin might not exist until a package is installed, but copying in /usr/local/bin/cook can only work if /usr/local/bin is created in the process.

It's not clear if the force flag creates the directories?

Describe potential alternatives or workaround you've considered (if any)
Alternative solution is to copy files and directories to /root and then perform additional steps once jail live, to copy to correct destination. But this involves additional steps to cleanup too, otherwise unnecessary duplication in images.

It would also be kind of cool to allow copy-in relative to the flavourdir, to make #163 more useful.

So, e.g., this would be possible:

copy-in -s myflavour.d/somefile -d /root

@pizzamig Do you think it would make sense to always base relative copy-in paths on flavourdir?

@bretton : the current workaround is to split a flavour in multiple steps, but I agree that this flag is an improvement.

@grembo : usually I'm reluctant to change a default behavior. However the copy-in in a flavour can benefit a lot by this. I have a couple of ideas on how to implement it. Can you please create a separate issue for this feature?

Hi @pizzamig,

I implemented both features and will open two pull requests soon.