summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2005-08-19 22:24:09 +0000
committerjlam <jlam@pkgsrc.org>2005-08-19 22:24:09 +0000
commit151094ac1b300adc176264e61102e52c0d657e59 (patch)
tree594ac5dc63811b737d66d9802652bb0ea4aff979
parentb5c39c2f41aa0417f0f68c95ea59970b0dd6fc03 (diff)
downloadpkgsrc-151094ac1b300adc176264e61102e52c0d657e59.tar.gz
Define new variables for package Makefile use:
REQD_FILES, REQD_FILES_PERMS, REQD_FILES_MODE REQD_DIRS, REQD_DIRS_PERMS These are the same as the CONF_* variables, except the files and directories listed in REQD_* are always copied over, created or removed (taking into account if there are user modifications from the originals, etc.) regardless of the value of PKG_CONFIG. The implementation involved pushing the knowledge of PKG_CONFIG, PKG_RCD_SCRIPTS, PKG_CREATE_USERGROUP, and PKG_REGISTER_SHELLS into the individual helper scripts. The helper scripts are now always invoked by the +INSTALL and +DEINSTALL scripts. The +DIRS and +FILES script have been enhanced to understand a new "f" flag that means "force" to ignore the value of PKG_CONFIG and PKG_RCD_SCRIPTS. Lastly, the +FILES script has been taught a new "r" flag just for rc.d scripts and the +RCD_SCRIPTS script is now unnecessary.
-rw-r--r--mk/bsd.pkg.check.mk6
-rw-r--r--mk/install/bsd.pkginstall.mk142
-rw-r--r--mk/install/deinstall36
-rw-r--r--mk/install/dirs37
-rw-r--r--mk/install/files85
-rw-r--r--mk/install/header33
-rw-r--r--mk/install/install47
-rw-r--r--mk/install/shell18
-rw-r--r--mk/install/usergroup63
9 files changed, 274 insertions, 193 deletions
diff --git a/mk/bsd.pkg.check.mk b/mk/bsd.pkg.check.mk
index 92aab69399b..ddc6459ad25 100644
--- a/mk/bsd.pkg.check.mk
+++ b/mk/bsd.pkg.check.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.check.mk,v 1.11 2005/08/19 22:07:46 jlam Exp $
+# $NetBSD: bsd.pkg.check.mk,v 1.12 2005/08/19 22:24:09 jlam Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and defines the
# relevant variables and targets for the various install-time "check"
@@ -59,10 +59,10 @@ CHECK_FILES_SKIP+= ${PREFIX}/${INFO_DIR}/dir
.endif
CHECK_FILES_SKIP+= ${PERL5_INSTALLARCHLIB}/perllocal.pod
CHECK_FILES_SKIP+= ${PREFIX}/emul/linux/proc
-.for d in ${MAKE_DIRS} ${OWN_DIRS}
+.for d in ${MAKE_DIRS} ${REQD_DIRS} ${OWN_DIRS}
CHECK_FILES_SKIP+= ${d}
.endfor
-.for d o g m in ${MAKE_DIRS_PERMS} ${OWN_DIRS_PERMS}
+.for d o g m in ${MAKE_DIRS_PERMS} ${REQD_DIRS_PERMS} ${OWN_DIRS_PERMS}
CHECK_FILES_SKIP+= ${d}
.endfor
_CHECK_FILES_SKIP_FILTER= ${GREP} -v ${CHECK_FILES_SKIP:@f@-e ${f:Q}@}
diff --git a/mk/install/bsd.pkginstall.mk b/mk/install/bsd.pkginstall.mk
index 31539af1358..3ad943915c5 100644
--- a/mk/install/bsd.pkginstall.mk
+++ b/mk/install/bsd.pkginstall.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkginstall.mk,v 1.11 2005/08/19 18:12:38 jlam Exp $
+# $NetBSD: bsd.pkginstall.mk,v 1.12 2005/08/19 22:24:10 jlam Exp $
#
# This Makefile fragment is included by bsd.pkg.mk to use the common
# INSTALL/DEINSTALL scripts. To use this Makefile fragment, simply:
@@ -261,14 +261,19 @@ ${INSTALL_PERMS_FILE}: ../../mk/install/perms
# MLINKS in the base system. At post-install time, if the true config
# file doesn't exist, then the example one is copied into place. At
# deinstall time, the true one is removed if it doesn't differ from the
-# example one.
+# example one. REQD_FILES is the same as CONF_FILES but the value
+# of PKG_CONFIG is ignored.
#
-# CONF_FILES_MODE is the file permissions for the files in CONF_FILES.
+# CONF_FILES_MODE and REQD_FILES_MODE are the file permissions for the
+# files in CONF_FILES and REQD_FILES, respectively.
#
# CONF_FILES_PERMS are lists that look like:
+#
# example_file config_file user group mode
+#
# and works like CONF_FILES, except the config files are owned by
-# user:group have mode permissions.
+# user:group have mode permissions. REQD_FILES_PERMS is the same
+# as CONF_FILES_PERMS but the value of PKG_CONFIG is ignored.
#
# RCD_SCRIPTS works lists the basenames of the rc.d scripts. They are
# expected to be found in ${PREFIX}/share/examples/rc.d, and
@@ -295,15 +300,30 @@ INSTALL_UNPACK_TMPL+= ${INSTALL_FILES_FILE}
${INSTALL_FILES_FILE}: ../../mk/install/files
${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${.TARGET} ${.TARGET}.tmp
${_PKG_SILENT}${_PKG_DEBUG}${TEST} -f ${.TARGET}.tmp || { \
+ case "${RCD_SCRIPTS:M*:Q}" in \
+ "") ;; \
+ *) ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;; \
+ esac; }
+ ${_PKG_SILENT}${_PKG_DEBUG}${TEST} -f ${.TARGET}.tmp || { \
case "${CONF_FILES:M*:Q}" in \
"") ;; \
*) ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;; \
esac; }
${_PKG_SILENT}${_PKG_DEBUG}${TEST} -f ${.TARGET}.tmp || { \
+ case "${REQD_FILES:M*:Q}" in \
+ "") ;; \
+ *) ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;; \
+ esac; }
+ ${_PKG_SILENT}${_PKG_DEBUG}${TEST} -f ${.TARGET}.tmp || { \
case "${CONF_FILES_PERMS:M*:Q}" in \
"") ;; \
*) ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;; \
esac; }
+ ${_PKG_SILENT}${_PKG_DEBUG}${TEST} -f ${.TARGET}.tmp || { \
+ case "${REQD_FILES_PERMS:M*:Q}" in \
+ "") ;; \
+ *) ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;; \
+ esac; }
${_PKG_SILENT}${_PKG_DEBUG}${TEST} ! -f ${.TARGET}.tmp || { \
${ECHO} "# start of install-files"; \
${ECHO} "#"; \
@@ -319,6 +339,17 @@ ${INSTALL_FILES_FILE}: ../../mk/install/files
} >> ${.TARGET}.tmp
${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX}; \
${TEST} ! -f ${.TARGET}.tmp || { \
+ eval set -- __dummy ${RCD_SCRIPTS}; \
+ while ${TEST} $$# -gt 0; do \
+ if ${TEST} "$$1" = "__dummy"; then shift; continue; fi; \
+ script="$$1"; shift; \
+ file="${RCD_SCRIPTS_DIR:S/^${PREFIX}\///}/$$script"; \
+ egfile="${RCD_SCRIPTS_EXAMPLEDIR}/$$script"; \
+ ${ECHO} "# FILE: $$file cr $$egfile ${RCD_SCRIPTS_MODE}"; \
+ done; \
+ } >> ${.TARGET}.tmp
+ ${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX}; \
+ ${TEST} ! -f ${.TARGET}.tmp || { \
eval set -- __dummy ${CONF_FILES}; \
while ${TEST} $$# -gt 0; do \
if ${TEST} "$$1" = "__dummy"; then shift; continue; fi; \
@@ -331,6 +362,18 @@ ${INSTALL_FILES_FILE}: ../../mk/install/files
} >> ${.TARGET}.tmp
${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX}; \
${TEST} ! -f ${.TARGET}.tmp || { \
+ eval set -- __dummy ${REQD_FILES}; \
+ while ${TEST} $$# -gt 0; do \
+ if ${TEST} "$$1" = "__dummy"; then shift; continue; fi; \
+ egfile="$$1"; file="$$2"; \
+ shift; shift; \
+ egfile=`strip_prefix "$$egfile"`; \
+ file=`strip_prefix "$$file"`; \
+ ${ECHO} "# FILE: $$file cf $$egfile ${REQD_FILES_MODE}"; \
+ done; \
+ } >> ${.TARGET}.tmp
+ ${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX}; \
+ ${TEST} ! -f ${.TARGET}.tmp || { \
eval set -- __dummy ${CONF_FILES_PERMS}; \
while ${TEST} $$# -gt 0; do \
if ${TEST} "$$1" = "__dummy"; then shift; continue; fi; \
@@ -342,59 +385,26 @@ ${INSTALL_FILES_FILE}: ../../mk/install/files
${ECHO} "# FILE: $$file c $$egfile $$mode $$owner $$group"; \
done; \
} >> ${.TARGET}.tmp
- ${_PKG_SILENT}${_PKG_DEBUG}${TEST} ! -f ${.TARGET}.tmp || { \
- ${ECHO} "EOF_FILES"; \
- ${ECHO} " \$${CHMOD} +x ./+FILES"; \
- ${ECHO} " ;;"; \
- ${ECHO} "esac"; \
- ${ECHO} ""; \
- ${ECHO} "# end of install-files"; \
- } >> ${.TARGET}.tmp
- ${_PKG_SILENT}${_PKG_DEBUG}${TEST} ! -f ${.TARGET}.tmp || \
- ${MV} -f ${.TARGET}.tmp ${.TARGET}
- ${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${.TARGET}
-
-INSTALL_RCD_SCRIPTS_FILE= ${WRKDIR}/.install-rcd-scripts
-INSTALL_UNPACK_TMPL+= ${INSTALL_RCD_SCRIPTS_FILE}
-
-${INSTALL_RCD_SCRIPTS_FILE}: ../../mk/install/files
- ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${.TARGET} ${.TARGET}.tmp
- ${_PKG_SILENT}${_PKG_DEBUG}${TEST} -f ${.TARGET}.tmp || { \
- case "${RCD_SCRIPTS:M*:Q}" in \
- "") ;; \
- *) ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;; \
- esac; }
- ${_PKG_SILENT}${_PKG_DEBUG}${TEST} ! -f ${.TARGET}.tmp || { \
- ${ECHO} "# start of install-rcd-scripts"; \
- ${ECHO} "#"; \
- ${ECHO} "# Generate a +RCD_SCRIPTS script that reference counts config"; \
- ${ECHO} "# files that are required for the proper functioning"; \
- ${ECHO} "# of the package."; \
- ${ECHO} "#"; \
- ${ECHO} "case \$${STAGE} in"; \
- ${ECHO} "PRE-INSTALL|UNPACK)"; \
- ${ECHO} " \$${CAT} > ./+RCD_SCRIPTS << 'EOF_RCD_SCRIPTS'"; \
- ${SED} ${FILES_SUBST_SED} ../../mk/install/files; \
- ${ECHO} ""; \
- } >> ${.TARGET}.tmp
${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX}; \
${TEST} ! -f ${.TARGET}.tmp || { \
- eval set -- __dummy ${RCD_SCRIPTS}; \
+ eval set -- __dummy ${REQD_FILES_PERMS}; \
while ${TEST} $$# -gt 0; do \
if ${TEST} "$$1" = "__dummy"; then shift; continue; fi; \
- script="$$1"; shift; \
- file="${RCD_SCRIPTS_DIR:S/^${PREFIX}\///}/$$script"; \
- egfile="${RCD_SCRIPTS_EXAMPLEDIR}/$$script"; \
- ${ECHO} "# FILE: $$file c $$egfile ${RCD_SCRIPTS_MODE}"; \
+ egfile="$$1"; file="$$2"; \
+ owner="$$3"; group="$$4"; mode="$$5"; \
+ shift; shift; shift; shift; shift; \
+ egfile=`strip_prefix "$$egfile"`; \
+ file=`strip_prefix "$$file"`; \
+ ${ECHO} "# FILE: $$file cf $$egfile $$mode $$owner $$group"; \
done; \
} >> ${.TARGET}.tmp
${_PKG_SILENT}${_PKG_DEBUG}${TEST} ! -f ${.TARGET}.tmp || { \
- ${ECHO} "EOF_RCD_SCRIPTS"; \
- ${ECHO} " \$${CHMOD} +x ./+RCD_SCRIPTS"; \
+ ${ECHO} "EOF_FILES"; \
+ ${ECHO} " \$${CHMOD} +x ./+FILES"; \
${ECHO} " ;;"; \
${ECHO} "esac"; \
${ECHO} ""; \
- ${ECHO} "# end of install-rcd-scripts"; \
+ ${ECHO} "# end of install-files"; \
} >> ${.TARGET}.tmp
${_PKG_SILENT}${_PKG_DEBUG}${TEST} ! -f ${.TARGET}.tmp || \
${MV} -f ${.TARGET}.tmp ${.TARGET}
@@ -404,19 +414,24 @@ ${INSTALL_RCD_SCRIPTS_FILE}: ../../mk/install/files
# created and should attempt to be destroyed by the INSTALL/DEINSTALL
# scripts. MAKE_DIRS is used the same way, but the package admin
# isn't prompted to remove the directory at post-deinstall time if it
-# isn't empty.
+# isn't empty. REQD_DIRS is like MAKE_DIRS but the value of PKG_CONFIG
+# is ignored.
#
# OWN_DIRS_PERMS contains a list of "directory owner group mode" sublists
# representing directories for this package that should be
# created/destroyed by the INSTALL/DEINSTALL scripts. MAKE_DIRS_PERMS
# is used the same way but the package admin isn't prompted to remove
# the directory at post-deinstall time if it isn't empty.
+# REQD_DIRS_PERMS is like MAKE_DIRS but the value of PKG_CONFIG is
+# ignored.
#
# If any directory pathnames are relative, then they are taken to be
# relative to ${PREFIX}.
#
MAKE_DIRS?= # empty
MAKE_DIRS_PERMS?= # empty
+REQD_DIRS?= # empty
+REQD_DIRS_PERMS?= # empty
OWN_DIRS?= # empty
OWN_DIRS_PERMS?= # empty
@@ -451,6 +466,11 @@ ${INSTALL_DIRS_FILE}: ../../mk/install/dirs
*) ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;; \
esac; }
${_PKG_SILENT}${_PKG_DEBUG}${TEST} -f ${.TARGET}.tmp || { \
+ case "${REQD_DIRS:M*:Q}" in \
+ "") ;; \
+ *) ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;; \
+ esac; }
+ ${_PKG_SILENT}${_PKG_DEBUG}${TEST} -f ${.TARGET}.tmp || { \
case "${OWN_DIRS:M*:Q}" in \
"") ;; \
*) ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;; \
@@ -461,6 +481,11 @@ ${INSTALL_DIRS_FILE}: ../../mk/install/dirs
*) ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;; \
esac; }
${_PKG_SILENT}${_PKG_DEBUG}${TEST} -f ${.TARGET}.tmp || { \
+ case "${REQD_DIRS_PERMS:M*:Q}" in \
+ "") ;; \
+ *) ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;; \
+ esac; }
+ ${_PKG_SILENT}${_PKG_DEBUG}${TEST} -f ${.TARGET}.tmp || { \
case "${OWN_DIRS_PERMS:M*:Q}" in \
"") ;; \
*) ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp ;; \
@@ -502,6 +527,16 @@ ${INSTALL_DIRS_FILE}: ../../mk/install/dirs
} >> ${.TARGET}.tmp
${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX}; \
${TEST} ! -f ${.TARGET}.tmp || { \
+ eval set -- __dummy ${REQD_DIRS}; \
+ while ${TEST} $$# -gt 0; do \
+ if ${TEST} "$$1" = "__dummy"; then shift; continue; fi; \
+ dir="$$1"; shift; \
+ dir=`strip_prefix "$$dir"`; \
+ ${ECHO} "# DIR: $$dir fm"; \
+ done; \
+ } >> ${.TARGET}.tmp
+ ${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX}; \
+ ${TEST} ! -f ${.TARGET}.tmp || { \
eval set -- __dummy ${OWN_DIRS}; \
while ${TEST} $$# -gt 0; do \
if ${TEST} "$$1" = "__dummy"; then shift; continue; fi; \
@@ -523,6 +558,17 @@ ${INSTALL_DIRS_FILE}: ../../mk/install/dirs
} >> ${.TARGET}.tmp
${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX}; \
${TEST} ! -f ${.TARGET}.tmp || { \
+ eval set -- __dummy ${REQD_DIRS_PERMS}; \
+ while ${TEST} $$# -gt 0; do \
+ if ${TEST} "$$1" = "__dummy"; then shift; continue; fi; \
+ dir="$$1"; owner="$$2"; group="$$3"; mode="$$4"; \
+ shift; shift; shift; shift; \
+ dir=`strip_prefix "$$dir"`; \
+ ${ECHO} "# DIR: $$dir fm $$owner $$group $$mode"; \
+ done; \
+ } >> ${.TARGET}.tmp
+ ${_PKG_SILENT}${_PKG_DEBUG}${_FUNC_STRIP_PREFIX}; \
+ ${TEST} ! -f ${.TARGET}.tmp || { \
eval set -- __dummy ${OWN_DIRS_PERMS}; \
while ${TEST} $$# -gt 0; do \
if ${TEST} "$$1" = "__dummy"; then shift; continue; fi; \
diff --git a/mk/install/deinstall b/mk/install/deinstall
index aa492660a65..fb451e9907f 100644
--- a/mk/install/deinstall
+++ b/mk/install/deinstall
@@ -1,12 +1,12 @@
# -*- sh -*-
# start of deinstall
#
-# $NetBSD: deinstall,v 1.35 2005/07/29 18:32:18 jlam Exp $
+# $NetBSD: deinstall,v 1.36 2005/08/19 22:24:10 jlam Exp $
case ${STAGE} in
VIEW-DEINSTALL)
case ${_PKG_CONFIG} in
- YES)
+ yes)
case ${PKG_SYSCONFDEPOTBASE} in
"")
${TEST} ! -x ./+FILES ||
@@ -23,10 +23,8 @@ VIEW-DEINSTALL)
#
# Remove shells from /etc/shells.
#
- case ${_PKG_REGISTER_SHELLS} in
- YES) ${TEST} ! -x ./+SHELL ||
- ./+SHELL REMOVE ${PKG_METADATA_DIR} ;;
- esac
+ ${TEST} ! -x ./+SHELL ||
+ ./+SHELL REMOVE ${PKG_METADATA_DIR}
${TEST} ! -x ./+SHELL ||
./+SHELL CHECK-REMOVE ${PKG_METADATA_DIR}
;;
@@ -35,19 +33,15 @@ DEINSTALL)
# Remove configuration files if they don't differ from the default
# config file.
#
- case ${_PKG_CONFIG} in
- YES) ${TEST} ! -x ./+FILES ||
- ./+FILES REMOVE ${PKG_METADATA_DIR} ;;
- esac
- case ${_PKG_CONFIG}${_PKG_RCD_SCRIPTS} in
- YESYES) ${TEST} ! -x ./+RCD_SCRIPTS ||
- ./+RCD_SCRIPTS REMOVE ${PKG_METADATA_DIR} ;;
- esac
+ ${TEST} ! -x ./+FILES ||
+ ./+FILES REMOVE ${PKG_METADATA_DIR}
+ ${TEST} ! -x ./+RCD_SCRIPTS ||
+ ./+RCD_SCRIPTS REMOVE ${PKG_METADATA_DIR}
;;
POST-DEINSTALL)
if [ "${PKG_INSTALLATION_TYPE}" = "pkgviews" -a \
- "${_PKG_CONFIG}" = "YES" -a -n "${CONF_DEPENDS}" ]; then
+ "${_PKG_CONFIG}" = "yes" -a -n "${CONF_DEPENDS}" ]; then
if [ -h ${PKG_SYSCONFDIR} ]; then
${RM} -f ${PKG_SYSCONFDIR}
fi
@@ -56,14 +50,10 @@ POST-DEINSTALL)
#
# Remove empty directories and unused users/groups.
#
- case ${_PKG_CONFIG} in
- YES) ${TEST} ! -x ./+DIRS ||
- ./+DIRS REMOVE ${PKG_METADATA_DIR} ;;
- esac
- case ${_PKG_CREATE_USERGROUP} in
- YES) ${TEST} ! -x ./+USERGROUP ||
- ./+USERGROUP REMOVE ${PKG_METADATA_DIR} ;;
- esac
+ ${TEST} ! -x ./+DIRS ||
+ ./+DIRS REMOVE ${PKG_METADATA_DIR}
+ ${TEST} ! -x ./+USERGROUP ||
+ ./+USERGROUP REMOVE ${PKG_METADATA_DIR}
#
# Check for any existing bits after we're finished de-installing.
#
diff --git a/mk/install/dirs b/mk/install/dirs
index 9d33289ffd8..b7b660a095c 100644
--- a/mk/install/dirs
+++ b/mk/install/dirs
@@ -1,6 +1,6 @@
#!@SH@
#
-# $NetBSD: dirs,v 1.7 2005/07/29 21:41:04 jlam Exp $
+# $NetBSD: dirs,v 1.8 2005/08/19 22:24:10 jlam Exp $
#
# +DIRS - reference-counted directory management script
#
@@ -23,13 +23,15 @@
#
# # DIR: /etc/foo m
# # DIR: /var/log/foo/tmp mo foo-user foo-group 0700
+# # DIR: share/foo-plugins fm
#
# For each DIR entry, if the directory path is relative, then it is taken
# to be relative to ${PKG_PREFIX}.
#
# The second field in each DIR entry is a set of flags with the following
-# meaning:
+# meanings:
#
+# f ignore ${PKG_CONFIG}
# m create (make) the directory when ADDing
# o directory is owned by the package
#
@@ -59,6 +61,15 @@ PKG_METADATA_DIR="${2-`${PWD_CMD}`}"
PKG_REFCOUNT_DIRS_DBDIR="${PKG_REFCOUNT_DBDIR}/dirs"
+case "${PKG_CONFIG:-@PKG_CONFIG@}" in
+[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
+ _PKG_CONFIG=yes
+ ;;
+[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
+ _PKG_CONFIG=no
+ ;;
+esac
+
exitcode=0
case $ACTION in
ADD)
@@ -81,7 +92,6 @@ ADD)
${TEST} ! -d "$dir" ||
${ECHO} "${PKGNAME}" > $preexist
fi
- ${MKDIR} $dir
if ${TEST} -f "$token" && \
${GREP} "^${PKG_METADATA_DIR}$" $token >/dev/null; then
:
@@ -93,11 +103,16 @@ ADD)
${ECHO} "$d_user $d_group $d_mode" > $perms
;;
esac
- case $d_user/$d_group/$d_mode in
- [!/]*/[!/]*/[!/]*)
- ${CHOWN} $d_user $dir
- ${CHGRP} $d_group $dir
- ${CHMOD} $d_mode $dir
+ case $d_flags/$_PKG_CONFIG in
+ *f*/*|*/yes)
+ ${MKDIR} $dir
+ case $d_user/$d_group/$d_mode in
+ [!/]*/[!/]*/[!/]*)
+ ${CHOWN} $d_user $dir
+ ${CHGRP} $d_group $dir
+ ${CHMOD} $d_mode $dir
+ ;;
+ esac
;;
esac
done
@@ -125,7 +140,11 @@ REMOVE)
case `${CAT} $tokentmp | ${SED} -n "$="` in
"")
${TEST} -f "$preexist" ||
- { ${RMDIR} -p $dir 2>/dev/null || ${TRUE}; }
+ { case $d_flags/$_PKG_CONFIG in
+ *f*/*|*/yes)
+ ${RMDIR} -p $dir 2>/dev/null || ${TRUE};
+ ;;
+ esac; }
${RM} -f $perms $preexist $token $token.tmp.*
${RMDIR} -p $shadow_dir 2>/dev/null || ${TRUE}
;;
diff --git a/mk/install/files b/mk/install/files
index ecf0fa5340d..c73c584446f 100644
--- a/mk/install/files
+++ b/mk/install/files
@@ -1,6 +1,6 @@
#!@SH@
#
-# $NetBSD: files,v 1.7 2005/07/29 21:41:04 jlam Exp $
+# $NetBSD: files,v 1.8 2005/08/19 22:24:10 jlam Exp $
#
# +FILES - reference-counted configuration file management script
#
@@ -33,6 +33,8 @@
# meaning:
#
# c file is copied into place
+# f ignore ${PKG_CONFIG}
+# r file is an rc.d script (consider ${PKG_RCD_SCRIPTS})
#
CAT="@CAT@"
CP="@CP@"
@@ -57,7 +59,24 @@ ACTION=$1
: ${PKG_PREFIX=@PREFIX@}
-case ${ACTION} in
+case "${PKG_CONFIG:-@PKG_CONFIG@}" in
+[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
+ _PKG_CONFIG=yes
+ ;;
+[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
+ _PKG_CONFIG=no
+ ;;
+esac
+case "${PKG_RCD_SCRIPTS:-@PKG_RCD_SCRIPTS@}" in
+[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
+ _PKG_RCD_SCRIPTS=yes
+ ;;
+[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
+ _PKG_RCD_SCRIPTS=no
+ ;;
+esac
+
+case $ACTION in
VIEW-REMOVE)
DEPOTDIR="$2"
VIEWDIR="$3"
@@ -113,34 +132,38 @@ ADD)
if ${TEST} ! -f "$file" -a ! -f "$f_eg"; then
:
else
- case "$printed_header" in
- yes) ;;
- *) printed_header=yes
- ${ECHO} "==========================================================================="
- ${ECHO} "Installing files needed by ${PKGNAME}:"
+ case "$f_flags/$_PKG_CONFIG/$_PKG_RCD_SCRIPTS" in
+ *f*/*/*|[!r]/yes/*|[!r][!r]/yes/*|[!r][!r][!r]/yes/*|*r*/yes/yes)
+ case "$printed_header" in
+ yes) ;;
+ *) printed_header=yes
+ ${ECHO} "==========================================================================="
+ ${ECHO} "Installing files needed by ${PKGNAME}:"
+ ;;
+ esac
+ if ${TEST} -f "$file"; then
+ ${ECHO} ""
+ ${ECHO} " $file already exists."
+ elif ${TEST} -f "$f_eg"; then
+ ${ECHO} ""
+ ${ECHO} " $file"
+ ${ECHO} " [$f_eg]"
+ ${CP} $f_eg $file
+ case $f_user in
+ "") ;;
+ *) ${CHOWN} $f_user $file ;;
+ esac
+ case $f_group in
+ "") ;;
+ *) ${CHGRP} $f_group $file ;;
+ esac
+ case $f_mode in
+ "") ;;
+ *) ${CHMOD} $f_mode $file ;;
+ esac
+ fi
;;
esac
- if ${TEST} -f "$file"; then
- ${ECHO} ""
- ${ECHO} " $file already exists."
- elif ${TEST} -f "$f_eg"; then
- ${ECHO} ""
- ${ECHO} " $file"
- ${ECHO} " [$f_eg]"
- ${CP} $f_eg $file
- case $f_user in
- "") ;;
- *) ${CHOWN} $f_user $file ;;
- esac
- case $f_group in
- "") ;;
- *) ${CHGRP} $f_group $file ;;
- esac
- case $f_mode in
- "") ;;
- *) ${CHMOD} $f_mode $file ;;
- esac
- fi
fi
done
case "$printed_header" in
@@ -180,7 +203,11 @@ REMOVE)
:
elif ${TEST} -f "$file" -a -f "$f_eg" && \
${CMP} -s "$file" "$f_eg"; then
- ${RM} -f "$file"
+ case "$f_flags/$_PKG_CONFIG/$_PKG_RCD_SCRIPTS" in
+ *f*/*/*|[!r]/yes/*|[!r][!r]/yes/*|[!r][!r][!r]/yes/*|*r*/yes/yes)
+ ${RM} -f "$file"
+ ;;
+ esac
fi
${RM} -f $perms $preexist $token $token.tmp.*
${RMDIR} -p $shadow_dir 2>/dev/null || ${TRUE}
diff --git a/mk/install/header b/mk/install/header
index fbe8d9ac935..e2783116dc6 100644
--- a/mk/install/header
+++ b/mk/install/header
@@ -2,7 +2,7 @@
#
# start of header
#
-# $NetBSD: header,v 1.33 2005/07/29 18:32:18 jlam Exp $
+# $NetBSD: header,v 1.34 2005/08/19 22:24:10 jlam Exp $
PKGNAME=$1
STAGE=$2
@@ -75,39 +75,12 @@ CONF_IGNORE_FILES="*[~#] *.OLD *.orig *,v .pkgsrc */.pkgsrc"
PKG_INSTALLATION_TYPE="@PKG_INSTALLATION_TYPE@"
-case "${PKG_CREATE_USERGROUP:-@PKG_CREATE_USERGROUP@}" in
-[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
- _PKG_CREATE_USERGROUP=YES
- ;;
-[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
- _PKG_CREATE_USERGROUP=NO
- ;;
-esac
-
case "${PKG_CONFIG:-@PKG_CONFIG@}" in
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
- _PKG_CONFIG=YES
- ;;
-[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
- _PKG_CONFIG=NO
- ;;
-esac
-
-case "${PKG_RCD_SCRIPTS:-@PKG_RCD_SCRIPTS@}" in
-[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
- _PKG_RCD_SCRIPTS=YES
- ;;
-[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
- _PKG_RCD_SCRIPTS=NO
- ;;
-esac
-
-case "${PKG_REGISTER_SHELLS:-@PKG_REGISTER_SHELLS@}" in
-[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
- _PKG_REGISTER_SHELLS=YES
+ _PKG_CONFIG=yes
;;
[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
- _PKG_REGISTER_SHELLS=NO
+ _PKG_CONFIG=yes
;;
esac
diff --git a/mk/install/install b/mk/install/install
index 3e37342a9bf..3fa0182ed9c 100644
--- a/mk/install/install
+++ b/mk/install/install
@@ -1,7 +1,7 @@
# -*- sh -*-
# start of install
#
-# $NetBSD: install,v 1.40 2005/07/29 18:32:18 jlam Exp $
+# $NetBSD: install,v 1.41 2005/08/19 22:24:10 jlam Exp $
case ${STAGE} in
PRE-INSTALL)
@@ -9,21 +9,18 @@ PRE-INSTALL)
# Require that necessary users and groups exist or else fail the
# installation of the package.
#
- case ${_PKG_CREATE_USERGROUP} in
- YES) ${TEST} ! -x ./+USERGROUP ||
- ./+USERGROUP ADD ${PKG_METADATA_DIR} ;;
- esac
- if ${TEST} ! -x ./+USERGROUP || \
- ./+USERGROUP CHECK-ADD ${PKG_METADATA_DIR}; then
- :
- else
- exit 1
- fi
+ ${TEST} ! -x ./+USERGROUP ||
+ { ./+USERGROUP ADD ${PKG_METADATA_DIR}
+ if ./+USERGROUP CHECK-ADD ${PKG_METADATA_DIR}; then
+ :
+ else
+ exit 1
+ fi; }
#
# Create package directories at pre-install time.
#
if [ "${PKG_INSTALLATION_TYPE}" = "pkgviews" -a \
- "${_PKG_CONFIG}" = "YES" -a -n "${CONF_DEPENDS}" ]; then
+ "${_PKG_CONFIG}" = "yes" -a -n "${CONF_DEPENDS}" ]; then
pkg=`${PKG_ADMIN} -b -d ${DEPOTBASE} -s "" lsbest "${CONF_DEPENDS}"`
sysconfdir=`${PKG_INFO} -B -K ${DEPOTBASE} $pkg | \
${AWK} '/^PKG_SYSCONFDIR=/ { \
@@ -36,24 +33,18 @@ PRE-INSTALL)
${LN} -sf $sysconfdir ${PKG_SYSCONFDIR}
fi
fi
- case ${_PKG_CONFIG} in
- YES) ${TEST} ! -x ./+DIRS ||
- ./+DIRS ADD ${PKG_METADATA_DIR} ;;
- esac
+ ${TEST} ! -x ./+DIRS ||
+ ./+DIRS ADD ${PKG_METADATA_DIR}
;;
POST-INSTALL)
#
# Copy configuration/support files into place.
#
- case ${_PKG_CONFIG} in
- YES) ${TEST} ! -x ./+FILES ||
- ./+FILES ADD ${PKG_METADATA_DIR} ;;
- esac
- case ${_PKG_CONFIG}${_PKG_RCD_SCRIPTS} in
- YESYES) ${TEST} ! -x ./+RCD_SCRIPTS ||
- ./+RCD_SCRIPTS ADD ${PKG_METADATA_DIR} ;;
- esac
+ ${TEST} ! -x ./+FILES ||
+ ./+FILES ADD ${PKG_METADATA_DIR}
+ ${TEST} ! -x ./+RCD_SCRIPTS ||
+ ./+RCD_SCRIPTS ADD ${PKG_METADATA_DIR}
#
# Set special permissions on any files/directories that need them.
#
@@ -74,17 +65,15 @@ VIEW-INSTALL)
#
# Register shells in /etc/shells.
#
- case ${_PKG_REGISTER_SHELLS} in
- YES) ${TEST} ! -x ./+SHELL ||
- ./+SHELL ADD ${PKG_METADATA_DIR} ;;
- esac
+ ${TEST} ! -x ./+SHELL ||
+ ./+SHELL ADD ${PKG_METADATA_DIR}
${TEST} ! -x ./+SHELL ||
./+SHELL CHECK-ADD ${PKG_METADATA_DIR}
# If ${PKG_SYSCONFBASE} points outside of ${PREFIX}, then add the
# package config files to the proper view.
#
- if [ "${_PKG_CONFIG}" = "YES" -a -n "${PKG_SYSCONFDEPOTBASE}" ]; then
+ if [ "${_PKG_CONFIG}" = "yes" -a -n "${PKG_SYSCONFDEPOTBASE}" ]; then
${SETENV} PLIST_IGNORE_FILES="${CONF_IGNORE_FILES}" \
${LINKFARM} -t ${PKG_SYSCONFVIEWBASE} -d ${PKG_SYSCONFDEPOTBASE} ${PKGNAME}
fi
diff --git a/mk/install/shell b/mk/install/shell
index 6991cc2e900..f5b3789d835 100644
--- a/mk/install/shell
+++ b/mk/install/shell
@@ -1,6 +1,6 @@
#!@SH@
#
-# $NetBSD: shell,v 1.1 2005/07/29 18:32:18 jlam Exp $
+# $NetBSD: shell,v 1.2 2005/08/19 22:24:10 jlam Exp $
#
# +SHELL - shell registration script
#
@@ -33,6 +33,7 @@ RM="@RM@"
SED="@SED@"
SORT="@SORT@"
TEST="@TEST@"
+TRUE="@TRUE@"
TOUCH="@TOUCH@"
SELF=$0
@@ -42,11 +43,23 @@ PKG_METADATA_DIR="${2-`${PWD_CMD}`}"
: ${PKG_PREFIX=@PREFIX@}
: ${PKGNAME=${PKG_METADATA_DIR##*/}}
+case "${PKG_REGISTER_SHELLS:-@PKG_REGISTER_SHELLS@}" in
+[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
+ _PKG_REGISTER_SHELLS=yes
+ ;;
+[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
+ _PKG_REGISTER_SHELLS=no
+ ;;
+esac
+
exitcode=0
case $ACTION in
ADD)
${SED} -n "/^\# SHELL: /{s/^\# SHELL: //;p;}" ${SELF} | ${SORT} -u |
{ while read shell; do
+ case ${_PKG_REGISTER_SHELLS} in
+ no) continue ;;
+ esac
case $shell in
/*) continue ;;
*) shell="${PKG_PREFIX}/$shell" ;;
@@ -83,6 +96,9 @@ ADD)
REMOVE)
${SED} -n "/^\# SHELL: /{s/^\# SHELL: //;p;}" ${SELF} | ${SORT} -u |
{ while read shell; do
+ case ${_PKG_REGISTER_SHELLS} in
+ no) continue ;;
+ esac
case $shell in
/*) continue ;;
*) shell="${PKG_PREFIX}/$shell" ;;
diff --git a/mk/install/usergroup b/mk/install/usergroup
index 32e9d9310d1..1e38545031c 100644
--- a/mk/install/usergroup
+++ b/mk/install/usergroup
@@ -1,6 +1,6 @@
#!@SH@
#
-# $NetBSD: usergroup,v 1.9 2005/07/27 16:18:54 jlam Exp $
+# $NetBSD: usergroup,v 1.10 2005/08/19 22:24:10 jlam Exp $
#
# +USERGROUP - users and groups management script
#
@@ -51,6 +51,7 @@ RMDIR="@RMDIR@"
SED="@SED@"
SORT="@SORT@"
TEST="@TEST@"
+TRUE="@TRUE@"
USERADD="@USERADD@"
SELF=$0
@@ -66,6 +67,15 @@ PKG_REFCOUNT_GROUPS_DBDIR="${PKG_REFCOUNT_DBDIR}/groups"
PKG_USER_HOME="@PKG_USER_HOME@"
PKG_USER_SHELL="@PKG_USER_SHELL@"
+case "${PKG_CREATE_USERGROUP:-@PKG_CREATE_USERGROUP@}" in
+[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
+ _PKG_CREATE_USERGROUP=yes
+ ;;
+[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
+ _PKG_CREATE_USERGROUP=no
+ ;;
+esac
+
group_exists()
{
_group="$1"
@@ -139,21 +149,25 @@ ADD)
group_exists $group &&
${ECHO} "${PKGNAME}" > $preexist
fi
- if group_exists $group; then
- :
- elif ${TEST} -n "${GROUPADD}" -a -x "${GROUPADD}"; then
- ${ECHO} "Creating group: $group";
- case $groupid in
- "") ${GROUPADD} $group ;;
- *) ${GROUPADD} -g $groupid $group ;;
- esac
- fi
if ${TEST} -f "$token" && \
${GREP} "^${PKG_METADATA_DIR}$" $token >/dev/null; then
:
else
${ECHO} "${PKG_METADATA_DIR}" >> $token
fi
+ case ${_PKG_CREATE_USERGROUP} in
+ yes)
+ if group_exists $group; then
+ :
+ elif ${TEST} -n "${GROUPADD}" -a -x "${GROUPADD}"; then
+ ${ECHO} "Creating group: $group";
+ case $groupid in
+ "") ${GROUPADD} $group ;;
+ *) ${GROUPADD} -g $groupid $group ;;
+ esac
+ fi
+ ;;
+ esac
done; }
${SED} -n "/^\# USER: /{s/^\# USER: //;p;}" ${SELF} | ${SORT} -u |
{ while read line; do
@@ -176,23 +190,30 @@ ADD)
user_exists $user &&
${ECHO} "${PKGNAME}" > $preexist
fi
- if user_exists $user && group_exists $group; then
- :
- elif ${TEST} -n "${USERADD}" -a -x "${USERADD}"; then
- ${ECHO} "Creating user: $user";
- case $userid in
- "") ${USERADD} -c "$descr" -d "$home" -s "$shell" \
- -g $group $user ;;
- *) ${USERADD} -c "$descr" -d "$home" -s "$shell" \
- -g $group -u $userid $user ;;
- esac
- fi
if ${TEST} -f "$token" && \
${GREP} "^${PKG_METADATA_DIR}$" $token >/dev/null; then
:
else
${ECHO} "${PKG_METADATA_DIR}" >> $token
fi
+ case ${_PKG_CREATE_USERGROUP} in
+ yes)
+ if user_exists $user && group_exists $group; then
+ :
+ elif ${TEST} -n "${USERADD}" -a -x "${USERADD}"; then
+ ${ECHO} "Creating user: $user";
+ case $userid in
+ "") ${USERADD} -c "$descr" -d "$home" \
+ -s "$shell" -g $group $user
+ ;;
+ *) ${USERADD} -c "$descr" -d "$home" \
+ -s "$shell" -g $group \
+ -u $userid $user
+ ;;
+ esac
+ fi
+ ;;
+ esac
done; }
;;