From owner-freebsd-bugs@FreeBSD.ORG Mon Sep 17 13:40:02 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 4788916A418 for ; Mon, 17 Sep 2007 13:40:02 +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 1937F13C45D for ; Mon, 17 Sep 2007 13:40:02 +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 l8HDe1Yr061761 for ; Mon, 17 Sep 2007 13:40:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l8HDe1Va061760; Mon, 17 Sep 2007 13:40:01 GMT (envelope-from gnats) Resent-Date: Mon, 17 Sep 2007 13:40:01 GMT Resent-Message-Id: <200709171340.l8HDe1Va061760@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jeremie Le Hen Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18A1E16A468 for ; Mon, 17 Sep 2007 13:32:44 +0000 (UTC) (envelope-from tataz@tataz.chchile.org) Received: from postfix1-g20.free.fr (postfix1-g20.free.fr [212.27.60.42]) by mx1.freebsd.org (Postfix) with ESMTP id A052E13C468 for ; Mon, 17 Sep 2007 13:32:43 +0000 (UTC) (envelope-from tataz@tataz.chchile.org) Received: from smtp5-g19.free.fr (smtp5-g19.free.fr [212.27.42.35]) by postfix1-g20.free.fr (Postfix) with ESMTP id 7E6C719E05B9 for ; Mon, 17 Sep 2007 14:57:38 +0200 (CEST) Received: from smtp5-g19.free.fr (localhost.localdomain [127.0.0.1]) by smtp5-g19.free.fr (Postfix) with ESMTP id CCEDE52B83 for ; Mon, 17 Sep 2007 14:57:36 +0200 (CEST) Received: from tatooine.tataz.chchile.org (tataz.chchile.org [82.233.239.98]) by smtp5-g19.free.fr (Postfix) with ESMTP id C5BC552B79 for ; Mon, 17 Sep 2007 14:57:35 +0200 (CEST) Received: from obiwan.tataz.chchile.org (unknown [192.168.1.25]) by tatooine.tataz.chchile.org (Postfix) with ESMTP id A1B9C9BF12; Mon, 17 Sep 2007 12:56:13 +0000 (UTC) Received: by obiwan.tataz.chchile.org (Postfix, from userid 1000) id 9B2C6405D; Mon, 17 Sep 2007 14:56:13 +0200 (CEST) Message-Id: <20070917125613.9B2C6405D@obiwan.tataz.chchile.org> Date: Mon, 17 Sep 2007 14:56:13 +0200 (CEST) From: Jeremie Le Hen To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Jeremie Le Hen Subject: 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 13:40:02 -0000 >Number: 116416 >Category: conf >Synopsis: [patch] per-jail rc.conf(5) style configuration file in /etc/jail/ >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Sep 17 13:40:01 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Jeremie Le Hen >Release: FreeBSD 6.2-PRERELEASE i386 >Organization: >Environment: FreeBSD 7.0-CURRENT >Description: This patch changes etc/rc.d/jail: for a given jail $j, it will look for /etc/jail/$j. If it exists, it will mostly source it, except that the file only has to contain the parameter name "param" instead of "jail_$j_param". The main benefit of this patch is that adding or removing a jail is far more easily scriptable than it is currently. For instance, let's say your current rc.conf(5) contains: % jail_enable="YES" % jail_list="test" % jail_test_rootdir="/jail/test" % jail_test_hostname="test.my.domain" % jail_test_ip="10.11.12.13" You can remove the last three lines and put the following in /etc/jail/test: % rootdir="/jail/test" % hostname="test.my.domain" % ip="10.11.12.13" The patch is very little intrusive and works well. I've not yet documented it because I don't know where to insert it, but I would be glad to do it. Please contact me if you have any idea about this. --- 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 12:22:01 -0000 @@ -27,6 +27,14 @@ init_variables() return fi + if [ -f "/etc/jail/$_j" ]; then + eval `awk -v j="$_j" \ + '/^[[:blank:]]*[a-zA-Z_][a-zA-Z0-9_]*=/ { + sub(/^[[:blank:]]+/, "") + print sprintf("jail_%s_%s", j, $0) + }' "/etc/jail/$_j"` + fi + eval _rootdir=\"\$jail_${_j}_rootdir\" _devdir="${_rootdir}/dev" _fdescdir="${_devdir}/fd" --- etc_jail.diff ends here --- >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: