From owner-freebsd-current@FreeBSD.ORG Mon Mar 14 22:06:41 2005 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5D32416A4CE for ; Mon, 14 Mar 2005 22:06:41 +0000 (GMT) Received: from 62-15-215-140.inversas.jazztel.es (62-15-215-140.inversas.jazztel.es [62.15.215.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id CDA3E43D55 for ; Mon, 14 Mar 2005 22:06:39 +0000 (GMT) (envelope-from josemi@freebsd.jazztel.es) Received: from redesjm.local (orion.redesjm.local [192.168.254.16]) j2EM6blZ007191 for ; Mon, 14 Mar 2005 23:06:37 +0100 (CET) (envelope-from freebsd@redesjm.local) Received: from localhost (localhost [[UNIX: localhost]]) by redesjm.local (8.13.3/8.13.3/Submit) id j2EM6sBX064523 for current@freebsd.org; Mon, 14 Mar 2005 23:06:54 +0100 (CET) (envelope-from freebsd@redesjm.local) From: Jose M Rodriguez To: current@freebsd.org Date: Mon, 14 Mar 2005 23:06:54 +0100 User-Agent: KMail/1.7.2 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_+rgNChGD7FkTmrV" Message-Id: <200503142306.54642.freebsd@redesjm.local> X-AntiVirus: checked by AntiVir Milter (version: 1.1.0-3; AVE: 6.29.0.8; VDF: 6.29.0.100; host: antares.redesjm.local) Subject: rcNG changes/aditions X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Mar 2005 22:06:41 -0000 --Boundary-00=_+rgNChGD7FkTmrV Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, I'll glad to know if this is of interest: update to PR conf/75137 (sound modules): I rework this adding support for preloaded modules to /etc/rc.subr update to PR conf/74006 (named minor fixes): Fix a typo and umount dev in chroot in post_stop works -- josemi --Boundary-00=_+rgNChGD7FkTmrV Content-Type: text/x-diff; charset="us-ascii"; name="patch-rcNG" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch-rcNG" --- /usr/RELENG_5/src/etc/rc.subr Mon Jan 17 12:51:00 2005 +++ etc/rc.subr Mon Mar 14 00:01:34 2005 @@ -319,6 +319,23 @@ } # +# preload_modules module [...] +# Try to kldload the given modules if not loaded. +# Return 0 on success, kldload error otherwise. +preload_modules() +{ + while [ $# -ge 1 ]; do + if ! /sbin/kldstat -n $1 > /dev/null 2>&1; then + /sbin/kldload $1 + _return=$? + [ ${_return} -ne 0 ] && return ${_return} + fi + shift + done + return 0 +} + +# # run_rc_command argument # Search for argument in the list of supported commands, which is: # "start stop restart rcvar status poll ${extra_commands}" @@ -381,6 +398,9 @@ # to run the chrooted ${command} with. # Requires /usr to be mounted. # +# ${name}_modules n If set, try to load the given modules before +# running the default (re)start command. +# # ${rc_arg}_cmd n If set, use this as the method when invoked; # Otherwise, use default command (see below) # @@ -633,6 +653,16 @@ fi fi done + # try to load ${name}_modules + # + eval "_modules=\$${name}_modules" + if [ -n "${_modules}" ]; then + debug "run_rc_command: kldload ${_modules}." + eval "preload_modules ${_modules}" + _return=$? + [ $_return -ne 0 ] && [ -z "$rc_force" ] && + return 1 + fi # if the precmd failed and force # isn't set, exit --- /usr/RELENG_5/src/etc/rc.d/mixer Sun Oct 10 11:50:53 2004 +++ etc/rc.d/mixer Mon Mar 14 00:02:08 2005 @@ -81,6 +81,10 @@ { local mixer + if [ -n "${mixer_modules}" ]; then + eval "preload_modules ${mixer_modules}" + fi + for mixer in `list_mixers`; do mixer_restore ${mixer} done --- /usr/RELENG_5/src/etc/rc.d/named Sun Oct 10 11:50:53 2004 +++ etc/rc.d/named Mon Mar 14 00:01:56 2005 @@ -14,6 +14,7 @@ rcvar=`set_rcvar` start_precmd="named_precmd" start_postcmd="make_symlinks" +stop_postcmd="named_postcmd" required_dirs="$named_chrootdir" # if it is set, it must exist extra_commands="reload" @@ -30,36 +31,16 @@ { # Create (or update) the chroot directory structure # - if [ -f /etc/mtree/BIND.chroot.dist ]; then - mtree -deU -f /etc/mtree/BIND.chroot.dist \ + if [ -f ${named_chroot_mtree:=/etc/mtree/BIND.chroot.dist} ]; then + mtree -deU -f ${named_chroot_mtree} \ -p ${named_chrootdir} else - warn "/etc/mtree/BIND.chroot.dist missing," + warn "${named_chroot_mtree} missing," warn "chroot directory structure not updated" fi # Create /etc/namedb symlink - # - if [ ! -L /etc/namedb ]; then - if [ -d /etc/namedb ]; then - warn "named chroot: /etc/namedb is a directory!" - elif [ -e /etc/namedb ]; then - warn "named chroot: /etc/namedb exists!" - else - ln -s ${named_chrootdir}/etc/namedb /etc/namedb - fi - fi - - # Mount a devfs in the chroot directory if needed - # - if [ ! -c ${named_chrootdir}/dev/random -o \ - ! -c ${named_chrootdir}/dev/null ]; then - umount ${named_chrootdir}/dev 2>/dev/null - mount_devfs devfs ${named_chrootdir}/dev - fi - devfs -m ${named_chrootdir}/dev rule apply hide - devfs -m ${named_chrootdir}/dev rule apply path null unhide - devfs -m ${named_chrootdir}/dev rule apply path random unhide + # this must be a mergemaster task # Copy local timezone information if it is not up to date. # @@ -87,6 +68,16 @@ rc_flags="$rc_flags -t $named_chrootdir" confgen_chroot="-t${named_chrootdir} -u bind" checkyesno named_chroot_autoupdate && chroot_autoupdate + # Mount a devfs in the chroot directory if needed + # + if [ ! -c ${named_chrootdir}/dev/random -o \ + ! -c ${named_chrootdir}/dev/null ]; then + umount ${named_chrootdir}/dev 2>/dev/null + mount_devfs devfs ${named_chrootdir}/dev + fi + devfs -m ${named_chrootdir}/dev rule apply hide + devfs -m ${named_chrootdir}/dev rule apply path null unhide + devfs -m ${named_chrootdir}/dev rule apply path random unhide else named_symlink_enable=NO fi @@ -96,6 +87,13 @@ if [ ! -f "${named_chrootdir}/etc/namedb/rndc.key" -a \ ! -f "${named_chrootdir}/etc/namedb/rndc.conf" ]; then rndc-confgen -a -b256 ${confgen_chroot} + fi +} + +named_postcmd() { + # Is the user using a sandbox? + if [ -n "$named_chrootdir" ]; then + umount ${named_chrootdir}/dev 2>/dev/null fi } --Boundary-00=_+rgNChGD7FkTmrV--