From nobody@FreeBSD.org  Sat Jan 23 21:38:53 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4B3171065676
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 23 Jan 2010 21:38:53 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 399B18FC0C
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 23 Jan 2010 21:38:53 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o0NLcqba085304
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 23 Jan 2010 21:38:52 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o0NLcqxO085297;
	Sat, 23 Jan 2010 21:38:52 GMT
	(envelope-from nobody)
Message-Id: <201001232138.o0NLcqxO085297@www.freebsd.org>
Date: Sat, 23 Jan 2010 21:38:52 GMT
From: Miroslav Lachman <000.fbsd@quip.cz>
To: freebsd-gnats-submit@FreeBSD.org
Subject: MFC rc.d/jail (pre|post)(start|stop) jail hooks in to 7.x before 7.3-RELEASE
X-Send-Pr-Version: www-3.1
X-GNATS-Notify: bz

>Number:         143137
>Category:       conf
>Synopsis:       MFC rc.d/jail (pre|post)(start|stop) jail hooks in to 7.x before 7.3-RELEASE
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    ed
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan 23 21:40:03 UTC 2010
>Closed-Date:    Sun Oct 23 22:49:39 UTC 2011
>Last-Modified:  Sun Oct 23 22:49:39 UTC 2011
>Originator:     Miroslav Lachman
>Release:        7.2 / 7-STABLE
>Organization:
codeLab.cz
>Environment:
FreeBSD 7.2-STABLE #0: Sun Dec  6 23:21:17 CET 2009     root@dust.hrej.cz:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
Can you please merge revisions 191620 and 193939 in to 7-STABLE before 7.3 freeze / release?

