Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Mar 2003 14:15:40 -0600
From:      "Scot Hetzel" <hetzels@westbend.net>
To:        "Richard Nyberg" <rnyberg@it.su.se>, <ports@FreeBSD.ORG>
Subject:   Re: port rc.d files
Message-ID:  <016b01c2e99d$51c24a60$19fd2fd8@westbend.net>
References:  <20030313100830.GA30175@murmeldjur.it.su.se>

next in thread | previous in thread | raw e-mail | index | archive | help
From: "Richard Nyberg" <rnyberg@it.su.se>
> Couldn't the files in /usr/local/etc/rc.d use /etc/rc.conf
> for configuration? Ie. for the openldap21 port the rc file
> could check for slapd_enable and slapd_flags in /etc/rc.conf.
>
> This would make it easier to have port installations
> in distributed filesystems like AFS. Maybe you have
> many computers with the same port installation but
> you only want one to start slapd. It would also
> make system configuration more coherent.
>
> I'm thinking something like, but maybe less complex than,
> /etc/rc.d in CURRENT. What do you think?
>
The addition of *_enable variables can be easily done with RC_NG, and a few
minor changes to the existing rc.d scripts.  I have already converted my
ports to use a combination of the old rc.d and the new RC_NG system:

    Port                         Script                        *_enable
    security/cyrus-sasl    cyrus_pwcheck.sh        both
                                    saslauthd1.sh                both
    www/apache13-fp    apache.sh                     RC_NG only

    NOTE: The apache.sh script does work on <5.x, but it doesn't support the
                apache_enable variable in the non-RC_NG case.

The thing is that the combined RC_NG/pre-RC_NG rc.d script has to be
designed to run under FreeBSD 5.x+ (with rc.subr)  and FreeBSD < 5.x
(without rc.subr) as follows:

if [ -f /etc/rc.subr ] ; then
    # RC_NG rc.d script
    . /etc/rc.subr
    :
    - Rcng style rc.d script
else
    # pre-RC_NG rc.d scipt
    source rc.conf files (${prefix}/etc/rc.conf.d/scriptname, /etc/rc.conf,
/etc/rc.conf.d/scriptname)
    case "$scriptname_enable"
        [Yy][Ee][Ss])
                old script for pre rcng systems
                ;;
        *)
            rc=0
            ;;
    esac
    exit $rc
fi

RC_NG needs a new function added to rc.subr (load_local_rc_config), this
function loads the rc.conf style files as shown above. For this function see
PR 44800:

    http://www.freebsd.org/cgi/query-pr.cgi?pr=conf/44800

This PR also has links to other PRs where I had converted several ports
scripts to a combined RC_NG/pre-RC_NG rc.d script.

Scot


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?016b01c2e99d$51c24a60$19fd2fd8>