change __jail to boolean, fixes #128

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2012-11-19 10:36:52 +01:00
parent 327a0f2844
commit 13968d16f6
4 changed files with 20 additions and 31 deletions

View file

@ -34,15 +34,8 @@ fi
state="$(cat "$__object/parameter/state")" state="$(cat "$__object/parameter/state")"
if [ -f "$__object/parameter/started" ]; then
started="$(cat "$__object/parameter/started")"
else
if [ ! "$state" = "present" ]; then
started="false" started="false"
else [ -f "$__object/parameter/started" -a "$state" = "present" ] && started="true"
started="true"
fi
fi
if [ -f "$__object/parameter/ip" ]; then if [ -f "$__object/parameter/ip" ]; then
ip="$(cat "$__object/parameter/ip")" ip="$(cat "$__object/parameter/ip")"
@ -66,8 +59,8 @@ if [ -f "$__object/parameter/interface" ]; then
interface="$(cat "$__object/parameter/interface")" interface="$(cat "$__object/parameter/interface")"
fi fi
if [ -f "$__object/parameter/devfs-enable" ]; then if [ -f "$__object/parameter/devfs-disable" ]; then
devfsenable="$(cat "$__object/parameter/devfs-enable")" devfsenable="false"
else else
devfsenable="true" devfsenable="true"
fi fi
@ -82,12 +75,12 @@ fi
# is pointless. Treat this as an error. # is pointless. Treat this as an error.
if [ -n "$devfsruleset" -a "$devfsenable" = "false" ]; then if [ -n "$devfsruleset" -a "$devfsenable" = "false" ]; then
exec >&2 exec >&2
echo "Can't have --devfs-ruleset defined without --devfs-enable true." echo "Can't have --devfs-ruleset defined without --devfs-disable"
exit 1 exit 1
fi fi
if [ -f "$__object/parameter/onboot" ]; then if [ -f "$__object/parameter/onboot" ]; then
onboot="$(cat "$__object/parameter/onboot")" onboot="true"
fi fi
if [ -f "$__object/parameter/jaildir" ]; then if [ -f "$__object/parameter/jaildir" ]; then
@ -357,7 +350,3 @@ else # The jail does not currently exist
exit 0 exit 0
fi fi
fi fi
# Debug
#set +x

View file

@ -27,9 +27,6 @@ OPTIONAL PARAMETERS
name:: name::
The name of the jail. Default is to use the object_id as the jail name. The name of the jail. Default is to use the object_id as the jail name.
started::
Either "true" or "false." Defaults to true.
ip:: ip::
The ifconfig style IP/netmask combination to use for the jail guest. If The ifconfig style IP/netmask combination to use for the jail guest. If
the state parameter is "present," this parameter is required. the state parameter is "present," this parameter is required.
@ -41,23 +38,26 @@ interface::
The name of the physical interface on the jail server to bind the jail to. The name of the physical interface on the jail server to bind the jail to.
Defaults to the first interface found in the output of ifconfig -l. Defaults to the first interface found in the output of ifconfig -l.
devfs-enable::
Whether to allow devfs mounting within the jail. Must be "true" or "false."
Defaults to true.
devfs-ruleset:: devfs-ruleset::
The name of the devfs ruleset to associate with the jail. Defaults to The name of the devfs ruleset to associate with the jail. Defaults to
"jailrules." This ruleset must be copied to the server via another type. "jailrules." This ruleset must be copied to the server via another type.
To use this option, devfs-enable must be "true." To use this option, devfs-enable must be "true."
onboot::
Whether to add the jail to rc.conf's jail_list variable. Must be either
"true" or "false." Defaults to false.
jaildir:: jaildir::
The location on the remote server to use for hosting jail filesystems. The location on the remote server to use for hosting jail filesystems.
Defaults to /usr/jail. Defaults to /usr/jail.
BOOLEAN PARAMETERS
------------------
started::
Whether to start jail
devfs-disable::
Whether to disallow devfs mounting within the jail
onboot::
Whether to add the jail to rc.conf's jail_list variable.
CAVEATS CAVEATS
------- -------

View file

@ -0,0 +1,3 @@
onboot
started
devfs-disable

View file

@ -1,10 +1,7 @@
name name
started
ip ip
hostname hostname
interface interface
devfs-enable
devfs-ruleset devfs-ruleset
onboot
jaildir jaildir
jailbase jailbase