(pre|post)(start|stop) is in HEAD for 8 months and merge will not conflict with anything in 7.x branch. 
>How-To-Repeat:
Compare rc.d/jail on 8.0 and on 7.2
>Fix:
The patch is easy:
http://www.freebsd.org/cgi/cvsweb.cgi/src/etc/rc.d/jail.diff?r1=1.41;r2=1.43

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->ru 
Responsible-Changed-By: bz 
Responsible-Changed-When: Sat Jan 23 21:47:59 UTC 2010 
Responsible-Changed-Why:  
I think you originally comitted those in r191620; can you handle this? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=143137 
Responsible-Changed-From-To: ru->ed 
Responsible-Changed-By: ru 
Responsible-Changed-When: Sun Jan 24 17:00:35 UTC 2010 
Responsible-Changed-Why:  
I've merged r191620, now your turn for r193939. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=143137 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/143137: commit references a PR
Date: Sun, 24 Jan 2010 16:59:19 +0000 (UTC)

 Author: ru
 Date: Sun Jan 24 16:59:04 2010
 New Revision: 202937
 URL: http://svn.freebsd.org/changeset/base/202937
 
 Log:
   MFC: r191620: Added (pre|post)(start|stop) jail hooks.
   
   PR:		143137
   Approved by:	re (bz)
 
 Modified:
   stable/7/etc/rc.d/jail
   stable/7/share/man/man5/rc.conf.5   (contents, props changed)
 Directory Properties:
   stable/7/etc/   (props changed)
   stable/7/share/man/man5/   (props changed)
 
 Modified: stable/7/etc/rc.d/jail
 ==============================================================================
 --- stable/7/etc/rc.d/jail	Sun Jan 24 16:58:20 2010	(r202936)
 +++ stable/7/etc/rc.d/jail	Sun Jan 24 16:59:04 2010	(r202937)
 @@ -41,6 +41,14 @@ init_variables()
  	eval _ip=\"\$jail_${_j}_ip\"
  	eval _interface=\"\${jail_${_j}_interface:-${jail_interface}}\"
  	eval _exec=\"\$jail_${_j}_exec\"
 +
 +	i=0
 +	while : ; do
 +		eval _exec_prestart${i}=\"\${jail_${_j}_exec_prestart${i}:-\${jail_exec_prestart${i}}}\"
 +		[ -z "$(eval echo \"\$_exec_prestart${i}\")" ] && break
 +		i=$((i + 1))
 +	done
 +
  	eval _exec_start=\"\${jail_${_j}_exec_start:-${jail_exec_start}}\"
  
  	i=1
 @@ -49,8 +57,30 @@ init_variables()
  		[ -z "$(eval echo \"\$_exec_afterstart${i}\")" ] &&  break
  		i=$((i + 1))
  	done
 -	
 +
 +	i=0
 +	while : ; do
 +		eval _exec_poststart${i}=\"\${jail_${_j}_exec_poststart${i}:-\${jail_exec_poststart${i}}}\"
 +		[ -z "$(eval echo \"\$_exec_poststart${i}\")" ] && break
 +		i=$((i + 1))
 +	done
 +
 +	i=0
 +	while : ; do
 +		eval _exec_prestop${i}=\"\${jail_${_j}_exec_prestop${i}:-\${jail_exec_prestop${i}}}\"
 +		[ -z "$(eval echo \"\$_exec_prestop${i}\")" ] && break
 +		i=$((i + 1))
 +	done
 +
  	eval _exec_stop=\"\${jail_${_j}_exec_stop:-${jail_exec_stop}}\"
 +
 +	i=0
 +	while : ; do
 +		eval _exec_poststop${i}=\"\${jail_${_j}_exec_poststop${i}:-\${jail_exec_poststop${i}}}\"
 +		[ -z "$(eval echo \"\$_exec_poststop${i}\")" ] && break
 +		i=$((i + 1))
 +	done
 +
  	if [ -n "${_exec}" ]; then
  		#   simple/backward-compatible execution
  		_exec_start="${_exec}"
 @@ -102,9 +132,20 @@ init_variables()
  	debug "$_j procdir: $_procdir"
  	debug "$_j ruleset: $_ruleset"
  	debug "$_j fstab: $_fstab"
 -	debug "$_j exec start: $_exec_start"
  	debug "$_j consolelog: $_consolelog"
  
 +	i=0
 +	while : ; do
 +		eval out=\"\${_exec_prestart${i}:-''}\"
 +		if [ -z "$out" ]; then
 +			break
 +		fi
 +		debug "$_j exec pre-start #${i}: ${out}"
 +		i=$((i + 1))
 +	done
 +
 +	debug "$_j exec start: $_exec_start"
 +
  	i=1
  	while [ true ]; do
  		eval out=\"\${_exec_afterstart${i}:-''}\"
 @@ -117,7 +158,38 @@ init_variables()
  		i=$((i + 1))
  	done
  
 +	i=0
 +	while : ; do
 +		eval out=\"\${_exec_poststart${i}:-''}\"
 +		if [ -z "$out" ]; then
 +			break
 +		fi
 +		debug "$_j exec post-start #${i}: ${out}"
 +		i=$((i + 1))
 +	done
 +
 +	i=0
 +	while : ; do
 +		eval out=\"\${_exec_prestop${i}:-''}\"
 +		if [ -z "$out" ]; then
 +			break
 +		fi
 +		debug "$_j exec pre-stop #${i}: ${out}"
 +		i=$((i + 1))
 +	done
 +
  	debug "$_j exec stop: $_exec_stop"
 +
 +	i=0
 +	while : ; do
 +		eval out=\"\${_exec_poststop${i}:-''}\"
 +		if [ -z "$out" ]; then
 +			break
 +		fi
 +		debug "$_j exec post-stop #${i}: ${out}"
 +		i=$((i + 1))
 +	done
 +
  	debug "$_j flags: $_flags"
  	debug "$_j consolelog: $_consolelog"
  
 @@ -555,6 +627,15 @@ jail_start()
  			fi
  		fi
  		_tmp_jail=${_tmp_dir}/jail.$$
 +
 +		i=0
 +		while : ; do
 +			eval out=\"\${_exec_prestart${i}:-''}\"
 +			[ -z "$out" ] && break
 +			${out}
 +			i=$((i + 1))
 +		done
 +
  		eval ${_setfib} jail ${_flags} -i ${_rootdir} ${_hostname} \
  			\"${_addrl}\" ${_exec_start} > ${_tmp_jail} 2>&1
  
 @@ -575,6 +656,14 @@ jail_start()
  			echo -n " $_hostname"
  			tail +2 ${_tmp_jail} >${_consolelog}
  			echo ${_jail_id} > /var/run/jail_${_jail}.id
 +
 +			i=0
 +			while : ; do
 +				eval out=\"\${_exec_poststart${i}:-''}\"
 +				[ -z "$out" ] && break
 +				${out}
 +				i=$((i + 1))
 +			done
  		else
  			jail_umount_fs
  			jail_ips "del"
 @@ -596,6 +685,15 @@ jail_stop()
  			_jail_id=$(cat /var/run/jail_${_jail}.id)
  			if [ ! -z "${_jail_id}" ]; then
  				init_variables $_jail
 +
 +				i=0
 +				while : ; do
 +					eval out=\"\${_exec_prestop${i}:-''}\"
 +					[ -z "$out" ] && break
 +					${out}
 +					i=$((i + 1))
 +				done
 +
  				if [ -n "${_exec_stop}" ]; then
  					eval env -i /usr/sbin/jexec ${_jail_id} ${_exec_stop} \
  						>> ${_consolelog} 2>&1
 @@ -605,6 +703,14 @@ jail_stop()
  				killall -j ${_jail_id} -KILL > /dev/null 2>&1
  				jail_umount_fs
  				echo -n " $_hostname"
 +
 +				i=0
 +				while : ; do
 +					eval out=\"\${_exec_poststop${i}:-''}\"
 +					[ -z "$out" ] && break
 +					${out}
 +					i=$((i + 1))
 +				done
  			fi
  			jail_ips "del"
  			rm /var/run/jail_${_jail}.id
 
 Modified: stable/7/share/man/man5/rc.conf.5
 ==============================================================================
 --- stable/7/share/man/man5/rc.conf.5	Sun Jan 24 16:58:20 2010	(r202936)
 +++ stable/7/share/man/man5/rc.conf.5	Sun Jan 24 16:59:04 2010	(r202937)
 @@ -3455,6 +3455,13 @@ to
  .Dq Li YES
  by default for every jail in
  .Va jail_list .
 +.It Va jail_exec_prestart Ns Aq Ar N
 +.Pq Vt str
 +Unset by default.
 +When set, use as default value for
 +.Va jail_ Ns Ao Ar jname Ac Ns Va _exec_prestart Ns Aq Ar N
 +for every jail in
 +.Va jail_list .
  .It Va jail_exec_start
  .Pq Vt str
  Unset by default.
 @@ -3469,12 +3476,33 @@ When set, use as default value for
  .Va jail_ Ns Ao Ar jname Ac Ns Va _exec_afterstart Ns Aq Ar N
  for every jail in
  .Va jail_list .
 +.It Va jail_exec_poststart Ns Aq Ar N
 +.Pq Vt str
 +Unset by default.
 +When set, use as default value for
 +.Va jail_ Ns Ao Ar jname Ac Ns Va _exec_poststart Ns Aq Ar N
 +for every jail in
 +.Va jail_list .
 +.It Va jail_exec_prestop Ns Aq Ar N
 +.Pq Vt str
 +Unset by default.
 +When set, use as default value for
 +.Va jail_ Ns Ao Ar jname Ac Ns Va _exec_prestop Ns Aq Ar N
 +for every jail in
 +.Va jail_list .
  .It Va jail_exec_stop
  Unset by default.
  When set, use as default value for
  .Va jail_ Ns Ao Ar jname Ac Ns Va _exec_stop
  for every jail in
  .Va jail_list .
 +.It Va jail_exec_poststop Ns Aq Ar N
 +.Pq Vt str
 +Unset by default.
 +When set, use as default value for
 +.Va jail_ Ns Ao Ar jname Ac Ns Va _exec_poststop Ns Aq Ar N
 +for every jail in
 +.Va jail_list .
  .It Va jail_ Ns Ao Ar jname Ac Ns Va _rootdir
  .Pq Vt str
  Unset by default.
 @@ -3589,27 +3617,68 @@ When set to
  mount the process file system inside jail
  .Ar jname
  at jail startup.
 +.It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_prestart Ns Aq Ar N
 +.Pq Vt str
 +Unset by default.
 +This is the command run as
 +.Ar N Ns
 +th command
 +before jail startup, where
 +.Ar N
 +is 0, 1, and so on.
 +It is run outside the jail.
  .It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_start
  .Pq Vt str
  Set to
  .Dq Li /bin/sh /etc/rc
  by default.
 -This is the command executed at jail startup.
 +This is the command executed in a jail at jail startup.
  .It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_afterstart Ns Aq Ar N
  .Pq Vt str
  Unset by default.
  This is the command run as
  .Ar N Ns
  th command
 +in a jail
  after jail startup, where
  .Ar N
  is 1, 2, and so on.
 +.It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_poststart Ns Aq Ar N
 +.Pq Vt str
 +Unset by default.
 +This is the command run as
 +.Ar N Ns
 +th command
 +after jail startup, where
 +.Ar N
 +is 0, 1, and so on.
 +It is run outside the jail.
 +.It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_prestop Ns Aq Ar N
 +.Pq Vt str
 +Unset by default.
 +This is the command run as
 +.Ar N Ns
 +th command
 +before jail shutdown, where
 +.Ar N
 +is 0, 1, and so on.
 +It is run outside the jail.
  .It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_stop
  .Pq Vt str
  Set to
  .Dq Li /bin/sh /etc/rc.shutdown
  by default.
 -This is the command executed at jail shutdown.
 +This is the command executed in a jail at jail shutdown.
 +.It Va jail_ Ns Ao Ar jname Ac Ns Va _exec_poststop Ns Aq Ar N
 +.Pq Vt str
 +Unset by default.
 +This is the command run as
 +.Ar N Ns
 +th command
 +after jail shutdown, where
 +.Ar N
 +is 0, 1, and so on.
 +It is run outside the jail.
  .It Va jail_set_hostname_allow
  .Pq Vt bool
  If set to
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: Ed Schouten <ed@80386.nl>
To: bug-followup@FreeBSD.org, 000.fbsd@quip.cz
Cc: ru@FreeBSD.org, bz@FreeBSD.org
Subject: Re: conf/143137: MFC rc.d/jail (pre|post)(start|stop) jail hooks
 in to 7.x before 7.3-RELEASE
