summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2002-06-20 20:15:46 +0000
committerjlam <jlam@pkgsrc.org>2002-06-20 20:15:46 +0000
commitf28a0a731b72309c8ff27be7b00234137436dac9 (patch)
tree15d25b0a8c8441b4d22c4a75ae86412dc8954ee3
parent8f6dfa65701404f02621a8ea92417701c1b655a7 (diff)
downloadpkgsrc-f28a0a731b72309c8ff27be7b00234137436dac9.tar.gz
In order to solve the following problems:
(1) Admins want to create users/groups on their own (pkg/17183). (2) Admins don't want packages to setup an initial configuration. The bsd.pkg.install.mk-generated INSTALL/DEINSTALL scripts have been modified to check certain PKG_* environment variables to tune their behaviour. This works whether installing from "make install" or from a binary package. PKG_CREATE_USERGROUP indicates whether the INSTALL script should automatically add any needed users/groups to the system using useradd/groupadd. It is either YES or NO, and defaults to YES. PKG_CONFIG indicates whether the INSTALL/DEINSTALL scripts should do automatic config file and directory handling, or if it should merely inform the admin of the list of required files and directories needed to use the package. It is either YES or NO, and defaults to YES. The make(1) variable INSTALL_RCD_SCRIPTS is removed. The package rc.d script is now handled like other config files for the package, and is copied into place if PKG_CONFIG=YES. The default values above reflect the current behaviour. Setting PKG_CREATE_USERGROUP=NO solves problem (1), and setting PKG_CONFIG=NO solves problem (2). To simply matters for users installing directly from pkgsrc, these variables may also be defined in /etc/mk.conf, but behaviour at deinstall time may be surprising. It is *HIGHLY* recommended that these values be set in the shell environment instead.
-rw-r--r--Packages.txt14
-rw-r--r--mk/bsd.pkg.install.mk9
-rw-r--r--mk/bsd.pkg.mk13
-rw-r--r--mk/install/deinstall140
-rw-r--r--mk/install/header26
-rw-r--r--mk/install/install369
6 files changed, 370 insertions, 201 deletions
diff --git a/Packages.txt b/Packages.txt
index 978aba4d55c..2c5554f298c 100644
--- a/Packages.txt
+++ b/Packages.txt
@@ -1,4 +1,4 @@
-# $NetBSD: Packages.txt,v 1.250 2002/06/18 16:14:54 agc Exp $
+# $NetBSD: Packages.txt,v 1.251 2002/06/20 20:15:46 jlam Exp $
###########################################################################
==========================
@@ -2223,7 +2223,9 @@ By default, a new user will have home directory /nonexistent, and login shell
The package Makefile must also include "../../mk/bsd.pkg.install.mk" prior to
the inclusion of bsd.pkg.mk. This will cause the users and groups to be
created at pre-install time, and the admin will be prompted to remove them at
-post-deinstall time.
+post-deinstall time. Automatic creation of the users and groups can be
+toggled on and off by setting the environment variable PKG_CREATE_USERGROUP
+prior to package installation.
10.23 How to handle compiler bugs
@@ -2363,8 +2365,12 @@ them into PKG_SYSCONFDIR. The contents of this variable is formed by pairs
of filenames; the first element of the pair specifies the file inside the
examples directory (registered by PLIST) and the second element specifies
the target file. This is done this way to allow binary packages to place
-files in the right directory (using INSTALL/DEINSTALL scripts which are
-created automatically).
+files in the right directory using INSTALL/DEINSTALL scripts which are
+created automatically. The package Makefile must also include
+"../../mk/bsd.pkg.install.mk" prior to the inclusion of bsd.pkg.mk to use
+these automatically generated scripts. The automatic copying of config
+files can be toggled by setting the environment variable PKG_CONFIG prior
+to package installation.
Here is an example, taken from mail/mutt/Makefile:
diff --git a/mk/bsd.pkg.install.mk b/mk/bsd.pkg.install.mk
index 01a3f31d079..49b8d965103 100644
--- a/mk/bsd.pkg.install.mk
+++ b/mk/bsd.pkg.install.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.install.mk,v 1.18 2002/03/18 15:17:55 jlam Exp $
+# $NetBSD: bsd.pkg.install.mk,v 1.19 2002/06/20 20:15:47 jlam Exp $
#
# This Makefile fragment is included by package Makefiles to use the common
# INSTALL/DEINSTALL scripts. To use this Makefile fragment, simply:
@@ -126,14 +126,7 @@ FILES_SUBST+= CONF_FILES_PERMS=${CONF_FILES_PERMS:Q}
FILES_SUBST+= SUPPORT_FILES=${SUPPORT_FILES:Q}
FILES_SUBST+= SUPPORT_FILES_MODE=${SUPPORT_FILES_MODE}
FILES_SUBST+= SUPPORT_FILES_PERMS=${SUPPORT_FILES_PERMS:Q}
-
-# Default to not installing the rc.d scripts automatically.
-INSTALL_RCD_SCRIPTS?= NO
-.if defined(INSTALL_RCD_SCRIPTS) && (${INSTALL_RCD_SCRIPTS} == NO)
-FILES_SUBST+= RCD_SCRIPTS=
-.else
FILES_SUBST+= RCD_SCRIPTS=${RCD_SCRIPTS:Q}
-.endif
FILES_SUBST+= RCD_SCRIPTS_MODE=${RCD_SCRIPTS_MODE}
FILES_SUBST+= RCD_SCRIPTS_DIR=${RCD_SCRIPTS_DIR}
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index e6a3a54e72d..c982ad6df23 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.992 2002/06/17 09:11:10 grant Exp $
+# $NetBSD: bsd.pkg.mk,v 1.993 2002/06/20 20:15:48 jlam Exp $
#
# This file is in the public domain.
#
@@ -1921,6 +1921,13 @@ do-build:
# Install
+.if defined(PKG_CREATE_USERGROUP)
+INSTALL_SCRIPT_ENV+= PKG_CREATE_USERGROUP=${PKG_CREATE_USERGROUP}
+.endif
+.if defined(PKG_CONFIG)
+INSTALL_SCRIPT_ENV+= PKG_CONFIG=${PKG_CONFIG}
+.endif
+
.if !target(do-install)
do-install:
${_PKG_SILENT}${_PKG_DEBUG}cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} -f ${MAKEFILE} ${INSTALL_TARGET}
@@ -2042,11 +2049,11 @@ real-su-install: ${MESSAGE}
${ECHO_MSG} "Become root and try again to ensure correct permissions."; \
fi
.endif # !NO_MTREE
- ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} pre-install-script
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${INSTALL_SCRIPT_ENV} ${MAKE} ${MAKEFLAGS} pre-install-script
${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} pre-install
${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} do-install
${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} post-install
- ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} post-install-script
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${INSTALL_SCRIPT_ENV} ${MAKE} ${MAKEFLAGS} post-install-script
.for f in ${INFO_FILES}
${_PKG_SILENT}${_PKG_DEBUG}${ECHO} "${INSTALL_INFO} --info-dir=${PREFIX}/info ${PREFIX}/info/${f}"; \
${INSTALL_INFO} --remove --info-dir=${PREFIX}/info ${PREFIX}/info/${f}; \
diff --git a/mk/install/deinstall b/mk/install/deinstall
index d022f432a51..acf2510a70c 100644
--- a/mk/install/deinstall
+++ b/mk/install/deinstall
@@ -1,10 +1,9 @@
# start of deinstall
#
-# $NetBSD: deinstall,v 1.8 2001/11/26 20:37:39 jlam Exp $
+# $NetBSD: deinstall,v 1.9 2002/06/20 20:15:50 jlam Exp $
eval set -- ${PKG_USERS}
-for userset
-do
+for userset; do
user=`
IFS=":"
set -- ${userset}
@@ -13,8 +12,7 @@ do
ALL_USERS="${ALL_USERS} \"${user}\""
done
eval set -- ${PKG_GROUPS}
-for groupset
-do
+for groupset; do
group=`
IFS=":"
set -- ${groupset}
@@ -24,54 +22,46 @@ do
done
eval set -- ${CONF_FILES} ${SUPPORT_FILES}
-for file
-do
+for file; do
ALL_FILES="${ALL_FILES} \"${file}\""
done
eval set -- ${RCD_SCRIPTS}
-for script
-do
+for script; do
samplefile="${PKG_PREFIX}/etc/rc.d/${script}"
file="${RCD_SCRIPTS_DIR}/${script}"
shift
ALL_FILES="${ALL_FILES} \"${samplefile}\" \"${file}\""
done
eval set -- ${CONF_FILES_PERMS} ${SUPPORT_FILES_PERMS}
-while [ $# -gt 0 ]
-do
+while [ $# -gt 0 ]; do
samplefile="$1"; file="$2"; owner="$3"; group="$4"; mode="$5"
shift; shift; shift; shift; shift
ALL_FILES="${ALL_FILES} \"${samplefile}\" \"${file}\""
done
eval set -- ${MAKE_DIRS}
-for dir
-do
+for dir; do
ALL_MAKE_DIRS="${ALL_MAKE_DIRS} \"${dir}\""
done
eval set -- ${MAKE_DIRS_PERMS}
-while [ $# -gt 0 ]
-do
+while [ $# -gt 0 ]; do
dir="$1"; owner="$2"; group="$3"; mode="$4"
shift; shift; shift; shift
ALL_MAKE_DIRS="${ALL_MAKE_DIRS} \"${dir}\""
done
eval set -- ${ALL_MAKE_DIRS} ${OWN_DIRS}
-for dir
-do
+for dir; do
ALL_DIRS="${ALL_DIRS} \"${dir}\""
done
eval set -- ${OWN_DIRS_PERMS}
-while [ $# -gt 0 ]
-do
+while [ $# -gt 0 ]; do
dir="$1"; owner="$2"; group="$3"; mode="$4"
shift; shift; shift; shift
ALL_DIRS="${ALL_DIRS} \"${dir}\""
done
ALL_DIRS=`
( eval set -- ${ALL_DIRS}
- for dir
- do
+ for dir; do
${ECHO} "\"${dir}\""
done
) | ${SORT} -r
@@ -82,123 +72,115 @@ DEINSTALL)
# Remove configuration files if they don't differ from the default
# config file.
#
- eval set -- ${ALL_FILES}
- while [ $# -gt 0 ]
- do
- samplefile="$1"; file="$2"
- shift; shift
-
- if [ "${file}" != "${samplefile}" -a \
- -e "${file}" -a -e "${samplefile}" ]
- then
- if ${CMP} -s "${file}" "${samplefile}"
- then
- ${RM} -f "${file}"
+ if [ "${_PKG_CONFIG}" = "YES" ]; then
+ eval set -- ${ALL_FILES}
+ while [ $# -gt 0 ]; do
+ samplefile="$1"; file="$2"
+ shift; shift
+
+ if [ "${file}" != "${samplefile}" -a \
+ -e "${file}" -a -e "${samplefile}" ]; then
+ if ${CMP} -s "${file}" "${samplefile}"; then
+ ${RM} -f "${file}"
+ fi
fi
- fi
- done
+ done
+ fi
;;
POST-DEINSTALL)
modified_files=''
eval set -- ${ALL_FILES}
- while [ $# -gt 0 ]
- do
+ while [ $# -gt 0 ]; do
samplefile="$1"; file="$2"
shift; shift
- if [ -e "${file}" ]
- then
+ if [ -e "${file}" ]; then
modified_files="${modified_files} \"${file}\""
fi
done
existing_dirs=''
eval set -- ${ALL_DIRS}
- for dir
- do
- is_make_dir=`
- ( eval set -- ${ALL_MAKE_DIRS}
- is_make_dir=0
- for make_dir
- do
- if [ "${dir}" = "${make_dir}" ]
- then
- is_make_dir=1
- break
- fi
- done
- ${ECHO} ${is_make_dir}
- )
- `
- ${RMDIR} -p "${dir}" 2>/dev/null || ${TRUE}
- if [ ${is_make_dir} -eq 0 -a -d "${dir}" ]
- then
- existing_dirs="${existing_dirs} \"${dir}\""
+ for dir; do
+ if [ "${_PKG_CONFIG}" = "YES" ]; then
+ ${RMDIR} -p "${dir}" 2>/dev/null || ${TRUE}
+ is_make_dir=` \
+ eval set -- ${ALL_MAKE_DIRS}; \
+ is_make_dir=0; \
+ for make_dir; do \
+ case "${make_dir}" in \
+ ${dir}) is_make_dir=1; break ;; \
+ esac; \
+ done; \
+ ${ECHO} ${is_make_dir} \
+ `
+ if [ ${is_make_dir} -eq 0 -a -d "${dir}" ]; then
+ existing_dirs="${existing_dirs} \"${dir}\""
+ fi
+ else
+ case "${dir}" in
+ ${PKG_PREFIX}/*)
+ ${RMDIR} -p "${dir}" 2>/dev/null || ${TRUE}
+ ;;
+ esac
+ if [ -d "${dir}" ]; then
+ existing_dirs="${existing_dirs} \"${dir}\""
+ fi
fi
done
if [ -n "${ALL_USERS}" -o -n "${ALL_GROUPS}" -o \
- -n "${modified_files}" -o -n "${existing_dirs}" ]
- then
+ -n "${modified_files}" -o -n "${existing_dirs}" ]; then
${CAT} << EOF
===========================================================================
If you won't be using ${PKGNAME} any longer, you may want to remove
EOF
- if [ -n "${ALL_USERS}" ]
- then
+ if [ -n "${ALL_USERS}" ]; then
${ECHO} ""
${ECHO} -n " * the following users"
sep=": "
eval set -- ${ALL_USERS}
- for user
- do
+ for user; do
${ECHO} -n "${sep}${user}"
sep=", "
done
${ECHO} ""
fi
- if [ -n "${ALL_GROUPS}" ]
- then
+ if [ -n "${ALL_GROUPS}" ]; then
${ECHO} ""
${ECHO} -n " * the following groups"
sep=": "
eval set -- ${ALL_GROUPS}
- for group
- do
+ for group; do
${ECHO} -n "${sep}${group}"
sep=", "
done
${ECHO} ""
fi
- if [ -n "${modified_files}" ]
- then
+ if [ -n "${modified_files}" ]; then
${CAT} << EOF
* the following files:
EOF
eval set -- ${modified_files}
- for file
- do
+ for file; do
${ECHO} " ${file}"
done
fi
- if [ -n "${existing_dirs}" ]
- then
+ if [ -n "${existing_dirs}" ]; then
${CAT} << EOF
* the following directories:
EOF
eval set -- ${existing_dirs}
- for dir
- do
+ for dir; do
${ECHO} " ${dir}"
done
fi
- if [ -n "${RCD_SCRIPTS}" ]
- then
+ if [ -n "${RCD_SCRIPTS}" ]; then
${CAT} << EOF
You many also want to remove any settings in rc.conf that you may have
diff --git a/mk/install/header b/mk/install/header
index 9d448d3886a..6f6c7cd50cc 100644
--- a/mk/install/header
+++ b/mk/install/header
@@ -2,7 +2,7 @@
#
# start of header
#
-# $NetBSD: header,v 1.7 2002/01/10 12:05:26 jlam Exp $
+# $NetBSD: header,v 1.8 2002/06/20 20:15:50 jlam Exp $
PKGNAME=$1
STAGE=$2
@@ -62,4 +62,28 @@ ALL_FILES=
ALL_MAKE_DIRS=
ALL_DIRS=
+case "${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
+ ;;
+*)
+ _PKG_CREATE_USERGROUP=YES
+ ;;
+esac
+
+case "${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
+ ;;
+*)
+ _PKG_CONFIG=YES
+ ;;
+esac
+
# end of header
diff --git a/mk/install/install b/mk/install/install
index cde5d30a3ec..be453aa0394 100644
--- a/mk/install/install
+++ b/mk/install/install
@@ -1,60 +1,101 @@
# start of install
#
-# $NetBSD: install,v 1.8 2002/01/23 15:02:27 jlam Exp $
+# $NetBSD: install,v 1.9 2002/06/20 20:15:50 jlam Exp $
case ${STAGE} in
PRE-INSTALL)
- if [ -n "${PKG_GROUPS}" ]
- then
+ _pkg_exit=0
+ _print_line=1
+ _print_group=1
+ if [ -n "${PKG_GROUPS}" ]; then
eval set -- ${PKG_GROUPS}
- for groupset
- do
- ( IFS=":"
- set -- ${groupset}
- group="$1"; groupid="$2"
-
- # We need to check that ${PKG_GROUP} exists before
- # adding the user. Do it with chgrp to be able to
- # use NIS.
- #
- ${TOUCH} /tmp/grouptest.$$
- if ${CHGRP} ${group} /tmp/grouptest.$$ >/dev/null 2>&1
- then
+ for groupset; do
+ save_IFS="${IFS}"; IFS=":"
+ set -- ${groupset}
+ group="$1"; groupid="$2"
+ IFS="${save_IFS}"
+
+ # We need to check that ${PKG_GROUP} exists before
+ # adding the user. Do it with chgrp to be able to
+ # use NIS.
+ #
+ ${TOUCH} /tmp/grouptest.$$
+ if ${CHGRP} ${group} /tmp/grouptest.$$ >/dev/null 2>&1; then
${ECHO} "Group '${group}' already exists."
- else
+ elif [ "${_PKG_CREATE_USERGROUP}" = "NO" ]; then
+ if [ ${_print_line} -gt 0 ]; then
+ _print_line=0
+ ${CAT} << EOF
+===========================================================================
+EOF
+ if [ ${_print_group} -gt 0 ]; then
+ _print_group=0
+ ${CAT} << EOF
+The following groups need to be created for ${PKGNAME}:
+
+EOF
+ fi
+ fi
+ if [ -z "${groupid}" ]; then
+ groupid_str=
+ else
+ groupid_str=" (${groupid})"
+ fi
+ ${ECHO} " ${group}${groupid_str}"
+ _pkg_exit=1
+ else
groupid_option=
- if [ -n "${groupid}" ]
- then
+ if [ -n "${groupid}" ]; then
groupid_option="-g"
fi
${ECHO} "Creating group: ${group}"
${GROUPADD} ${groupid_option} ${groupid} "${group}"
- fi
- ${RM} -f /tmp/grouptest.$$
- )
+ fi
+ ${RM} -f /tmp/grouptest.$$
done
fi
-
- if [ -n "${PKG_USERS}" ]
- then
+ _print_user=1
+ if [ -n "${PKG_USERS}" ]; then
eval set -- ${PKG_USERS}
- for userset
- do
- ( IFS=":"
- set -- ${userset}
- user="$1"; group="$2"; userid="$3"
- descr="${4:-${PKGBASE} ${user} user}"
- home="${5:-@PKG_USER_HOME@}"
- shell="${6:-@PKG_USER_SHELL@}"
-
- # Use `id' to be able to use NIS.
- if ${ID} "${user}" >/dev/null 2>&1
- then
+ for userset; do
+ save_IFS="${IFS}"; IFS=":"
+ set -- ${userset}
+ user="$1"; group="$2"; userid="$3"
+ descr="${4:-${PKGBASE} ${user} user}"
+ home="${5:-@PKG_USER_HOME@}"
+ shell="${6:-@PKG_USER_SHELL@}"
+ IFS="${save_IFS}"
+
+ # Use `id' to be able to use NIS.
+ if ${ID} "${user}" >/dev/null 2>&1; then
${ECHO} "User '${user}' already exists."
- else
+ elif [ "${_PKG_CREATE_USERGROUP}" = "NO" ]; then
+ if [ ${_print_line} -gt 0 ]; then
+ _print_line=0
+ ${CAT} << EOF
+===========================================================================
+EOF
+ elif [ ${_print_group} -eq 0 ]; then
+ _print_group=1
+ ${ECHO} "";
+ fi
+ if [ ${_print_user} -gt 0 ]; then
+ _print_user=0
+ ${CAT} << EOF
+The following users need to be created for ${PKGNAME}:
+
+EOF
+ fi
+ if [ -z "${userid}" ]; then
+ userid_str=
+ else
+ userid_str=" (${userid})"
+ fi
+ ${ECHO} " ${user}${userid_str}: ${group}, ${home}, ${shell}"
+ _pkg_exit=1
+ else
userid_option=
- if [ -n "${userid}" ]
- then
+ if [ -n "${userid}" ]; then
userid_option="-u"
fi
${ECHO} "Creating user: ${user}"
@@ -64,49 +105,115 @@ PRE-INSTALL)
-d "${home}" \
-s "${shell}" \
"${user}"
- fi
- )
+ fi
done
fi
+ if [ ${_print_line} -eq 0 ]; then
+ ${CAT} << EOF
+===========================================================================
+EOF
+ fi
+ if [ ${_pkg_exit} -gt 0 ]; then
+ exit ${_pkg_exit}
+ fi
;;
POST-INSTALL)
# Create package directories.
- eval set -- ${MAKE_DIRS} ${OWN_DIRS}
- for dir
- do
- ${MKDIR} "${dir}"
- done
- eval set -- ${MAKE_DIRS_PERMS} ${OWN_DIRS_PERMS}
- while [ $# -gt 0 ]
- do
- dir="$1"; owner="$2"; group="$3"; mode="$4"
- shift; shift; shift; shift
- ${MKDIR} "${dir}"
- ${CHOWN} "${owner}" "${dir}"
- ${CHGRP} "${group}" "${dir}"
- ${CHMOD} "${mode}" "${dir}"
- done
+ _print_line=1
+ _print_dirs=1
+ if [ -n "${MAKE_DIRS}" -o -n "${OWN_DIRS}" -o \
+ -n "${MAKE_DIRS_PERMS}" -o -n "${OWN_DIRS_PERMS}" ]; then
+ eval set -- ${MAKE_DIRS} ${OWN_DIRS}
+ for dir; do
+ if [ "${_PKG_CONFIG}" = "NO" ]; then
+ if [ ${_print_line} -gt 0 ]; then
+ _print_line=0
+ ${CAT} << EOF
+===========================================================================
+EOF
+ if [ ${_print_dirs} -gt 0 ]; then
+ _print_dirs=0
+ ${CAT} << EOF
+The following directories should be created for ${PKGNAME}:
- if [ -n "${CONF_FILES}" -o -n "${CONF_FILES_PERMS}" -o \
- -n "${SUPPORT_FILES}" -o -n "${SUPPORT_FILES_PERMS}" -o \
- -n "${RCD_SCRIPTS}" ]
- then
- ${ECHO} "Installing configuration files:"
+EOF
+ fi
+ fi
+ ${ECHO} " ${dir}"
+ else
+ ${MKDIR} "${dir}"
+ fi
+ done
+ eval set -- ${MAKE_DIRS_PERMS} ${OWN_DIRS_PERMS}
+ while [ $# -gt 0 ]; do
+ dir="$1"; owner="$2"; group="$3"; mode="$4"
+ shift; shift; shift; shift
+ if [ "${_PKG_CONFIG}" = "NO" ]; then
+ if [ ${_print_line} -gt 0 ]; then
+ _print_line=0
+ ${CAT} << EOF
+===========================================================================
+EOF
+ if [ ${_print_dirs} -gt 0 ]; then
+ _print_dirs=0
+ ${CAT} << EOF
+The following directories should be created for ${PKGNAME}:
+
+EOF
+ fi
+ fi
+ ${ECHO} " ${dir} (o=${owner}, g=${group}, m=${mode})"
+ else
+ ${MKDIR} "${dir}"
+ ${CHOWN} "${owner}" "${dir}"
+ ${CHGRP} "${group}" "${dir}"
+ ${CHMOD} "${mode}" "${dir}"
+ fi
+ done
+ fi
+
+ _print_files=1
+ if [ "${_PKG_CONFIG}" = "YES" ]; then
+ if [ -n "${CONF_FILES}" -o \
+ -n "${CONF_FILES_PERMS}" -o \
+ -n "${SUPPORT_FILES}" -o \
+ -n "${SUPPORT_FILES_PERMS}" -o \
+ -n "${RCD_SCRIPTS}" ]; then
+ ${CAT} << EOF
+Installing configuration files for ${PKGNAME}:
+
+EOF
+ fi
fi
eval set -- ${CONF_FILES}
- while [ $# -gt 0 ]
- do
+ while [ $# -gt 0 ]; do
samplefile="$1"; file="$2"
shift; shift
- if [ -e "${file}" ]
- then
+ if [ "${_PKG_CONFIG}" = "NO" ]; then
+ if [ ${_print_line} -gt 0 ]; then
+ _print_line=0
+ ${CAT} << EOF
+===========================================================================
+EOF
+ elif [ ${_print_dirs} -eq 0 ]; then
+ _print_dirs=1
+ ${ECHO} "";
+ fi
+ if [ ${_print_files} -gt 0 ]; then
+ _print_files=0
+ ${CAT} << EOF
+The following files should be created for ${PKGNAME}:
+
+EOF
+ fi
+ ${ECHO} " ${file} (m=@CONF_FILES_MODE@)"
+ elif [ -e "${file}" ]; then
${ECHO} " ${file} already exists, example file is"
${ECHO} " ${samplefile}"
else
- if [ -e "${samplefile}" ]
- then
+ if [ -e "${samplefile}" ]; then
${ECHO} " ${file}"
${CP} "${samplefile}" "${file}"
${CHMOD} @CONF_FILES_MODE@ "${file}"
@@ -114,18 +221,33 @@ POST-INSTALL)
fi
done
eval set -- ${SUPPORT_FILES}
- while [ $# -gt 0 ]
- do
+ while [ $# -gt 0 ]; do
samplefile="$1"; file="$2"
shift; shift
- if [ -e "${file}" ]
- then
+ if [ "${_PKG_CONFIG}" = "NO" ]; then
+ if [ ${_print_line} -gt 0 ]; then
+ _print_line=0
+ ${CAT} << EOF
+===========================================================================
+EOF
+ elif [ ${_print_dirs} -eq 0 ]; then
+ _print_dirs=1
+ ${ECHO} "";
+ fi
+ if [ ${_print_files} -gt 0 ]; then
+ _print_files=0
+ ${CAT} << EOF
+The following files should be created for ${PKGNAME}:
+
+EOF
+ fi
+ ${ECHO} " ${file} (m=@SUPPORT_FILES_MODE@)"
+ elif [ -e "${file}" ]; then
${ECHO} " ${file} already exists, example file is"
${ECHO} " ${samplefile}"
else
- if [ -e "${samplefile}" ]
- then
+ if [ -e "${samplefile}" ]; then
${ECHO} " ${file}"
${CP} "${samplefile}" "${file}"
${CHMOD} @SUPPORT_FILES_MODE@ "${file}"
@@ -133,18 +255,34 @@ POST-INSTALL)
fi
done
eval set -- ${CONF_FILES_PERMS} ${SUPPORT_FILES_PERMS}
- while [ $# -gt 0 ]
- do
- samplefile="$1"; file="$2"; owner="$3"; group="$4"; mode="$5"
+ while [ $# -gt 0 ]; do
+ samplefile="$1"; file="$2"
+ owner="$3"; group="$4"; mode="$5"
shift; shift; shift; shift; shift
- if [ -e ${file} ]
- then
+ if [ "${_PKG_CONFIG}" = "NO" ]; then
+ if [ ${_print_line} -gt 0 ]; then
+ _print_line=0
+ ${CAT} << EOF
+===========================================================================
+EOF
+ elif [ ${_print_dirs} -eq 0 ]; then
+ _print_dirs=1
+ ${ECHO} "";
+ fi
+ if [ ${_print_files} -gt 0 ]; then
+ _print_files=0
+ ${CAT} << EOF
+The following files should be created for ${PKGNAME}:
+
+EOF
+ fi
+ ${ECHO} " ${file} (o=${owner}, g=${group}, m=${mode})"
+ elif [ -e ${file} ]; then
${ECHO} " ${file} already exists, example file is"
${ECHO} " ${samplefile}"
else
- if [ -e "${samplefile}" ]
- then
+ if [ -e "${samplefile}" ]; then
${ECHO} " ${file}"
${CP} "${samplefile}" "${file}"
${CHOWN} "${owner}" "${file}"
@@ -154,52 +292,71 @@ POST-INSTALL)
fi
done
eval set -- ${RCD_SCRIPTS}
- for script
- do
+ for script; do
samplefile="${PKG_PREFIX}/etc/rc.d/${script}"
file="${RCD_SCRIPTS_DIR}/${script}"
- if [ -e "${file}" ]
- then
+ if [ "${_PKG_CONFIG}" = "NO" ]; then
+ if [ ${_print_line} -gt 0 ]; then
+ _print_line=0
+ ${CAT} << EOF
+===========================================================================
+EOF
+ elif [ ${_print_dirs} -eq 0 ]; then
+ _print_dirs=1
+ ${ECHO} "";
+ fi
+ if [ ${_print_files} -gt 0 ]; then
+ _print_files=0
+ ${CAT} << EOF
+The following files should be created for ${PKGNAME}:
+
+EOF
+ fi
+ ${ECHO} " ${file} (m=@RCD_SCRIPTS_MODE@)"
+ elif [ -e "${file}" ]; then
${ECHO} " ${file} already exists, example file is"
${ECHO} " ${samplefile}"
else
- if [ -e "${samplefile}" ]
- then
+ if [ -e "${samplefile}" ]; then
${ECHO} " ${file}"
${CP} "${samplefile}" "${file}"
${CHMOD} @RCD_SCRIPTS_MODE@ "${file}"
fi
fi
done
-
- if [ -n "${CONF_FILES}" -o -n "${CONF_FILES_PERMS}" ]
- then
+ if [ ${_print_line} -eq 0 ]; then
${CAT} << EOF
+===========================================================================
+EOF
+ fi
+ if [ "${_PKG_CONFIG}" = "YES" ]; then
+ if [ -n "${CONF_FILES}" -o -n "${CONF_FILES_PERMS}" ]; then
+ ${CAT} << EOF
===========================================================================
-You may wish to customize the following files:
+You may wish to customize the following files for ${PKGNAME}:
EOF
- eval set -- ${CONF_FILES}
- while [ $# -gt 0 ]
- do
- samplefile="$1"; file="$2"
- shift; shift
+ eval set -- ${CONF_FILES}
+ while [ $# -gt 0 ]; do
+ samplefile="$1"; file="$2"
+ shift; shift
- ${ECHO} " ${file}"
- done
- eval set -- ${CONF_FILES_PERMS}
- while [ $# -gt 0 ]
- do
- samplefile="$1"; file="$2"; owner="$3"; group="$4"; mode="$5"
- shift; shift; shift; shift; shift
+ ${ECHO} " ${file}"
+ done
+ eval set -- ${CONF_FILES_PERMS}
+ while [ $# -gt 0 ]; do
+ samplefile="$1"; file="$2"
+ owner="$3"; group="$4"; mode="$5"
+ shift; shift; shift; shift; shift
- ${ECHO} " ${file}"
- done
- ${CAT} << EOF
+ ${ECHO} " ${file}"
+ done
+ ${CAT} << EOF
===========================================================================
EOF
+ fi
fi
;;