Subject: Re: pkg/19166: example rc.d scripts for packages should be registered in package contents
To: None <gnats-admin@netbsd.org, pkg-manager@netbsd.org,>
From: Greg A. Woods <woods@weird.com>
List: netbsd-bugs
Date: 01/19/2003 21:17:05
To GNATS-ADMIN:  This PR must be re-opened.

To JMMV:  You apparently did not read the patch enclosed with the
original PR and understand its purpose and nature, i.e. you did not pay
attention to the details that were already provided.

The original suggestion of this PR is in fact implemented by causing the
RCD_SCRIPTS to be automatically added to the PLIST, as per the original
patch, with an addition to the GENERATE_PLIST macro.

Here's a slightly newer version of the same change.

Note in particular that RCD_SCRIPTS_EXAMPLEDIR has also been moved to
the proper share/examples sub-directory.  This will help, or maybe even
completely, eliminate the mass confusion people seem to suffer causing
them to want to have /etc/rc also process ${PREFIX}/etc/rc.d.  (FYI: an
MTREE entry needs to be made for this too in the various
pkgsrc/mk/*.dist files -- patches not supplied as my mk/NetBSD.pkg.dist
file is too much hacked to provide a good sample change).


Index: mk/bsd.pkg.install.mk
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/mk/bsd.pkg.install.mk,v
retrieving revision 1.40
diff -c -r1.40 bsd.pkg.install.mk
*** mk/bsd.pkg.install.mk	2 Dec 2002 17:07:27 -0000	1.40
--- mk/bsd.pkg.install.mk	20 Jan 2003 02:01:21 -0000
***************
*** 151,157 ****
  RCD_SCRIPTS?=		# empty
  RCD_SCRIPTS_MODE?=	0755
  RCD_SCRIPTS_DIR?=	/etc/rc.d
! RCD_SCRIPTS_EXAMPLEDIR?=	${PREFIX}/etc/rc.d
  RCD_SCRIPTS_SHELL?=	${SH}
  FILES_SUBST+=		CONF_FILES=${CONF_FILES:Q}
  FILES_SUBST+=		CONF_FILES_MODE=${CONF_FILES_MODE}
--- 151,157 ----
  RCD_SCRIPTS?=		# empty
  RCD_SCRIPTS_MODE?=	0755
  RCD_SCRIPTS_DIR?=	/etc/rc.d
! RCD_SCRIPTS_EXAMPLEDIR?=	${PREFIX}/share/examples/rc.d
  RCD_SCRIPTS_SHELL?=	${SH}
  FILES_SUBST+=		CONF_FILES=${CONF_FILES:Q}
  FILES_SUBST+=		CONF_FILES_MODE=${CONF_FILES_MODE}
***************
*** 268,273 ****
--- 268,275 ----
  
  INSTALL_SCRIPTS_ENV=	PKG_PREFIX=${PREFIX}
  
+ # this should also run the REQUIRE script....
+ 
  pre-install-script: generate-install-scripts
  	${_PKG_SILENT}${_PKG_DEBUG}${SETENV} ${INSTALL_SCRIPTS_ENV}	\
  		${_PKG_DEBUG_SCRIPT} ${INSTALL_FILE} ${PKGNAME} PRE-INSTALL
***************
*** 303,312 ****
  #
  # RCD_SCRIPT_SRC.<script>	the source file for <script>; this will
  #				be run through FILES_SUBST to generate
! #				the rc.d script
  #
  # RCD_SCRIPTS_EXAMPLEDIR	the directory in which to install the
! #				example rc.d scripts
  #
  # If the source rc.d script is not present, then the automatic handling
  # doesn't occur.
--- 305,316 ----
  #
  # RCD_SCRIPT_SRC.<script>	the source file for <script>; this will
  #				be run through FILES_SUBST to generate
! #				the rc.d script (defaults to
! #				${FILESDIR}/<script>.sh)
  #
  # RCD_SCRIPTS_EXAMPLEDIR	the directory in which to install the
! #				example rc.d scripts (defaults to
! #				${PREFIX}/share/examples/rc.d)
  #
  # If the source rc.d script is not present, then the automatic handling
  # doesn't occur.
***************
*** 318,327 ****
--- 322,334 ----
  .for _script_ in ${RCD_SCRIPTS}
  RCD_SCRIPT_SRC.${_script_}?=	${FILESDIR}/${_script_}.sh
  
+ GENERATE_PLIST+=	${ECHO} ${RCD_SCRIPTS_EXAMPLEDIR:S|${PREFIX}/||}/${_script_};
+ 
  .  if !empty(RCD_SCRIPT_SRC.${_script_})
  .    if exists(${RCD_SCRIPT_SRC.${_script_}})
  generate-rcd-scripts: ${WRKDIR}/${_script_}
  ${WRKDIR}/${_script_}: ${RCD_SCRIPT_SRC.${_script_}}
+ 	@${ECHO_MSG} "${_PKGSRC_IN}> Creating ${.TARGET}"
  	${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} |			\
  		${SED} ${FILES_SUBST_SED} > ${.TARGET}
  	${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}

-- 
								Greg A. Woods

+1 416 218-0098;            <g.a.woods@ieee.org>;           <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>