Subject: Re: etc chains...
To: NetBSD Packages Technical Discussion List <tech-pkg@NetBSD.ORG>
From: Greg A. Woods <woods@weird.com>
List: tech-pkg
Date: 02/05/2002 17:06:42
[ On Tuesday, February 5, 2002 at 11:36:48 (-0600), Frederick Bruckman wrote: ]
> Subject: Re: etc chains...
>
> On Tue, 5 Feb 2002, Jan Schaumann wrote:
> 
> > Julio Merino <juli@merino.net> wrote:
> >
> > > chain_rc_dirs="/usr/pkg/etc/rc.d /usr/local/etc/rc.d"

"chain" makes me think way too much of ancient small-memory BASIC
interpreters.  I chose a less connotative name:

	$ fgrep more_rc_d /etc/defaults/rc.conf
	more_rc_d="/usr/local/etc/rc.d ${PKG_PREFIX}/etc/rc.d"

(PKG_PREFIX is of course also set in /etc/defaults/rc.conf, to /usr/pkg)

I think you'll find I've posted my /etc/rc script to at least one NetBSD
list at least once in the past.  Here it is again.  Note that I do
normally keep all of /usr on the root filesystem.  I've thought of
effectively copying this whole script to /usr/local/etc and /usr/pkg/etc
and then calling each copy from /etc/rc.d/local, /etc/rc.d/pkg.  However
I've decided that, in my environment at least, either /usr will always
be on the root filesystem, or else packages will install files into the
root filesytem (i.e. directly into /etc and /etc/rc.d, and so on).

#! /bin/sh
#
# $NetBSD: rc,v 1.158 2001/06/14 07:50:06 lukem Exp $
#
# rc.sh --
#	Run the scripts in /etc/rc.d with rcorder.

#	System startup script run by init(8) on autoboot or after single-user.
#	Output and error are redirected to console by init, and the console
#	is the controlling terminal.

export HOME=/
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
umask 022
stty status '^T'

debug_echo=""

case "$1" in
autoboot)
	autoboot=yes
	_rc_fast_run=yes	# run_rc_command(): do fast booting
	;;
-d)
	debug_echo=echo
	;;
esac

. /etc/rc.subr
. /etc/rc.conf
_rc_conf_loaded=YES

if ! checkyesno rc_configured; then
	err 1 "/etc/rc.conf is not configured.  Multiuser boot aborted."
	exit 1
fi

#	Set shell to ignore SIGINT, but not children;
#
trap : INT

#	Set shell to catch SIGQUIT and trigger return to single user.
#
trap "echo 'Boot interrupted.'; exit 1" QUIT

date

_all_rc_d_files=""
for _rc_d in /etc/rc.d ${more_rc_d} ; do
	if [ -d $_rc_d -a ! -h $_rc_d -a ".$(echo ${_rc_d}/*)" != ".${_rc_d}/\*" ]; then
		_all_rc_d_files="${_all_rc_d_files} $(echo ${_rc_d}/*)"
	fi
done

ordered_rc_d_files=$(rcorder ${_all_rc_d_files})

for _rc_elem in $ordered_rc_d_files; do
	$debug_echo run_rc_script $_rc_elem start
done

date
exit 0


-- 
								Greg A. Woods

+1 416 218-0098;  <gwoods@acm.org>;  <g.a.woods@ieee.org>;  <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>