From owner-svn-src-head@FreeBSD.ORG Mon Oct 14 11:05:14 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 0B23F1A0; Mon, 14 Oct 2013 11:05:14 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id ECF612BF7; Mon, 14 Oct 2013 11:05:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9EB5DWP040371; Mon, 14 Oct 2013 11:05:13 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9EB5DVu040370; Mon, 14 Oct 2013 11:05:13 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201310141105.r9EB5DVu040370@svn.freebsd.org> From: Hiroki Sato Date: Mon, 14 Oct 2013 11:05:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r256440 - head/etc/rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2013 11:05:14 -0000 Author: hrs Date: Mon Oct 14 11:05:13 2013 New Revision: 256440 URL: http://svnweb.freebsd.org/changeset/base/256440 Log: - Normalize jailname. "example.com" is converted to "example_com". - Fix a bug that some $jail_{jname}_foo variables did not work. - Fix a bug which prevented $jail_devfs_ruleset from working[1]. - Move $jail_parameters to the last of the configuraiton lines[1]. Reported by: Jase Thew[1] Approved by: re (glebius) Modified: head/etc/rc.d/jail Modified: head/etc/rc.d/jail ============================================================================== --- head/etc/rc.d/jail Mon Oct 14 09:28:46 2013 (r256439) +++ head/etc/rc.d/jail Mon Oct 14 11:05:13 2013 (r256440) @@ -94,7 +94,7 @@ extract_var() # parse_options() { - local _j + local _j _p _j=$1 _confwarn=0 @@ -166,7 +166,7 @@ parse_options() jail_handle_ips_option $_ip $_interface alias=0 while : ; do - eval _x=\"\$jail_${_jail}_ip_multi${alias}\" + eval _x=\"\$jail_${_j}_ip_multi${alias}\" [ -z "$_x" ] && break jail_handle_ips_option $_x $_interface @@ -208,6 +208,7 @@ parse_options() eval : \${jail_${_j}_devfs_enable:=${jail_devfs_enable:-NO}} if checkyesno jail_${_j}_devfs_enable; then echo " mount.devfs;" + eval _ruleset=\${jail_${_j}_devfs_ruleset:-${jail_devfs_ruleset}} case $_ruleset in "") ;; [0-9]*) echo " devfs_ruleset = \"$_ruleset\";" ;; @@ -217,7 +218,7 @@ parse_options() # mount(8) only accepts an integer. # This should accept a ruleset name. ;; - *) warn "devfs_ruleset must be integer." ;; + *) warn "devfs_ruleset must be an integer." ;; esac if [ -r $_fstab ]; then echo " mount.fstab = \"$_fstab\";" @@ -234,8 +235,6 @@ parse_options() "\"procfs ${_rootdir%/}/proc procfs rw 0 0\";" fi - echo " ${_parameters};" - eval : \${jail_${_j}_mount_enable:=${jail_mount_enable:-NO}} if checkyesno jail_${_j}_mount_enable; then echo " allow.mount;" >> $_conf @@ -243,6 +242,9 @@ parse_options() extract_var $_j set_hostname_allow allow.set_hostname YN NO extract_var $_j sysvipc_allow allow.sysvipc YN NO + for _p in $_parameters; do + echo " ${_p%\;};" + done echo "}" ) >> $_conf @@ -376,26 +378,32 @@ jail_handle_ips_option() jail_config() { + local _j + case $1 in _ALL) return ;; esac - for _jail in $@; do - if parse_options $_jail; then - echo "$_jail: parameters are in $_conf." + for _j in $@; do + _j=$(echo $_j | tr /. _) + if parse_options $_j; then + echo "$_j: parameters are in $_conf." fi done } jail_console() { + local _j + # One argument that is not _ALL. case $#:$1 in 1:_ALL) err 3 "Specify a jail name." ;; 1:*) ;; *) err 3 "Specify a jail name." ;; esac - eval _cmd=\${jail_$1_consolecmd:-$jail_consolecmd} - $jail_jexec $1 $_cmd + _j=$(echo $1 | tr /. _) + eval _cmd=\${jail_${_j}_consolecmd:-$jail_consolecmd} + $jail_jexec $_j $_cmd } jail_status() @@ -406,6 +414,8 @@ jail_status() jail_start() { + local _j + if [ $# = 0 ]; then return fi @@ -422,21 +432,22 @@ jail_start() ;; esac _tmp=`mktemp -t jail` || exit 3 - for _jail in $@; do - parse_options $_jail || continue + for _j in $@; do + _j=$(echo $_j | tr /. _) + parse_options $_j || continue eval rc_flags=\${jail_${_j}_flags:-$jail_flags} eval command=\${jail_${_j}_program:-$jail_program} if checkyesno jail_parallel_start; then - command_args="-i -f $_conf -c $_jail &" + command_args="-i -f $_conf -c $_j &" else - command_args="-i -f $_conf -c $_jail" + command_args="-i -f $_conf -c $_j" fi if $command $rc_flags $command_args \ >> $_tmp 2>&1