Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Sep 1995 04:59:24 -0700
From:      asami@cs.berkeley.edu (Satoshi Asami)
To:        ports@freebsd.org, hackers@freebsd.org
Subject:   ports startup scripts
Message-ID:  <199509201159.EAA04965@silvia.HIP.Berkeley.EDU>

next in thread | raw e-mail | index | archive | help
(Note crosspost of hackers and ports -- please reply to ports only.)

Well, now that Jordan started the fire and Paul has sprayed some
gasoline onto it, let's see if we can resolve this one last time. :)

I assume we all agree that we want something like

for script in ${local_startup}/*.sh; do
    [ -x ${script} ] && ${script} start
done

to be run from /etc/rc.  The question is, where do we want that
"local_startup" directory to be?

As I re-read the archive of the previous discussion, here are the
proposals and arguments for/against them:

(1) /etc/rc.d

 - Ports shouldn't touch anything in the root filesystem
 + Central location, easy to maintain
 + Per-machine configuration possible even if /usr/local is NFS shared

(2) /usr/local/etc/rc.d

 - Shouldn't fix certain location
 - If /usr/local is NFS shared, per-machine configuration is cumbersome

(3) Same as (2), but use the regular ${PREFIX} (defined as /usr/local
    in bsd.port.mk)

 - X ports (which have PREFIX=${X11BASE}) have no way to know where
   this tree is
 - Even if they do, putting things in two trees with user-configurable 
   locations requires major hacking of bsd.port.mk and pkg_*
 - Same NFS problem
 - PREFIX now defined in two locations (bsd.port.mk and sysconfig)

(4) Same as (3), but use the current ${PREFIX} (usually /usr/local or
    /usr/X11R6)

 - Same NFS problem
 - PREFIX and X11BASE now defined in two locations (bsd.port.mk and
   sysconfig)

My opinion is that due to the first reasons on their respective lists,
options (2) and (3) are infeasible.  I don't have any problem with
ports touching /etc (that directory is hardly sacred, and is one of
the things you need to backup during upgrades anyway) but since there
seems to be a large contingent of people who feel strongly against it,
I think it's wise to avoid option (1) too.

That leaves option (4).  We can deal with multiple startup dirs
easily, just a couple more lines of shell programming.  And to
alleviate the second problem, I propose the following:

 @ Define LOCAL_PREFIX and X11BASE in /etc/sysconfig

 @ In /etc/rc, add a line that generates a file somewhere in /var
   (say, /var/run/paths) with the contents:

=====
# Do not edit this file!  Look at /etc/sysconfig on how to change these.
LOCAL_PREFIX=/usr/local
X11BASE=/usr/X11R6
=====

   (The directory names are just examples, mind you.)

 @ Remove the lines that define X11BASE and PREFIX from *.mk files
   (bsd.port.mk defines both, sys.mk defines X11BASE) and replace them 
   with ".include /var/run/paths" (need to change "=" to "?=" but that 
   can be easily hacked) and some code to put them in PREFIX correctly

So, if the user wants to change the "default" location of the "local"
tree or the X tree, he can just edit /etc/sysconfig.

The porters should just make sure that the script for the port
"<mumble>" has a name "<mumble>.sh" and it goes to ${PREFIX}/etc/rc.d.
For the scripts themselves -- right now it's not necessary, but why
don't we make it a guideline to try to make it understand arguments
"start" and "stop", it may be useful in the future.

May I have your comments, ladies and gentlemen?

Satoshi



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199509201159.EAA04965>