From owner-freebsd-bugs@FreeBSD.ORG Fri Jan 23 06:50:30 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9B2A416A4CE for ; Fri, 23 Jan 2004 06:50:30 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id B3AA943D3F for ; Fri, 23 Jan 2004 06:50:21 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i0NEoLFR007440 for ; Fri, 23 Jan 2004 06:50:21 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i0NEoLto007433; Fri, 23 Jan 2004 06:50:21 -0800 (PST) (envelope-from gnats) Date: Fri, 23 Jan 2004 06:50:21 -0800 (PST) Message-Id: <200401231450.i0NEoLto007433@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Oliver Eikemeier Subject: Re: conf/56736: [PATCH] rcNG: enable packages to participate in rcorder(8) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Oliver Eikemeier List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jan 2004 14:50:30 -0000 The following reply was made to PR conf/56736; it has been noted by GNATS. From: Oliver Eikemeier To: freebsd-gnats-submit@FreeBSD.org Cc: Subject: Re: conf/56736: [PATCH] rcNG: enable packages to participate in rcorder(8) Date: Fri, 23 Jan 2004 15:48:33 +0100 An updated patch, which does essentially the following: - create a dummy dependency /etc/rc.d/PORTS - executes /etc/rc startup as normal until /etc/rc.d/PORTS, then reevalutes rcorder(8), including scripts from ${local_startup} - include ${local_startup} in /etc/rc.shutdown - does not start nor stop scripts containing '^# KEYWORD:' from /etc/rc.d/localpkg, as they are already handled by /etc/rc and /etc/rc.shutdown The only remaining problem is that '*.sh' scripts are sourced from /etc/rc.subr, instead of executed in a subshell. Therefore ports should install their start/stop scripts as ${PREFIX}/etc/rc.d/${PKGBASE} and add a small stub ${PREFIX}/etc/rc.d/${PKGBASE}.sh: #!/bin/sh # # $FreeBSD$ # # KEYWORD: FreeBSD nostart if [ -r ${0%%.sh} ]; then . ${0%%.sh} fi Patch for rc, rc.shutdown, rc.d/localpkg and rc.d/PORTS: --- src/etc/rc.orig Fri May 2 07:27:33 2003 +++ src/etc/rc Fri Jan 23 15:35:40 2004 @@ -53,7 +53,7 @@ . /etc/rc.subr # Note: the system configuration files are loaded as part of -# the RCNG system (rc.d/rccond). Do not load them here as it may +# the RCNG system (rc.d/rcconf.sh). Do not load them here as it may # interfere with diskless booting. # if [ "$1" = autoboot ]; then @@ -69,6 +69,35 @@ files=`rcorder -k ${os} -s nostart /etc/rc.d/* 2>/dev/null` for _rc_elem in ${files}; do + if [ ${_rc_elem} = "/etc/rc.d/PORTS" ]; then + break + fi + run_rc_script ${_rc_elem} ${_boot} +done + +# system configuration is loaded, reevalute rcorder +case ${local_startup} in +[Nn][Oo] | '') + ;; +*) + _rc_startup="/etc/rc.d/*" + for d in ${local_startup}; do + if [ -d $d ]; then + _rc_startup="${_rc_startup} ${d}/*" + fi + done + files=`rcorder -k ${os} -s nostart ${_rc_startup} 2>/dev/null` +esac + +_rc_done=true +for _rc_elem in ${files}; do + if ${_rc_done}; then + if [ ${_rc_elem} = "/etc/rc.d/PORTS" ]; then + _rc_done=false + else + continue + fi + fi run_rc_script ${_rc_elem} ${_boot} done --- src/etc/rc.shutdown.orig Tue Jul 8 04:52:14 2003 +++ src/etc/rc.shutdown Fri Jan 23 15:39:01 2004 @@ -82,7 +82,19 @@ # XXX - rcorder(8) with multiple -k switches works as a logical OR, # so, we can't do this: rcorder -k shutdown -k FreeBSD. # -files=`eval grep -l \'^# KEYWORD:.*FreeBSD\' \`rcorder -k shutdown /etc/rc.d/* 2>/dev/null\`` +_rc_startup="/etc/rc.d/*" +case ${local_startup} in +[Nn][Oo] | '') + ;; +*) + for d in ${local_startup}; do + if [ -d $d ]; then + _rc_startup="${_rc_startup} ${d}/*" + fi + done + ;; +esac +files=`eval grep -l \'^# KEYWORD:.*FreeBSD\' \`rcorder -k shutdown ${_rc_startup} 2>/dev/null\`` for _rc_elem in `reverse_list $files`; do debug "run_rc_script $_rc_elem stop" --- src/etc/rc.d/localpkg.orig Wed Aug 6 02:35:13 2003 +++ src/etc/rc.d/localpkg Fri Jan 23 13:08:48 2004 @@ -30,7 +30,9 @@ for dir in ${local_startup}; do if [ -d "${dir}" ]; then for script in ${dir}/*.sh; do - slist="${slist}${script_name_sep}${script}" + if ! grep -sq '^# KEYWORD:' ${script}; then + slist="${slist}${script_name_sep}${script}" + fi done fi done @@ -67,7 +69,9 @@ for dir in ${local_startup}; do if [ -d "${dir}" ]; then for script in ${dir}/*.sh; do - slist="${slist}${script_name_sep}${script}" + if ! grep -sq '^# KEYWORD:' ${script}; then + slist="${slist}${script_name_sep}${script}" + fi done fi done --- src/etc/rc.d/PORTS.orig Fri Jan 23 15:11:00 2004 +++ src/etc/rc.d/PORTS Fri Jan 23 13:09:50 2004 @@ -0,0 +1,11 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: PORTS +# REQUIRE: diskless mountcritlocal +# BEFORE: addswap random +# KEYWORD: FreeBSD + +# This is a dummy dependency to include ports into rcorder(8)