Subject: Re: What about startup scripts??
To: Al B. Snell <alaric@alaric-snell.com>
From: Frederick Bruckman <fb@enteract.com>
List: tech-pkg
Date: 01/03/2001 18:28:35
On Wed, 3 Jan 2001, Al B. Snell wrote:

> But that doesn't mean the rc.d scripts for packages can't source stuff
> from /usr!
>
> > > /usr/pkg/etc/rc.conf, being a shell script, can contain conditionals on
> > > hostname, conditionals on a hypothetical 'hosttype' value stored in /etc
> > > for people running large clusters that can be subdivided nito groups, or
> > > it can just source /etc/rc.pkg.conf after setting up defaults, to allow
> > > for per-machine overrides.
> >
> > That's exactly backwards. If you have a monolithic / and /usr, you
> > could source /usr/{pkg/,X11R6/,local/}etc/rc.conf in /etc/rc.conf, but
> > otherwise, it can't work.
>
> Why can't it work?

OK, so anything's possible. Your example, IMHO, demonstrates exactly
why we should leave all the config's in /etc.

;-)

By the way, xfstt installs to ${X11PREFIX}, not pkg. Some users set
LOCALBASE to /usr/local, so they don't even have a /usr/pkg. If
you want all the configs in one place, rather than in
/usr/{,X11R6/,pkg/,local/}etc, that one place should be /etc. :-)

Here's my xfstt script. Compare. Here, the user edits exactly one line
in /etc/rc.conf (or /etc/rc.conf.d/xfstt).

fredb@fiona-> grep xfstt /etc/rc.conf
xfstt=YES	xfstt_flags="--dir /usr/local/share/fonts/TrueType"
fredb@fiona-> cat /etc/rc.d/xfstt
#!/bin/sh
#
# PROVIDE: xfstt
# REQUIRE: mountall cleartmp

. /etc/rc.subr

name="xfstt"
rcvar=$name
command="/usr/X11R6/bin/${name}"
command_args="--daemon"

load_rc_config $name
run_rc_command "$1"


> My example "xfstt" rc.d script might look like (not got access to a 1.5
> system here so I'm guessing the rcorder keyword syntax and stuff):
>
> /etc/rc.d/xfstt
> -------------------B<---------------------------
> #!/usr/bin/sh
> # REQUIRE: everything-mounted ...
> # KEYWORD: package
> # PROVIDE: xfstt
>
> . /etc/rc.conf
> . /usr/pkg/etc/rc.conf
>
> COMMAND="/usr/pkg/bin/xfstt"
> ...
> do_rc_command()
> -------------------B<---------------------------
>
> /usr/pkg/etc/rc.conf - normal setup:
> -------------------B<---------------------------
> . /usr/pkg/etc/defaults/rc.conf
>
> 	xfstt="YES"	xfstt_flags="..."
>
> -------------------B<---------------------------
>
> /usr/pkg/etc/rc.conf - advanced setup:
> -------------------B<---------------------------
> . /usr/pkg/etc/defaults/rc.conf
>
> . /etc/host-stuff.conf # sets HOST_TYPE_* vars
>
> # Here we start xfstt on X-server boxes
> if checkyesno HOST_TYPE_XSERVER; then
> 	xfstt="YES"	xfstt_flags="..."
> else
> 	xfstt="NO"
> fi
> -------------------B<---------------------------

-- 


Frederick