Changeset View
Changeset View
Standalone View
Standalone View
libexec/rc/rc.d/jail
#!/bin/sh | #!/bin/sh | ||||
# | # | ||||
# $FreeBSD$ | # $FreeBSD$ | ||||
# | # | ||||
antranigv_freebsd.am: This is NOT meant to be here, so sorry, first time trying arc with git, so embarrassing. | |||||
# PROVIDE: jail | # PROVIDE: jail | ||||
# REQUIRE: LOGIN FILESYSTEMS | # REQUIRE: LOGIN FILESYSTEMS | ||||
# BEFORE: securelevel | # BEFORE: securelevel | ||||
# KEYWORD: nojail shutdown | # KEYWORD: nojail shutdown | ||||
. /etc/rc.subr | . /etc/rc.subr | ||||
name="jail" | name="jail" | ||||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | parse_options() | ||||
_jv=$2 | _jv=$2 | ||||
_confwarn=0 | _confwarn=0 | ||||
if [ -z "$_j" ]; then | if [ -z "$_j" ]; then | ||||
warn "parse_options: you must specify a jail" | warn "parse_options: you must specify a jail" | ||||
return | return | ||||
fi | fi | ||||
eval _jconf=\"\${jail_${_jv}_conf:-/etc/jail.${_j}.conf}\" | eval _jconf=\"\${jail_${_jv}_conf:-/etc/jail.${_j}.conf}\" | ||||
eval _jconfdir=\"/etc/jail.d/${_j}.conf\" | |||||
Not Done Inline ActionsI don't think the \/ is intended here. freqlabs: I don't think the `\/` is intended here. | |||||
Not Done Inline ActionsPull /etc/jail.conf.d out into defaults/rc.conf, "jail_conf_dir" kevans: Pull /etc/jail.conf.d out into defaults/rc.conf, "jail_conf_dir" | |||||
eval _rootdir=\"\$jail_${_jv}_rootdir\" | eval _rootdir=\"\$jail_${_jv}_rootdir\" | ||||
eval _hostname=\"\$jail_${_jv}_hostname\" | eval _hostname=\"\$jail_${_jv}_hostname\" | ||||
if [ -z "$_rootdir" -o \ | if [ -z "$_rootdir" -o \ | ||||
-z "$_hostname" ]; then | -z "$_hostname" ]; then | ||||
if [ -r "$_jconf" ]; then | if [ -r "$_jconf" ]; then | ||||
_conf="$_jconf" | _conf="$_jconf" | ||||
return 0 | |||||
elif [ -r "$_jconfdir" ]; then | |||||
Not Done Inline ActionsIt occurs to me looking at this that we won't pick up any jails with either /etc/jail.<foo>.conf or /etc/jail.d/<foo>.conf for the various _ALL actions. I'm not sure that that's ideal, but I'm not sure that's something that needs to be resolved here. kevans: It occurs to me looking at this that we won't pick up any jails with either /etc/jail.<foo>. | |||||
Not Done Inline ActionsInstead of this, loop through $jail_conf_dir before this chain and use an existing ${__j}.conf in one of those if it exists. You can override it with`$__jconf` above if you want, but I'm not sure it'll hurt for the new construct to take precedence; I imagine the odds of colliding with someone's preexisting out-of-tree setup are pretty low. kevans: Instead of this, loop through `$jail_conf_dir` before this chain and use an existing `${__j}. | |||||
_conf="$_jconfdir" | |||||
return 0 | return 0 | ||||
elif [ -r "$jail_conf" ]; then | elif [ -r "$jail_conf" ]; then | ||||
_conf="$jail_conf" | _conf="$jail_conf" | ||||
return 0 | return 0 | ||||
else | else | ||||
warn "Invalid configuration for $_j " \ | warn "Invalid configuration for $_j " \ | ||||
"(no jail.conf, no hostname, or no path). " \ | "(no jail.conf, no hostname, or no path). " \ | ||||
"Jail $_j was ignored." | "Jail $_j was ignored." | ||||
▲ Show 20 Lines • Show All 465 Lines • Show Last 20 Lines |
This is NOT meant to be here, so sorry, first time trying arc with git, so embarrassing.