ezjail flavours - how to define fstab.JAILNAME

I have been trying to set up few jail templates, which sysutils/ezjail calls flavours. So far I haven't had any problems. There is only one step that I don't seem to resolve. As part of the default template I would like to mount (nullfs) in all jails my package repository that I have already prepared using poudriere. This information is entered in /etc/fstab.JAILNAME and has to be set up from the host and not within the jail. I can't find a way to make this information part of the template/flavour.

The only way is to manually change /usr/local/bin/ezjail-admin

Code:
 # if the automount feature is not disabled, this fstab entry for new jail
  # will be obeyed
  echo -n > /etc/fstab.${ezjail_safename}
  if [ "${ezjail_imagetype}" -a "${ezjail_imagetype}" != "zfs" ] ; then
    echo ${ezjail_devicelink} ${ezjail_rootdir} ufs rw 0 0 >> "/etc/fstab.${ezjail_safename}"
  fi
  echo ${ezjail_jailbase} ${ezjail_rootdir}/basejail nullfs ro 0 0 >> "/etc/fstab.${ezjail_safename}"

by adding another line with my mount points.

This is not very elegant, so is there a better solution? Any suggestions?

Of course I can set up an httpd for the repository and so will only need to adjust pkg.conf in the jail, which should be a bit easier. However the repository will be used only by the jails of the same machine so I didn't want to add an unnecessary service.
 
What exactly is in your jail's /etc/fstab.JAILNAME?

I have some extra stuff in there and I didn't have to do anything to get it working.
 
For example, for my jail called music I have in /etc/fstab.music:

Code:
/usr/jails/basejail /usr/jails/music/basejail nullfs ro 0 0

This is created automatically, as it is a way of ezjail sharing the basejail with all new jails.

I want to add two more lines, in order to share my packages with the jail.

Code:
/usr/local/poudriere/data/packages/91amd64-default /usr/jails/music/usr/local/mybuild/packages nullfs ro 0 0
                                                               
/usr/local/poudriere/ssl/certs /usr/jails/music/usr/local/mybuild/package/ssl nullfs ro 0 0

I can enter these manually and it will work, but I need to repeat it every time I create a new jail. That's why I thought it will be better to incorporate them into a flavour so that any jail I create has a fstab.JAILNAME with the extra mount points.
 
Back
Top