HEADS UP: local_startup scripts in the base rcorder for HEAD

Doug Barton dougb at FreeBSD.org
Fri Dec 2 20:32:34 GMT 2005


The change I warned about the other day has now been made in HEAD. I've
attached a patch that provides an example of how to convert a port (in this
case nsd), to take advantage of the new system.

The rc.subr system treats scripts named foo.sh differently than scripts
named foo. The former are actually sourced into the rc environment, which
can cause problems if there are errors in the script, it overwrites a global
variable used elsewhere, etc. Thus, it is better to install the script as
foo instead of foo.sh.

The other thing that you'll need to be aware of is that as of now the
scripts that contain the PROVIDE keyword will be run in rcorder order,
instead of always being run as part of rc.d/localpkg. In most cases, that
means that they will be run after LOGIN. Including these scripts in the
overall rcorder means that you now have the opportunity to specify with
greater accuracy where you would like them to run (as long as it is after
mountcritremote). If you need any help with this, please feel free to write
to the freebsd-rc at freebsd.org list.

Once most of the bogons have been shaken out with this change in HEAD, I
plan to MFC it to RELENG_6 ASAP, definitely before 6.1-RELEASE. So, we need
your help to try and update these scripts as soon as possible as well.

Good luck, :)


-------- Original Message --------
Subject: cvs commit: src/etc rc rc.shutdown rc.subr src/etc/rc.d localpkg
      src/sys/sys param.h
Date: Fri, 2 Dec 2005 20:06:07 +0000 (UTC)
From: Doug Barton <dougb at FreeBSD.org>
To: src-committers at FreeBSD.org, cvs-src at FreeBSD.org, cvs-all at FreeBSD.org

dougb       2005-12-02 20:06:07 UTC

  FreeBSD src repository

  Modified files:
    etc                  rc rc.shutdown rc.subr
    etc/rc.d             localpkg
    sys/sys              param.h
  Introduce startup scripts from the local_startup directories to
  the base rcorder. This is accomplished by running rcorder twice,
  first to get all the disks mounted (through mountcritremote),
  then again to include the local_startup directories.

  This dramatically changes the behavior of rc.d/localpkg, as
  all "local" scripts that have the new rc.d semantics are now
  run in the base rcorder, so only scripts that have not been
  converted yet will run in rc.d/localpkg.

  Make a similar change in rc.shutdown, and add some functions in
  rc.subr to support these changes.

  Bump __FreeBSD_version to reflect this change.

  Revision  Changes    Path
  1.337     +33 -1     src/etc/rc
  1.7       +5 -32     src/etc/rc.d/localpkg
  1.31      +7 -1      src/etc/rc.shutdown
  1.44      +38 -0     src/etc/rc.subr
  1.254     +1 -1      src/sys/sys/param.h


-------------- next part --------------
Index: Makefile
RCS file: /home/pcvs/ports/dns/nsd/Makefile,v
retrieving revision 1.26
diff -u -r1.26 Makefile
--- Makefile	6 Sep 2005 16:26:40 -0000	1.26
+++ Makefile	2 Dec 2005 07:27:50 -0000
@@ -42,6 +42,16 @@
 MAN8=	nsd.8 zonec.8 nsdc.8 nsd-notify.8 nsd-xfer.8
+.include <bsd.port.pre.mk>
+.if ${OSVERSION} > 700006
+RC_SCRIPT=	nsd.sh
@@ -63,7 +73,7 @@
-	${SED} ${SED_SCRIPT} < ${FILESDIR}/nsd.sh.tmpl >${WRKDIR}/nsd.sh
+	${SED} ${SED_SCRIPT} < ${FILESDIR}/nsd.sh.tmpl >${WRKDIR}/${RC_SCRIPT}
 .if !defined(NOPORTDOCS)
 .for f in ${PORTDOCS}
@@ -72,10 +82,10 @@
 	${INSTALL_DATA} ${WRKSRC}/nsd.zones.sample \
-	${INSTALL_SCRIPT} ${WRKDIR}/nsd.sh ${PREFIX}/etc/rc.d/
 	@${RM} -f ${WRKDIRPREFIX}${.CURDIR}/Makefile.inc
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
Index: pkg-plist
RCS file: /home/pcvs/ports/dns/nsd/pkg-plist,v
retrieving revision 1.4
diff -u -r1.4 pkg-plist
--- pkg-plist	7 Feb 2005 21:51:13 -0000	1.4
+++ pkg-plist	2 Dec 2005 07:27:50 -0000
@@ -1,5 +1,5 @@
 @comment $FreeBSD: ports/dns/nsd/pkg-plist,v 1.4 2005/02/07 21:51:13 edwin Exp $

More information about the freebsd-ports mailing list