From owner-freebsd-bugs Tue Nov 16 17: 0: 5 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 2DB5214FA1 for ; Tue, 16 Nov 1999 17:00:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id RAA40836; Tue, 16 Nov 1999 17:00:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from lafontaine.cybercable.fr (lafontaine.cybercable.fr [212.198.0.202]) by hub.freebsd.org (Postfix) with SMTP id 4EB2714FA1 for ; Tue, 16 Nov 1999 16:50:44 -0800 (PST) (envelope-from root@d074.paris-222.cybercable.fr) Received: (qmail 746716 invoked from network); 17 Nov 1999 00:50:41 -0000 Received: from d074.paris-222.cybercable.fr ([212.198.222.74]) (envelope-sender ) by lafontaine.cybercable.fr (qmail-ldap-1.03) with SMTP for ; 17 Nov 1999 00:50:41 -0000 Received: (from root@localhost) by d074.paris-222.cybercable.fr (8.9.3/8.9.3) id BAA01005; Wed, 17 Nov 1999 01:50:41 +0100 (CET) (envelope-from root) Message-Id: <199911170050.BAA01005@d074.paris-222.cybercable.fr> Date: Wed, 17 Nov 1999 01:50:41 +0100 (CET) From: Cyrille Lefevre Reply-To: clefevre@citeweb.net To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: conf/14931: rc logging facility Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 14931 >Category: conf >Synopsis: rc logging facility >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: Tue Nov 16 17:00:00 PST 1999 >Closed-Date: >Last-Modified: >Originator: Cyrille Lefevre >Release: FreeBSD 3.3-STABLE i386 >Organization: ACME >Environment: FreeBSD gits 3.3-STABLE FreeBSD 3.3-STABLE #5: Sun Nov 14 04:01:58 CET 1999 root@gits:/disk3/3.3-STABLE/src/sys/compile/CUSTOM i386 >Description: Modifications to the /etc/rc startup file to provide a logging facility. so it is easy to see if something is wrong within /etc/rc.* startup files. >How-To-Repeat: reboot ;-) >Fix: split the /etc/rc into two scripts, /etc/rc and /etc/rc.boot. the first one provides the required things as well as the logging facilities, and the second one the rest as usual (optional things !). I'm sorry to not provide you a diff output, but the output is really !@#$%^&*, humm, not good at all to understand the philosophy of the logging facility. instead, I provide you a shell script which act as a patch. #!/bin/sh # ========== rc ========== sed -n 1,/adjkerntz/p /etc/rc | grep -v adjkerntz > /tmp/rc cat << 'EOF' >> /tmp/rc # rc logging facility. # if [ -f /etc/rc.boot ]; then rc_boot=/etc/rc.boot else rc_boot= fi # We need script(1) to do logging. # Maybe a static-ly linked version exists ? # Much better in case of /usr is not mounted. # if [ -x /bin/script ]; then rc_script=/bin/script if [ -x /usr/bin/script ]; then rc_script=/usr/bin/script else rc_script= fi # Do not use /var/run, it is cleaned by rc.* startup files. # if [ -d /var/log -a -w /var/log ]; then rc_log=/var/log/rc.log elif [ -w /etc ]; then rc_log=/etc/rc.log else rc_log= fi if [ "X$rc_boot" != "X" ]; then if [ "X$rc_script" != "X" -a "X$rc_log" != "X" ]; then chmod 664 $rc_log chmod 755 $rc_boot SHELL=$rc_boot $rc_script $rc_log rc_status=$? chmod 644 $rc_boot exit $rc_status else chmod 644 $rc_boot . $rc_boot fi else echo "rc.boot file not found, startup aborted" exit 1 fi EOF # ========== rc.boot ========== cat << 'EOF' >> /tmp/rc.boot #!/bin/sh # Set shell to ignore SIGINT (2), but not children; # shell catches SIGQUIT (3) and returns to single user after fsck. trap : 2 trap : 3 # shouldn't be needed SHELL=/bin/sh export SHELL # If there is a global system configuration file, suck it in. # if [ -f /etc/defaults/rc.conf ]; then . /etc/defaults/rc.conf elif [ -f /etc/rc.conf ]; then . /etc/rc.conf fi set -T trap "echo 'Reboot interrupted'; exit 1" 3 EOF sed -n /adjkerntz/,\$p /etc/rc >> /tmp/rc.boot # ===== copy disabled ===== # cp /tmp/rc /etc/rc # cp /tmp/rc.boot /etc/rc.boot # eof >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message