Date: Sun, 24 Jan 2010 20:09:57 +0100

 --9Dz7ZkHOyZKsJidB
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 * ru@FreeBSD.org <ru@FreeBSD.org> wrote:
 > I've merged r191620, now your turn for r193939.
 
 Just out of curiosity, is there a specific reason why we need to MFC
 r193939? I wouldn't mind doing so, but I'm just a bit puzzled why.
 
 --=20
  Ed Schouten <ed@80386.nl>
  WWW: http://80386.nl/
 
 --9Dz7ZkHOyZKsJidB
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.10 (FreeBSD)
 
 iEYEARECAAYFAktcmwUACgkQ52SDGA2eCwUyRACfVdaBfTa7jGpJA4+UmHRyZ8s7
 Q7sAnixbheGDzjWwCD4gQJ6tqY3s1Zaj
 =T0BH
 -----END PGP SIGNATURE-----
 
 --9Dz7ZkHOyZKsJidB--

From: Miroslav Lachman <000.fbsd@quip.cz>
To: Ed Schouten <ed@80386.nl>
Cc: bug-followup@FreeBSD.org, ru@FreeBSD.org, bz@FreeBSD.org
Subject: Re: conf/143137: MFC rc.d/jail (pre|post)(start|stop) jail hooks
 in to 7.x before 7.3-RELEASE
Date: Sun, 24 Jan 2010 21:58:07 +0100

 Ed Schouten wrote:
 > * ru@FreeBSD.org<ru@FreeBSD.org>  wrote:
 >> I've merged r191620, now your turn for r193939.
 >
 > Just out of curiosity, is there a specific reason why we need to MFC
 > r193939? I wouldn't mind doing so, but I'm just a bit puzzled why.
 
 It is just a cosmetic change. I proposed it to make rc.d/jail on the 7.3 
 the same as on the 8.0. No other strong reason.

From: Miroslav Lachman <000.fbsd@quip.cz>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/143137: MFC rc.d/jail (pre|post)(start|stop) jail hooks
 in to 7.x before 7.3-RELEASE
Date: Mon, 13 Dec 2010 11:09:24 +0100

 I think this PR can be closed if there is no will to merge minor 
 cosmetic changes from 8.x version to 7.4 before release.
State-Changed-From-To: open->closed 
State-Changed-By: eadler 
State-Changed-When: Sun Oct 23 22:49:37 UTC 2011 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=143137 
>Unformatted:
