Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Dec 2005 13:53:52 -0800
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        Ion-Mihai Tetcu <itetcu@people.tecnik93.com>
Cc:        ports@freebsd.org, freebsd-rc@freebsd.org
Subject:   Re: RC keywords question
Message-ID:  <20051205215352.GA24743@odin.ac.hmc.edu>
In-Reply-To: <20051205190905.28ad8a0a@it.buh.tecnik93.com>
References:  <20051205145805.0db6cf26@it.buh.tecnik93.com> <20051205161656.GC7653@odin.ac.hmc.edu> <20051205190905.28ad8a0a@it.buh.tecnik93.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--LQksG6bCIzRHxTLp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Dec 05, 2005 at 07:09:05PM +0200, Ion-Mihai Tetcu wrote:
> On Mon, 5 Dec 2005 08:16:56 -0800
> Brooks Davis <brooks@one-eyed-alien.net> wrote:
>=20
> > On Mon, Dec 05, 2005 at 02:58:05PM +0200, Ion-Mihai Tetcu wrote:
> > > Hi,
> > >=20
> > >=20
> > > I'm converting my ports to work with the new HEAD RC style and
> > > while at it I also thought to check the keywords to make sure
> > > they're OK. Read rcorder(8) and rc(8).
> > >=20
> > > Let's take mail/dspam as an example. Obviously it PROVIDE: dspam
> > >=20
> > > When run in --daemon mode dspam receives messages via LMTP and
> > > deliver them via SMTP. So it REQUIRE: NETWORK; it also uses syslogd
> > > (which starts BEFORE: SERVERS).
> > >=20
> > > Now things start getting interesting.
> > >=20
> > > Since it's a content filter, it should start before the SMTP server.
> > >=20
> > > If SMTP server =3D sendmail|courier it's easy: BEFORE: mail
> > >=20
> > > If it's postfix it's:
> > > - if it's started via /etc/rc.d/sendmail (sendmail_enable=3D"YES" and
> > > postfix in /etc/mail/mailer.conf) BEFORE: mail should be enough
> > > (but see below);=20
> > > - if sendmail_enable=3D"NO" and /usr/local/sbin/postfix is linked in
> > > rc.d as sendmail.sh then BEFORE: mail should be OK too since that's
> > > before rc.d/localpkg (right ?)
> > >=20
> > > How to interact with various ways to start qmail I have yet to
> > > discover.
> > >=20
> > > So until here I would have:
> > > PROVIDE: dspam
> > > REQUIRE: NETWORK syslogd
> > > BEFORE: mail
> > > and since mail REQUIRE: LOGIN this is actually:
> > > REQUIRE: NETWORK syslogd LOGIN
> > >
> > > Q: should I write all the REQUIRE keywords or just the last one
> > > (LOGIN) ?
> > >=20
> > >=20
> > > OK, now dspam could also use mysql or pgsql; if the dependency is
> > > set at compile time, it's easy to have the right REQUIRE; but dspam
> > > can also use either or none, as instructed in dspam.conf so this is
> > > also settable at run-time. How can I write the REQUIRE: line in
> > > this case ?
> >=20
> >=20
> > "BEFORE: mail" acts for most intents and purposes like all mail
> > scripts contained "REQUIRE: dspam" so dspam does not depend on
> > LOGIN.  As a rule, there's no point in depending on syslogd, just
>=20
> I think it's better if I make sure dspam starts before its potential
> consumers that the other way around; and this for one reason: I know
> that my port's consumers are mail servers, but making each mail server
> OPTIONally depend of each content filter is obviously unfeasible (of
> course I counld ask the user to modify his server's rc script by hand).
> Please correct me if I'm wrong.

Yes, you should be using BEFORE here because you need dspam to run
before any PROVIDEr of "mail" and you can't assume all providers will be
modified.  This is what BEFORE is for.

> > depend on SERVERS instead.  This is actually what DAEMON is.  I'd say
> > that virtually all ports should "REQUIRE: DAEMON" unless they have
> > more specific requirements.
>=20
> So I should have REQUIRE: DAEMON and that's all ?

Yes.  For virtualy every case, this is what what you want to do.

> Do I understand this right: BEFORE is for approximately selecting when
> the server should start while REQUIRE actually asks for something to be
> running ?

If there is only one provider of what ever your service script if
providing, "BEFORE: someservice" exactly the same as adding "REQUIRE:
yourservice" to all files that provide "someservice".

> > For the database support, I'd suggest
> > setting the dependencies based on the ports configure options.  It's
> > harmless to depend on something that doesn't actually run, but
> > annoying to depend on something that doesn't exist.
>=20
> In my case the user either select one database back-end and that is
> statically compiled and then I e.g USE_MYSQL and I can write my BEFORE
> line (that's what I'm doing now for mysql);=20
>=20
> Or select multiple WITH_DB_NAME OPTIONS and have support for loading
> any of them at runtime. For this case what I'm asking is: is there any
> way  to hook-in a script that would parse dspam.conf, see what DB is set
> and REQUIERE the right thing ?

At this point you must add REQUIRE lines for any database that you
depend on at compile time.  If users choose to find a way to circumvent
that, there's nothing you can do.  Note that it's OK to depend on a
startup script that isn't enabled.  rcorder, unlike launchd, doesn't
care.

> > The correct solution for databases is probably to add a new dummy
> > script DATABASES which all the database startup scripts should declare
> > they run BEFORE.  Then other startup scripts could REQUIRE that
> > unconditionally even if they aren't currently configured to use a
> > database and none are installed.
>=20
> And what do I do until then ? Or I just let the script as it is (.sh)
> on 7.x also ?

We could MFC such a script to RELENG_6 so I don't see a major support
issue here.

-- Brooks

--=20
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4

--LQksG6bCIzRHxTLp
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFDlLbwXY6L6fI4GtQRAvIrAJ9sypGtsgcQHinsPu54X2yIlCWivgCdEchL
+DAhO2j/b4xfmY8W/A88Sxs=
=OZL8
-----END PGP SIGNATURE-----

--LQksG6bCIzRHxTLp--



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