From owner-freebsd-bugs@FreeBSD.ORG Thu Jun 9 03:20:02 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org 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 2F01A16A41C for ; Thu, 9 Jun 2005 03:20:02 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id B428543D58 for ; Thu, 9 Jun 2005 03:20:01 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j593K1bj087696 for ; Thu, 9 Jun 2005 03:20:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j593K1tD087695; Thu, 9 Jun 2005 03:20:01 GMT (envelope-from gnats) Resent-Date: Thu, 9 Jun 2005 03:20:01 GMT Resent-Message-Id: <200506090320.j593K1tD087695@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, "J.R. Oldroyd" Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AC4C516A41C for ; Thu, 9 Jun 2005 03:14:06 +0000 (GMT) (envelope-from jr@opal.com) Received: from smtp.vzavenue.net (smtp.vzavenue.net [66.171.59.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4B07A43D49 for ; Thu, 9 Jun 2005 03:14:06 +0000 (GMT) (envelope-from jr@opal.com) Received: from linwhf.opal.com (112.79.171.66.subscriber.vzavenue.net [66.171.79.112]) by smtp.vzavenue.net (MOS 3.4.8-GR) with ESMTP id CJB31562; Wed, 8 Jun 2005 23:13:58 -0400 (EDT) Received: from ASSP-nospam (localhost [127.0.0.1]) by linwhf.opal.com (8.13.3/8.13.3) with ESMTP id j593Dvju075555 for ; Wed, 8 Jun 2005 23:13:57 -0400 (EDT) (envelope-from jr@opal.com) Received: from 127.0.0.1 ([127.0.0.1] helo=linwhf.opal.com) by ASSP-nospam ; 9 Jun 05 03:13:57 -0000 Received: (from jr@localhost) by linwhf.opal.com (8.13.3/8.13.3/Submit) id j593Dv3O075554; Wed, 8 Jun 2005 23:13:57 -0400 (EDT) (envelope-from jr) Message-Id: <200506090313.j593Dv3O075554@linwhf.opal.com> Date: Wed, 8 Jun 2005 23:13:57 -0400 (EDT) From: "J.R. Oldroyd" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: conf/82059: patch to /etc/rc.d/localpkg to partially sort scripts using rcorder(8) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "J.R. Oldroyd" List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jun 2005 03:20:02 -0000 >Number: 82059 >Category: conf >Synopsis: patch to /etc/rc.d/localpkg to partially sort scripts using rcorder(8) >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jun 09 03:20:01 GMT 2005 >Closed-Date: >Last-Modified: >Originator: J.R. Oldroyd >Release: FreeBSD 6.0-CURRENT i386 >Organization: >Environment: System: FreeBSD linwhf.opal.com 6.0-CURRENT FreeBSD 6.0-CURRENT #83: Thu Jun 2 09:20:18 EDT 2005 xxx:/usr/src-current/sys/i386/compile/LINWHF i386 >Description: Certain local rc.d scripts do not currently start because scripts are executed in alphabetic order, even though many ports provide rcorder(8) tags. This patch modifies /etc/rc.d/localpkg to sort the local scripts using rcorder tags, if present, while preserving existing semantics for scripts named 000.foo.sh. >How-To-Repeat: Install www/apache2 and net/freenet6. Configure apache to use a freenet6 IPv6 address. Reboot and watch apache fail to start because apache2.sh is run before freenet6.sh. >Fix: --- /etc/rc.d/localpkg.orig Fri Oct 8 13:52:43 2004 +++ /etc/rc.d/localpkg Tue Jun 7 15:19:19 2005 @@ -14,6 +14,9 @@ start_cmd="pkg_start" stop_cmd="pkg_stop" +rcorder_opts="" +[ `/sbin/sysctl -n security.jail.jailed` -eq 1 ] && rcorder_opts="-s nojail" + pkg_start() { # For each dir in $local_startup, search for init scripts matching *.sh @@ -24,19 +27,14 @@ *) echo -n 'Local package initialization:' slist="" - if [ -z "${script_name_sep}" ]; then - script_name_sep=" " - fi + zlist="" for dir in ${local_startup}; do if [ -d "${dir}" ]; then - for script in ${dir}/*.sh; do - slist="${slist}${script_name_sep}${script}" - done + slist="${slist} ${dir}/[^0-9]*.sh" + zlist="${zlist} ${dir}/[0-9]*.sh" fi done - script_save_sep="$IFS" - IFS="${script_name_sep}" - for script in ${slist}; do + for script in ${zlist} `rcorder -s nostart ${rcorder_opts} ${slist} 2>/dev/null`; do if [ -x "${script}" ]; then (set -T trap 'exit 1' 2 @@ -45,7 +43,6 @@ echo -n " (skipping ${script##*/}, not executable)" fi done - IFS="${script_save_sep}" echo '.' ;; esac @@ -61,26 +58,20 @@ ;; *) slist="" - if [ -z "${script_name_sep}" ]; then - script_name_sep=" " - fi + zlist="" for dir in ${local_startup}; do if [ -d "${dir}" ]; then - for script in ${dir}/*.sh; do - slist="${slist}${script_name_sep}${script}" - done + slist="${slist} ${dir}/[^0-9]*.sh" + zlist="${zlist} ${dir}/[0-9]*.sh" fi done - script_save_sep="$IFS" - IFS="${script_name_sep}" - for script in `reverse_list ${slist}`; do + for script in `reverse_list ${zlist} \`rcorder -k shutdown ${rcorder_opts} ${slist} 2>/dev/null\``; do if [ -x "${script}" ]; then (set -T trap 'exit 1' 2 ${script} stop) fi done - IFS="${script_save_sep}" echo '.' ;; esac >Release-Note: >Audit-Trail: >Unformatted: