View | Details | Raw Unified | Return to bug 142972 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/src/etc/rc.d/jail (-5 / +32 lines)
Lines 38-43 Link Here
38
	_fdescdir="${_devdir}/fd"
38
	_fdescdir="${_devdir}/fd"
39
	_procdir="${_rootdir}/proc"
39
	_procdir="${_rootdir}/proc"
40
	eval _hostname=\"\$jail_${_j}_hostname\"
40
	eval _hostname=\"\$jail_${_j}_hostname\"
41
	eval _name=\"\$jail_${_j}_name\"
41
	eval _ip=\"\$jail_${_j}_ip\"
42
	eval _ip=\"\$jail_${_j}_ip\"
42
	eval _interface=\"\${jail_${_j}_interface:-${jail_interface}}\"
43
	eval _interface=\"\${jail_${_j}_interface:-${jail_interface}}\"
43
	eval _exec=\"\$jail_${_j}_exec\"
44
	eval _exec=\"\$jail_${_j}_exec\"
Lines 95-100 Link Here
95
		fi
96
		fi
96
	fi
97
	fi
97
98
99
	# JAIL new style
100
	eval _v2=\"\${jail_v2_enable:-"NO"}\"
101
98
	# The default jail ruleset will be used by rc.subr if none is specified.
102
	# The default jail ruleset will be used by rc.subr if none is specified.
99
	eval _ruleset=\"\${jail_${_j}_devfs_ruleset:-${jail_devfs_ruleset}}\"
103
	eval _ruleset=\"\${jail_${_j}_devfs_ruleset:-${jail_devfs_ruleset}}\"
100
	eval _devfs=\"\${jail_${_j}_devfs_enable:-${jail_devfs_enable}}\"
104
	eval _devfs=\"\${jail_${_j}_devfs_enable:-${jail_devfs_enable}}\"
Lines 110-127 Link Here
110
	eval _fstab=\"\${jail_${_j}_fstab:-${jail_fstab}}\"
114
	eval _fstab=\"\${jail_${_j}_fstab:-${jail_fstab}}\"
111
	[ -z "${_fstab}" ] && _fstab="/etc/fstab.${_j}"
115
	[ -z "${_fstab}" ] && _fstab="/etc/fstab.${_j}"
112
	eval _flags=\"\${jail_${_j}_flags:-${jail_flags}}\"
116
	eval _flags=\"\${jail_${_j}_flags:-${jail_flags}}\"
113
	[ -z "${_flags}" ] && _flags="-l -U root"
117
	if checkyesno _v2; then
118
		[ -z "${_flags}" ] && _flags="-l -U root -c"
119
	else
120
		[ -z "${_flags}" ] && _flags="-l -U root"
121
	fi
114
	eval _consolelog=\"\${jail_${_j}_consolelog:-${jail_consolelog}}\"
122
	eval _consolelog=\"\${jail_${_j}_consolelog:-${jail_consolelog}}\"
115
	[ -z "${_consolelog}" ] && _consolelog="/var/log/jail_${_j}_console.log"
123
	[ -z "${_consolelog}" ] && _consolelog="/var/log/jail_${_j}_console.log"
116
	eval _fib=\"\${jail_${_j}_fib:-${jail_fib}}\"
124
	eval _fib=\"\${jail_${_j}_fib:-${jail_fib}}\"
125
	eval _vnet=\"\${jail_${_j}_vnet_enable:-"NO"}\"
117
126
118
	# Debugging aid
127
	# Debugging aid
119
	#
128
	#
129
	debug "$_j v2 enable: $_v2"
120
	debug "$_j devfs enable: $_devfs"
130
	debug "$_j devfs enable: $_devfs"
121
	debug "$_j fdescfs enable: $_fdescfs"
131
	debug "$_j fdescfs enable: $_fdescfs"
122
	debug "$_j procfs enable: $_procfs"
132
	debug "$_j procfs enable: $_procfs"
123
	debug "$_j mount enable: $_mount"
133
	debug "$_j mount enable: $_mount"
134
	debug "$_j vnet enable: $_vnet"
124
	debug "$_j hostname: $_hostname"
135
	debug "$_j hostname: $_hostname"
136
	debug "$_j name: $_name"
125
	debug "$_j ip: $_ip"
137
	debug "$_j ip: $_ip"
126
	jail_show_addresses ${_j}
138
	jail_show_addresses ${_j}
127
	debug "$_j interface: $_interface"
139
	debug "$_j interface: $_interface"
Lines 635-645 Link Here
635
			i=$((i + 1))
647
			i=$((i + 1))
636
		done
648
		done
637
649
638
		eval ${_setfib} jail ${_flags} -i ${_rootdir} ${_hostname} \
650
		if checkyesno _v2; then
639
			\"${_addrl}\" ${_exec_start} > ${_tmp_jail} 2>&1
651
			_start_cmd="${_setfib} jail -J ${_tmp_jail} ${_flags} path=${_rootdir} host.hostname=${_hostname} \
640
652
				name=\"${_name}\""
653
			if checkyesno _vnet; then
654
				_start_cmd="${_start_cmd} vnet"
655
			else
656
				_start_cmd="${_start_cmd} ip4.addr=\"${_addrl}\""
657
			fi
658
			 _start_cmd="${_start_cmd} command=${_exec_start}"
659
			eval ${_start_cmd} > /dev/null 2>&1
660
		else
661
			eval ${_setfib} jail ${_flags} -i ${_rootdir} ${_hostname} \
662
				\"${_addrl}\" ${_exec_start} > ${_tmp_jail} 2>&1
663
		fi
641
		if [ "$?" -eq 0 ] ; then
664
		if [ "$?" -eq 0 ] ; then
642
			_jail_id=$(head -1 ${_tmp_jail})
665
			if checkyesno _v2; then
666
				_jail_id=$(awk -F '=| ' '{print $2}' ${_tmp_jail})
667
			else
668
				_jail_id=$(head -1 ${_tmp_jail})
669
			fi
643
			i=1
670
			i=1
644
			while : ; do
671
			while : ; do
645
				eval out=\"\${_exec_afterstart${i}:-''}\"
672
				eval out=\"\${_exec_afterstart${i}:-''}\"

Return to bug 142972