Index: jail =================================================================== RCS file: /home/ncvs/src/etc/rc.d/jail,v retrieving revision 1.34 diff -u -r1.34 jail --- jail 30 May 2006 16:20:48 -0000 1.34 +++ jail 26 Jun 2006 15:36:01 -0000 @@ -21,13 +21,14 @@ init_variables() { _j="$1" + _name="$1" # This is for convenience only. if [ -z "$_j" ]; then warn "init_variables: you must specify a jail" return fi - eval _rootdir=\"\$jail_${_j}_rootdir\" + eval _rootdir=\"\${jail_${_j}_rootdir:-${jail_rootdir}}\" _devdir="${_rootdir}/dev" _fdescdir="${_devdir}/fd" _procdir="${_rootdir}/proc" @@ -68,6 +69,7 @@ eval _procfs=\"\${jail_${_j}_procfs_enable:-${jail_procfs_enable}}\" [ -z "${_procfs}" ] && _procfs="NO" + eval _mount_list=\"\${jail_${_j}_mount_list:-${jail_mount_list}}\" eval _mount=\"\${jail_${_j}_mount_enable:-${jail_mount_enable}}\" [ -z "${_mount}" ] && _mount="NO" # "/etc/fstab.${_j}" will be used for {,u}mount(8) if none is specified. @@ -154,6 +156,8 @@ # jail_umount_fs() { + local _i _args _mp + if checkyesno _fdescfs; then if [ -d "${_fdescdir}" ] ; then umount -f ${_fdescdir} >/dev/null 2>&1 @@ -169,6 +173,13 @@ umount -f ${_procdir} >/dev/null 2>&1 fi fi + if [ -n "${_mount_list}" ]; then + for _i in ${_mount_list}; do + eval _args=\$jail_mount_${_i}_args + _mp=${_args##* } + eval umount ${_args} >/dev/null 2>&1 + done + fi if checkyesno _mount; then [ -f "${_fstab}" ] || warn "${_fstab} does not exist" umount -a -F "${_fstab}" >/dev/null 2>&1 @@ -177,6 +188,8 @@ jail_start() { + local _i _args + echo -n 'Configuring jails:' set_sysctl jail_set_hostname_allow security.jail.set_hostname_allowed \ set_hostname_allow @@ -239,6 +252,13 @@ mount -t procfs proc "${_procdir}" fi fi + if [ -n "${_mount_list}" ]; then + info "Mounting per-jail filesystems" + for _i in ${_mount_list}; do + eval _args=\$jail_mount_${_i}_args + eval mount ${_args} + done + fi _tmp_jail=${_tmp_dir}/jail.$$ eval jail ${_flags} -i ${_rootdir} ${_hostname} \ ${_ip} ${_exec_start} > ${_tmp_jail} 2>&1