Subject: defaulting rc.d scripts to share/examples/rc.d
To: None <tech-pkg@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 09/23/2004 16:14:54
For a long, long time, I have been defaulting rc.d scripts to
share/examples/rc.d/.

I plan on committing this within a couple days. (I also have some patches
for other packages that reference ${RCD_SCRIPTS_EXAMPLEDIR}.)

Basically this does two things:

 RCD_SCRIPTS_EXAMPLEDIR default is share/examples/rc.d.

 Makes its so it is in the PREFIX hierarchy instead of outside.

By the way, /usr/pkg/etc/rc.d/ (as it is now) doesn't make sense to be the
"examples directory". Others have already said this, so I plan to fix.

Index: mk/bsd.pkg.install.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.install.mk,v
retrieving revision 1.62
diff -b -u -r1.62 bsd.pkg.install.mk
--- mk/bsd.pkg.install.mk	10 Jul 2004 20:54:44 -0000	1.62
+++ mk/bsd.pkg.install.mk	23 Sep 2004 22:53:22 -0000
@@ -161,9 +161,9 @@
 #	at post-install time.
 #
 # RCD_SCRIPTS works lists the basenames of the rc.d scripts.  They are
-#	expected to be found in ${RCD_SCRIPTS_EXAMPLEDIR}, and the scripts
-#	will be copied into ${RCD_SCRIPTS_DIR} with ${RCD_SCRIPTS_MODE}
-#	permissions.
+#	expected to be found in ${PREFIX}/${RCD_SCRIPTS_EXAMPLEDIR}, and
+#	the scripts will be copied into ${RCD_SCRIPTS_DIR} with
+#	${RCD_SCRIPTS_MODE} permissions.
 #
 CONF_FILES?=		# empty
 CONF_FILES_MODE?=	0644
@@ -173,7 +173,7 @@
 SUPPORT_FILES_PERMS?=	# empty
 RCD_SCRIPTS?=		# empty
 RCD_SCRIPTS_MODE?=	0755
-RCD_SCRIPTS_EXAMPLEDIR?=	${PREFIX}/etc/rc.d
+RCD_SCRIPTS_EXAMPLEDIR?=	share/examples/rc.d
 RCD_SCRIPTS_SHELL?=	${SH}
 FILES_SUBST+=		CONF_FILES=${CONF_FILES:Q}
 FILES_SUBST+=		CONF_FILES_MODE=${CONF_FILES_MODE}
@@ -332,10 +332,12 @@
 #
 # RCD_SCRIPT_SRC.<script>	the source file for <script>; this will
 #				be run through FILES_SUBST to generate
-#				the rc.d script
+#				the rc.d script (defaults to
+#				${FILESDIR}/<script>.sh)
 #
-# RCD_SCRIPTS_EXAMPLEDIR	the directory in which to install the
-#				example rc.d scripts
+# RCD_SCRIPTS_EXAMPLEDIR	the directory relative to ${PREFIX} in
+#				which to install the example rc.d
+#				scripts (defaults to share/examples/rc.d)
 #
 # If the source rc.d script is not present, then the automatic handling
 # doesn't occur.
@@ -352,12 +354,13 @@
 RCD_SCRIPT_SRC.${_script_}?=	${FILESDIR}/${_script_}.sh
 RCD_SCRIPT_WRK.${_script_}?=	${WRKDIR}/${_script_}

-GENERATE_PLIST+=	${ECHO} ${RCD_SCRIPTS_EXAMPLEDIR:S|${PREFIX}/||}/${_script_};
+GENERATE_PLIST+=	${ECHO} ${RCD_SCRIPTS_EXAMPLEDIR}/${_script_};

 .  if !empty(RCD_SCRIPT_SRC.${_script_})
 .    if exists(${RCD_SCRIPT_SRC.${_script_}})
 generate-rcd-scripts: ${RCD_SCRIPT_WRK.${_script_}}
 ${RCD_SCRIPT_WRK.${_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}
@@ -365,14 +368,14 @@
 install-rcd-scripts: install-rcd-${_script_}
 install-rcd-${_script_}: ${RCD_SCRIPT_WRK.${_script_}}
 	${_PKG_SILENT}${_PKG_DEBUG}					\
-	if [ ! -d ${RCD_SCRIPTS_EXAMPLEDIR} ]; then			\
+	if [ ! -d ${PREFIX}/${RCD_SCRIPTS_EXAMPLEDIR} ]; then		\
 		${INSTALL} -d -o ${SHAREOWN} -g ${SHAREGRP} \
-			-m 0755	${RCD_SCRIPTS_EXAMPLEDIR};		\
+			-m 0755	${PREFIX}/${RCD_SCRIPTS_EXAMPLEDIR};	\
 	fi
 	${_PKG_SILENT}${_PKG_DEBUG}					\
 	if [ -f ${RCD_SCRIPT_WRK.${_script_}} ]; then			\
 		${INSTALL_SCRIPT} ${RCD_SCRIPT_WRK.${_script_}}		\
-			${RCD_SCRIPTS_EXAMPLEDIR}/${_script_};		\
+			${PREFIX}/${RCD_SCRIPTS_EXAMPLEDIR}/${_script_}; \
 	fi
 .    endif
 .  endif

Index: mk/install/deinstall
===================================================================
RCS file: /cvsroot/pkgsrc/mk/install/deinstall,v
retrieving revision 1.28
diff -b -u -r1.28 deinstall
--- mk/install/deinstall	10 Jul 2004 20:42:37 -0000	1.28
+++ mk/install/deinstall	23 Sep 2004 22:53:38 -0000
@@ -31,7 +31,7 @@
 if [ "${_PKG_RCD_SCRIPTS}" = "YES" ]; then
 	eval set -- ${RCD_SCRIPTS}
 	for script; do
-		samplefile="${RCD_SCRIPTS_EXAMPLEDIR}/${script}"
+		samplefile="${PKG_PREFIX}/${RCD_SCRIPTS_EXAMPLEDIR}/${script}"
 		file="${RCD_SCRIPTS_DIR}/${script}"
 		shift
 		ALL_FILES="${ALL_FILES} \"${samplefile}\" \"${file}\""
Index: mk/install/install
===================================================================
RCS file: /cvsroot/pkgsrc/mk/install/install,v
retrieving revision 1.31
diff -b -u -r1.31 install
--- mk/install/install	10 Jul 2004 20:42:37 -0000	1.31
+++ mk/install/install	23 Sep 2004 22:53:38 -0000
@@ -311,7 +311,7 @@
 	done
 	eval set -- ${RCD_SCRIPTS}
 	for script; do
-		samplefile="${RCD_SCRIPTS_EXAMPLEDIR}/${script}"
+		samplefile="${PKG_PREFIX}/${RCD_SCRIPTS_EXAMPLEDIR}/${script}"
 		file="${RCD_SCRIPTS_DIR}/${script}"

 		if [ "${_PKG_CONFIG}" = "NO" -o				\

 Jeremy C. Reed

 	  	 	 BSD News, BSD tutorials, BSD links
	  	 	 http://www.bsdnewsletter.com/