From owner-freebsd-bugs@FreeBSD.ORG Mon Sep 17 15:30:15 2007 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B96F16A46B for ; Mon, 17 Sep 2007 15:30:15 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 69CB713C459 for ; Mon, 17 Sep 2007 15:30:15 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id l8HFUEl1066421 for ; Mon, 17 Sep 2007 15:30:14 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l8HFUEKP066420; Mon, 17 Sep 2007 15:30:14 GMT (envelope-from gnats) Date: Mon, 17 Sep 2007 15:30:14 GMT Message-Id: <200709171530.l8HFUEKP066420@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Jeremie Le Hen Cc: Subject: Re: conf/116416: [patch] per-jail rc.conf(5) style configuration file in /etc/jail/ X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jeremie Le Hen List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Sep 2007 15:30:15 -0000 The following reply was made to PR conf/116416; it has been noted by GNATS. From: Jeremie Le Hen To: FreeBSD-gnats-submit@freebsd.org Cc: Jeremie Le Hen Subject: Re: conf/116416: [patch] per-jail rc.conf(5) style configuration file in /etc/jail/ Date: Mon, 17 Sep 2007 17:22:29 +0200 (CEST) >Submitter-Id: current-users >Originator: Jeremie Le Hen >Confidential: no >Synopsis: Re: conf/116416: [patch] per-jail rc.conf(5) style configuration file in /etc/jail/ >Severity: non-critical >Priority: low >Category: conf >Class: change-request >Release: FreeBSD 7.0-CURRENT >Environment: FreeBSD 7.0-CURRENT >Description: This patch improves the previous one in that if $jail_list is empty, the rc.d script will deduce it from the content of /etc/jail/. This is even more easier to add/remove jail inside a script. >Fix: --- etc_jail.diff begins here --- Index: jail =================================================================== RCS file: /home/ncvs/src/etc/rc.d/jail,v retrieving revision 1.37 diff -u -p -u -r1.37 jail --- jail 24 May 2007 06:01:06 -0000 1.37 +++ jail 17 Sep 2007 15:14:34 -0000 @@ -14,6 +14,8 @@ name="jail" rcvar=`set_rcvar` start_cmd="jail_start" stop_cmd="jail_stop" +start_precmd="jail_prestart" +jails_confdir="/etc/jail" # init_variables _j # Initialize the various jail variables for jail _j. @@ -27,6 +29,14 @@ init_variables() return fi + if [ -f "$jails_confdir/$_j" ]; then + eval `awk -v j="$_j" \ + '/^[[:blank:]]*[a-zA-Z_][a-zA-Z0-9_]*=/ { + sub(/^[[:blank:]]+/, "") + print sprintf("jail_%s_%s", j, $0) + }' "$jails_confdir/$_j"` + fi + eval _rootdir=\"\$jail_${_j}_rootdir\" _devdir="${_rootdir}/dev" _fdescdir="${_devdir}/fd" @@ -267,6 +277,17 @@ jail_mount_fstab() mount -a -F "${_fstab}" } +# jail_prestart +# If jail_list is empty, compute it from $jails_confdir. +jail_prestart() +{ + [ -z "$jail_list" ] || return 0 + [ -d "$jails_confdir" ] || return 0 + + jail_list=`ls "$jails_confdir"` + return 0 +} + jail_start() { echo -n 'Configuring jails:' --- etc_jail.diff ends here ---