pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk Make it so RCD_SCRIPTS_EXAMPLEDIR is a directory re...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/354abf26d783
branches:  trunk
changeset: 481762:354abf26d783
user:      reed <reed%pkgsrc.org@localhost>
date:      Mon Oct 11 22:04:19 2004 +0000

description:
Make it so RCD_SCRIPTS_EXAMPLEDIR is a directory relative to
${PREFIX}. It is not an absolute path because with the automatic
addition of the entry to the PLIST would be bogus if someone
defined it to some RCD_SCRIPTS_EXAMPLEDIR outside of PREFIX.
(This may cause multiple rc.d directories if there are multiple
PREFIXes, but I think that is fine.)

Note that at this time, this doesn't change the RCD_SCRIPTS_EXAMPLEDIR
default directory. This will change soon.

Most of this has been in use for over a year.

Also some of this is from Greg Woods. Thank you Greg.

I will next update a few other references to RCD_SCRIPTS_EXAMPLEDIR.

diffstat:

 mk/bsd.pkg.install.mk |  30 ++++++++++++++++++------------
 mk/install/deinstall  |   4 ++--
 mk/install/install    |   4 ++--
 3 files changed, 22 insertions(+), 16 deletions(-)

diffs (123 lines):

diff -r 890b7de1db18 -r 354abf26d783 mk/bsd.pkg.install.mk
--- a/mk/bsd.pkg.install.mk     Mon Oct 11 22:01:06 2004 +0000
+++ b/mk/bsd.pkg.install.mk     Mon Oct 11 22:04:19 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.install.mk,v 1.64 2004/10/11 21:49:00 reed Exp $
+# $NetBSD: bsd.pkg.install.mk,v 1.65 2004/10/11 22:04:19 reed Exp $
 #
 # This Makefile fragment is included by bsd.pkg.mk to use the common
 # INSTALL/DEINSTALL scripts.  To use this Makefile fragment, simply:
@@ -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,11 @@
 SUPPORT_FILES_PERMS?=  # empty
 RCD_SCRIPTS?=          # empty
 RCD_SCRIPTS_MODE?=     0755
-RCD_SCRIPTS_EXAMPLEDIR?=       ${PREFIX}/etc/rc.d
+RCD_SCRIPTS_EXAMPLEDIR?=       etc/rc.d
+.if !empty(RCD_SCRIPTS_EXAMPLEDIR:M/*)
+PKG_FAIL_REASON+= \
+       "bsd.pkg.install.mk: RCD_SCRIPTS_EXAMPLEDIR can't be an absolute path."
+.endif
 RCD_SCRIPTS_SHELL?=    ${SH}
 FILES_SUBST+=          CONF_FILES=${CONF_FILES:Q}
 FILES_SUBST+=          CONF_FILES_MODE=${CONF_FILES_MODE}
@@ -333,10 +337,11 @@
 #
 # 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
 #
 # If the source rc.d script is not present, then the automatic handling
 # doesn't occur.
@@ -353,12 +358,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}
@@ -366,14 +372,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
diff -r 890b7de1db18 -r 354abf26d783 mk/install/deinstall
--- a/mk/install/deinstall      Mon Oct 11 22:01:06 2004 +0000
+++ b/mk/install/deinstall      Mon Oct 11 22:04:19 2004 +0000
@@ -1,6 +1,6 @@
 # start of deinstall
 #
-# $NetBSD: deinstall,v 1.28 2004/07/10 20:42:37 salo Exp $
+# $NetBSD: deinstall,v 1.29 2004/10/11 22:04:19 reed Exp $
 
 eval set -- ${PKG_USERS}
 for userset; do
@@ -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}\""
diff -r 890b7de1db18 -r 354abf26d783 mk/install/install
--- a/mk/install/install        Mon Oct 11 22:01:06 2004 +0000
+++ b/mk/install/install        Mon Oct 11 22:04:19 2004 +0000
@@ -1,6 +1,6 @@
 # start of install
 #
-# $NetBSD: install,v 1.31 2004/07/10 20:42:37 salo Exp $
+# $NetBSD: install,v 1.32 2004/10/11 22:04:19 reed Exp $
 
 if [ -z "${CONF_FILES}" -a -z "${CONF_FILES_PERMS}" -a                 \
      -z "${SUPPORT_FILES}" -a -z "${SUPPORT_FILES_PERMS}" -o           \
@@ -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                         \



Home | Main Index | Thread Index | Old Index