bartekrutkowski / iocell

iocell - FreeBSD jail manager forked from iocage (discussions: https://groups.google.com/forum/#!forum/iocell)
Other
74 stars 16 forks source link

Fix package installation during "iocell create" (#19) #26

Open orichoni opened 7 years ago

orichoni commented 7 years ago

Always mount "${release}" in order to have "basedirs" at the time of jail creation.

Make sure to follow and check these boxes before submitting a PR! Thank you.

The issue is caused by the following if condition:

 703         if [ "${_template}" != "1" ] ; then
 704             __mount_basejail "${uuid}" "${template}"
 705         else
 706             __mount_basejail "${uuid}" "${release}"
 707         fi

In my opinion the whole if condition doesn't make sense. The negation of the if statement would be more logical. But even then it wouldn't solve the problem because the function __mount_basejail () anyway mounts only directories located in "${iocroot}/releases/".

bsdlme commented 7 years ago

Works for me! :)

bartekrutkowski commented 7 years ago

Thanks for the patch! Could you please explain in detail your train of thoughts and code analysis around it? I am asking, because I didn't had the time to do it myself, and we must be careful not to introduce new issues around templates/releases by changing things right and left. While I am not saying this is what you do here in this patch, until you explain it in detail, you'll have to wait for me to find some time to do it, in order for me to merge this change.

orichoni commented 7 years ago

I have tried to analyze the code more deeply and found out that there are two possibilities how to create a template. One using "template" property and one using "istemplate" property. As far as I understood, the first one is obsolete and the second one is the right one to use. I have committed another change that removes remaining code related to the "template" property from __create_jail () function. Setting the "istemplate" property and newly also the "template" property are not allowed during __create_jail ().