ports/77385: Mk/bsd.port.mk - add support for early rcNG startup scripts
Florent Thoumie
flz at xbsd.org
Fri Feb 11 12:00:32 UTC 2005
>Number: 77385
>Category: ports
>Synopsis: Mk/bsd.port.mk - add support for early rcNG startup scripts
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Fri Feb 11 12:00:31 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Florent Thoumie
>Release: FreeBSD 5.3-RELEASE i386
>Organization:
Xbsd.org
>Environment:
System: FreeBSD srv1.xbsd.org 5.3-RELEASE FreeBSD 5.3-RELEASE #2: Wed Nov 24 16:35:34 CET 2004 root at gate.xbsd.org:/usr/src/sys/i386/compile/GATE i386
>Description:
Support for rcNG scripts has been added recently in bsd.port.mk.
This handles expansion of %%RC_SUBR%% in these scripts, installs
them and adds them to the packing list (by setting USE_RC_SUBR to
a list of files).
This new patch works almost exactly the same way, except it changes
the directory where scripts are installed and their extension
(commonly handled with RC_DIR and RC_SUFX).
Setting USE_RCORDER to a list of files will add the dependency on
sysutils/rc_subr (if needed) and set RC_SUBR.
Notes:
x The port can install rcorder(8) startup scripts and/or "classic"
rcNG startup scripts. If both are to be installed, USE_RC_SUBR and
USE_RCORDER must be exclusive lists of scripts (or bad things will
happen).
x USE_RC_SUBR can be unset (or not set) if USE_RCORDER is set.
x This makes use of @cwd which is almost broken with pkg_add -p
(bin/77212). There can be extra @cwd commands, but trying not to put
these extras would make the code less readable.
The patch should be harmless.
>How-To-Repeat:
>Fix:
--- rcorder-bpm-v2.diff begins here ---
--- bsd.port.mk.orig Fri Feb 11 12:37:34 2005
+++ bsd.port.mk Fri Feb 11 12:21:00 2005
@@ -386,9 +386,14 @@
# routines found in etc/rc.subr and may need to
# depend on the sysutils/rc_subr port.
# If this is set to a list of files, these files will be
-# automatically added to ${SUB_FILES} and some "variable=value"
+# automatically added to ${SUB_FILES}, some %%VAR%%'s will
+# automatically be expanded, they will be installed in
+# ${PREFIX}/etc/rc.d and added to the packing list.
# pairs will be added to ${SUB_LIST}. These files will be
# installed in ${PREFIX}/etc/rc.d and added to the packing list.
+# RC_ORDER - List of rcNG startup scripts to be called early in the boot
+# process. This acts exactly like USE_RC_SUBR except that
+# scripts are installed in /etc/rc.d.
# RC_SUBR - Set to path of rc.subr.
# Default: ${LOCALBASE}/etc/rc.subr.
##
@@ -1462,17 +1467,20 @@
.endif
.endif
-.if defined(USE_RC_SUBR)
+.if defined(USE_RC_SUBR) || defined(USE_RCORDER)
.if ${OSVERSION} < 500037
RUN_DEPENDS+= ${LOCALBASE}/etc/rc.subr:${PORTSDIR}/sysutils/rc_subr
RC_SUBR= ${LOCALBASE}/etc/rc.subr
.else
RC_SUBR= /etc/rc.subr
.endif
-.if ${USE_RC_SUBR:U} != "YES"
SUB_LIST+= RC_SUBR=${RC_SUBR}
+.if defined(USE_RC_SUBR) && ${USE_RC_SUBR:U} != "YES"
SUB_FILES+= ${USE_RC_SUBR}
.endif
+.if defined(USE_RCORDER)
+SUB_FILES+= ${USE_RCORDER}
+.endif
.endif
.if defined(USE_ICONV)
@@ -4837,16 +4845,22 @@
.if !target(install-rc-script)
install-rc-script:
-.if defined(USE_RC_SUBR)
-.if ${USE_RC_SUBR:U} != "YES"
- @${ECHO_CMD} "===> Installing startup script(s) in ${PREFIX}/etc/rc.d"
- @if ${EGREP} -qe '^@cw?d' ${TMPPLIST} && \
- [ "`${SED} -En -e '/^@cw?d[ ]*/s,,,p' ${TMPPLIST} | ${TAIL} -n 1`" != "${PREFIX}" ]; then \
- ${ECHO_CMD} "@cwd ${PREFIX}" >> ${TMPPLIST}; \
- fi
+.if defined(USE_RCORDER) || defined(USE_RC_SUBR) && ${USE_RC_SUBR:U} != "YES"
+.if defined(USE_RCORDER)
+ @${ECHO_CMD} "===> Installing early rcNG startup script(s)"
+ @${ECHO_CMD} "@cwd /" >> ${TMPPLIST}
+ @for i in ${USE_RCORDER}; do \
+ ${INSTALL_SCRIPT} ${WRKDIR}/$${i} /etc/rc.d/$${i%.sh}; \
+ ${ECHO_CMD} "etc/rc.d/$${i%.sh}" >> ${TMPPLIST}; \
+ done
+ @${ECHO_CMD} "@cwd ${PREFIX}" >> ${TMPPLIST}
+.endif
+.if defined(USE_RC_SUBR) && ${USE_RC_SUBR:U} != "YES"
+ @${ECHO_CMD} "===> Installing rcNG startup script(s)"
+ @${ECHO_CMD} "@cwd ${PREFIX}" >> ${TMPPLIST}
@for i in ${USE_RC_SUBR}; do \
- ${INSTALL_SCRIPT} ${WRKDIR}/$${i} ${PREFIX}/etc/rc.d; \
- ${ECHO_CMD} etc/rc.d/$${i} >> ${TMPPLIST}; \
+ ${INSTALL_SCRIPT} ${WRKDIR}/$${i} ${PREFIX}/etc/rc.d/$${i%.sh}.sh; \
+ ${ECHO_CMD} "etc/rc.d/$${i%.sh}.sh" >> ${TMPPLIST}; \
done
.endif
.else
--- rcorder-bpm-v2.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list