From owner-freebsd-bugs@FreeBSD.ORG Fri Sep 12 08:40:17 2003 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 D0A1116A4C0 for ; Fri, 12 Sep 2003 08:40:17 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6F4C443FE3 for ; Fri, 12 Sep 2003 08:40:14 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h8CFeEUp046228 for ; Fri, 12 Sep 2003 08:40:14 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h8CFeE7W046227; Fri, 12 Sep 2003 08:40:14 -0700 (PDT) Resent-Date: Fri, 12 Sep 2003 08:40:14 -0700 (PDT) Resent-Message-Id: <200309121540.h8CFeE7W046227@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, Oliver Eikemeier Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C6AEB16A4BF for ; Fri, 12 Sep 2003 08:30:29 -0700 (PDT) Received: from mx2.fillmore-labs.com (lima.fillmore-labs.com [62.138.193.83]) by mx1.FreeBSD.org (Postfix) with ESMTP id 793F943FF3 for ; Fri, 12 Sep 2003 08:30:26 -0700 (PDT) (envelope-from eikemeier@fillmore-labs.com) Received: from p5080ba02.dip.t-dialin.net ([80.128.186.2] helo=fillmore-labs.com ident=29sps6mv8tz2c6a8) by mx2.fillmore-labs.com with asmtp (TLSv1:AES256-SHA:256) (Exim 4.22) id 19xpsO-000N9C-Pt for FreeBSD-gnats-submit@FreeBSD.org; Fri, 12 Sep 2003 17:30:25 +0200 Message-Id: <3F61E68D.8040205@fillmore-labs.com> Date: Fri, 12 Sep 2003 17:30:21 +0200 From: Oliver Eikemeier To: FreeBSD-gnats-submit@FreeBSD.org Subject: 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 List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Sep 2003 15:40:18 -0000 >Number: 56736 >Category: conf >Synopsis: [PATCH] rcNG: enable packages to participate in rcorder(8) >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Sep 12 08:40:13 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Oliver Eikemeier >Release: FreeBSD 5.1-CURRENT i386 >Organization: Fillmore Labs - http://www.fillmore-labs.com >Environment: System: FreeBSD nuuk.fillmore-labs.com 5.1-CURRENT >Description: - as ports adopt the rcNG system, they should be able to participate in rcorder(8), i.e. to provide alternative services (named from the bind9 port, mail from exim or an alternative inetd). The following patch does the following: - any file in ${local_startup} that contains '^# KEYWORDS?:' is started/stopped by /etc/rc - scripts that do not contain this line are handled as usual The only caveat is that run_rc_script from rc.subr(8) sources files ending with .sh into the current shell, not into a sub shell, which may abort the boot process if a start script exits. Maybe the suffix should be changed in /etc/rc.subr to .src, .fast or something other unusual. The patch addresses some other issues: - rcorder(8) is looking for '# KEYWORD:' or '# KEYWORDS:', so adapt rc.shutdown to that. - rc(8) wasn't loading rc.conf, so rc_fast_and_loose was ignored. >How-To-Repeat: >Fix: --- localpkg.patch begins here --- diff -u src/etc/rc.orig src/etc/rc --- src/etc/rc.orig Sun May 18 19:31:40 2003 +++ src/etc/rc Fri Sep 12 16:02:39 2003 @@ -66,7 +66,14 @@ fi os=`eval ${CMD_OSTYPE}` -files=`rcorder -k ${os} -s nostart /etc/rc.d/* 2>/dev/null` +load_rc_config "rc" +_startup="/etc/rc.d/*" +for dir in ${local_startup}; do + if [ -d "${dir}" ]; then + startup="${_startup} ${dir}/*" + fi +done +files=`rcorder -k ${os} -s nostart ${_startup} 2>/dev/null` for _rc_elem in ${files}; do run_rc_script ${_rc_elem} ${_boot} diff -u src/etc/rc.d/localpkg.orig src/etc/rc.d/localpkg --- src/etc/rc.d/localpkg.orig Wed Aug 6 02:35:13 2003 +++ src/etc/rc.d/localpkg Fri Sep 12 16:20:17 2003 @@ -29,7 +29,7 @@ fi for dir in ${local_startup}; do if [ -d "${dir}" ]; then - for script in ${dir}/*.sh; do + for script in `grep -EL '^# KEYWORDS?:' ${dir}/*.sh 2>/dev/null`; do slist="${slist}${script_name_sep}${script}" done fi @@ -66,7 +66,7 @@ fi for dir in ${local_startup}; do if [ -d "${dir}" ]; then - for script in ${dir}/*.sh; do + for script in `grep -EL '^# KEYWORDS?:' ${dir}/*.sh 2>/dev/null`; do slist="${slist}${script_name_sep}${script}" done fi diff -u src/etc/rc.shutdown.orig src/etc/rc.shutdown --- src/etc/rc.shutdown.orig Mon Jul 14 13:01:29 2003 +++ src/etc/rc.shutdown Fri Sep 12 16:06:18 2003 @@ -82,7 +82,7 @@ # 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\`` +files=`eval grep -El \'^# KEYWORDS?:.*FreeBSD\' \`rcorder -k shutdown /etc/rc.d/* 2>/dev/null\`` for _rc_elem in `reverse_list $files`; do debug "run_rc_script $_rc_elem stop" --- localpkg.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: