question about /etc/rc.d/jail

Alexander Pyhalov alp at rsu.ru
Tue Jun 22 14:55:44 UTC 2010


Hello.
I currently use FreeBSD 8-CURRENT (however, not very recent). We saw 
that jail naming was added to jexec call. However, /etc/rc.d/jail 
doesn't set jail name on jail startup, and so something like
jexec myjailname /bin/tcsh
doesn't work. Whas it done intentionally?
The attached patch solves this problem for me...
-- 
Best regards,
Alexander Pyhalov,
system administrator of Computer Center of South Federal University
-------------- next part --------------
--- /etc/rc.d/jail.orig	2010-06-22 18:21:14.000000000 +0400
+++ /etc/rc.d/jail	2010-06-22 18:19:43.000000000 +0400
@@ -38,6 +38,7 @@
 	_fdescdir="${_devdir}/fd"
 	_procdir="${_rootdir}/proc"
 	eval _hostname=\"\$jail_${_j}_hostname\"
+	eval _name=\"\$jail_${_j}_name\"
 	eval _ip=\"\$jail_${_j}_ip\"
 	eval _interface=\"\${jail_${_j}_interface:-${jail_interface}}\"
 	eval _exec=\"\$jail_${_j}_exec\"
@@ -634,9 +635,14 @@
 			${out}
 			i=$((i + 1))
 		done
-
-		eval ${_setfib} jail ${_flags} -i ${_rootdir} ${_hostname} \
-			\"${_addrl}\" ${_exec_start} > ${_tmp_jail} 2>&1
+		
+		if [ -z "${_name}" ] ; then
+			eval ${_setfib} jail ${_flags} -i ${_rootdir} ${_hostname} \
+				\"${_addrl}\" ${_exec_start} > ${_tmp_jail} 2>&1 
+		else
+			eval ${_setfib} jail -n ${_name} ${_flags} -i ${_rootdir} ${_hostname} \
+				\"${_addrl}\" ${_exec_start} > ${_tmp_jail} 2>&1
+		fi
 
 		if [ "$?" -eq 0 ] ; then
 			_jail_id=$(head -1 ${_tmp_jail})


More information about the freebsd-bugs mailing list