Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Oct 2013 21:53:39 +0200
From:      Dirk Engling <erdgeist@erdgeist.org>
To:        freebsd-jail@FreeBSD.org
Subject:   Patch: make the jail(8) command set the jid parameter
Message-ID:  <526191C3.7090902@erdgeist.org>

next in thread | raw e-mail | index | archive | help
Hello,

I've created a patch to the jail command that allows statements like

exec.poststart = "touch /startjailid_${jid}";
exec.prestop = "touch /stopjailid_${jid}";

in a jail.conf work as expected, even if the jid is not specified there,
i.e. for jails without a pinned jid.

It works by splitting variable substitution in two parts. In the first
pass a missing jid parameter is ignored, running_jid and the IP__OP
create operation will then set the jail's jid parameter and try to
resolve any references not done before.

The code should probably check for references to $jid before it is
available (i.e. in the exec.prestart variable), but just substituting
the empty string as it happens now should be just fine.

Find the patch at
https://erdgeist.org/arts/software/jail/usr.sbin.jail-jid.patch

Regards,

  erdgeist



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?526191C3.7090902>