Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Feb 2017 17:48:01 -0800
From:      Jeff Kletsky <freebsd@wagsky.com>
To:        freebsd-jail@freebsd.org
Subject:   Using jail.conf array parameters in exec.* commands
Message-ID:  <b54f6576-7627-f3c3-70b0-b2c9c54a4fd6@wagsky.com>

next in thread | raw e-mail | index | archive | help
TL;DR

Is there a patch available to allow substitution of "array" parameters
into the strings used for exec.prestart, exec.poststop, and the like?


Longer:

I'd like to be able to use array parameters in exec.* commands,
but trying to do so results in

   jail: test-two: exec.prestart: array cannot be substituted inline

A quick check of the source didn't suggest it would work, but the
bash-isms ${host.interface[*]} and ${host.interface[@]} failed too.


The immediate application is in creating what will be the vnet.interface(s)
using netgraph on the appropriate host interfaces

   vnet.interface = ng0, ng1;

Works well, once the interfaces are created, but I'd rather not have
to define that list twice in each jail.


If I could write something like:

   vnet.interface = ng0, ng1;
   host.interface = re0, re0.100;

and then iterate over them in the prestart and poststop scripts to:

   * Create ng0 connected to re0
   * Create ng1 connected to re0.100

it would be easier to maintain than having to write something like:

   vnet.interface = ng0, ng1;
   parent.interfaces = "re0 re0.100";
   cloned.interfaces = "ng0 ng1";



I'm open to ideas here, including if I can somehow "write back" to
vnet.interface based on exec.prestart parsing the "custom" variables.


TIA,

Jeff






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b54f6576-7627-f3c3-70b0-b2c9c54a4fd6>