For completeness, add a SUPPORT_FILES_PERMS that acts like CONF_FILES_PERMS

but the user isn't prompted to customize the files at post-install time.
This commit is contained in:
jlam 2001-11-19 23:33:52 +00:00
parent e4565027f9
commit b1d477e863
4 changed files with 34 additions and 29 deletions

View file

@ -1,4 +1,4 @@
# $NetBSD: bsd.pkg.install.mk,v 1.1 2001/11/19 16:18:44 jlam Exp $
# $NetBSD: bsd.pkg.install.mk,v 1.2 2001/11/19 23:33:52 jlam Exp $
#
# This Makefile fragment is included by package Makefiles to use the common
# INSTALL/DEINSTALL scripts. To use this Makefile fragment, simply:
@ -103,7 +103,9 @@ USE_USERGROUP= YES
# 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. SUPPORT_FILES_PERMS is used in the
# same way, but the package admin isn't prompted to customize the file
# at post-install time.
#
# RCD_SCRIPTS works like CONF_FILES but deals with rc.d startup scripts. The
# scripts are copied with ${RCD_SCRIPTS_MODE} permissions.
@ -113,13 +115,15 @@ CONF_FILES_MODE?= 0644
CONF_FILES_PERMS?= # empty
SUPPORT_FILES?= # empty
SUPPORT_FILES_MODE?= 0644
SUPPORT_FILES_PERMS?= # empty
RCD_SCRIPTS?= # empty
RCD_SCRIPTS_MODE?= 0755
FILES_SUBST+= CONF_FILES=${CONF_FILES:Q}
FILES_SUBST+= CONF_FILES_MODE=${CONF_FILES_MODE}
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+= CONF_FILES_PERMS=${CONF_FILES_PERMS:Q}
FILES_SUBST+= SUPPORT_FILES_PERMS=${SUPPORT_FILES_PERMS:Q}
FILES_SUBST+= RCD_SCRIPTS=${RCD_SCRIPTS:Q}
FILES_SUBST+= RCD_SCRIPTS_MODE=${RCD_SCRIPTS_MODE}

View file

@ -1,9 +1,9 @@
# start of deinstall
#
# $NetBSD: deinstall,v 1.1 2001/11/19 16:18:44 jlam Exp $
# $NetBSD: deinstall,v 1.2 2001/11/19 23:33:53 jlam Exp $
ALL_FILES="${CONF_FILES} ${SUPPORT_FILES} ${RCD_SCRIPTS}"
set -- ${CONF_FILES_PERMS}
set -- ${CONF_FILES_PERMS} ${SUPPORT_FILES_PERMS}
while [ $# -gt 0 ]
do
samplefile="$1"; file="$2"; owner="$3"; group="$4"; mode="$5"
@ -46,7 +46,7 @@ DEINSTALL)
shift; shift
if [ "${file}" != "${samplefile}" -a \
-f ${file} -a -f ${samplefile} ]
-e ${file} -a -e ${samplefile} ]
then
if ${CMP} -s ${file} ${samplefile}
then
@ -64,7 +64,7 @@ POST-DEINSTALL)
samplefile="$1"; file="$2"
shift; shift
if [ -f ${file} ]
if [ -e ${file} ]
then
modified_files="${modified_files} ${file}"
fi

View file

@ -2,7 +2,7 @@
#
# start of header
#
# $NetBSD: header,v 1.1 2001/11/19 16:18:44 jlam Exp $
# $NetBSD: header,v 1.2 2001/11/19 23:33:53 jlam Exp $
PKGNAME=$1
STAGE=$2
@ -41,6 +41,7 @@ PKG_GROUPID="@PKG_GROUPID@"
CONF_FILES="@CONF_FILES@"
CONF_FILES_PERMS="@CONF_FILES_PERMS@"
SUPPORT_FILES="@SUPPORT_FILES@"
SUPPORT_FILES_PERMS="@SUPPORT_FILES_PERMS@"
RCD_SCRIPTS="@RCD_SCRIPTS@"
MAKE_DIRS="@MAKE_DIRS@"

View file

@ -1,6 +1,6 @@
# start of install
#
# $NetBSD: install,v 1.1 2001/11/19 16:18:44 jlam Exp $
# $NetBSD: install,v 1.2 2001/11/19 23:33:53 jlam Exp $
case ${STAGE} in
PRE-INSTALL)
@ -71,7 +71,7 @@ POST-INSTALL)
done
if [ -n "${CONF_FILES}" -o -n "${CONF_FILES_PERMS}" -o \
-n "${SUPPORT_FILES}" ]
-n "${SUPPORT_FILES}" -o -n "${SUPPORT_FILES_PERMS}" ]
then
${ECHO} "Installing configuration files:"
fi
@ -81,7 +81,7 @@ POST-INSTALL)
samplefile="$1"; file="$2"
shift; shift
if [ -f ${file} ]
if [ -e ${file} ]
then
${ECHO} " ${file} already exists"
else
@ -90,13 +90,28 @@ POST-INSTALL)
${CHMOD} @CONF_FILES_MODE@ ${file}
fi
done
set -- ${CONF_FILES_PERMS}
set -- ${SUPPORT_FILES}
while [ $# -gt 0 ]
do
samplefile="$1"; file="$2"
shift; shift
if [ -e ${file} ]
then
${ECHO} " ${file} already exists"
else
${ECHO} " ${file}"
${CP} ${samplefile} ${file}
${CHMOD} @SUPPORT_FILES_MODE@ ${file}
fi
done
set -- ${CONF_FILES_PERMS} ${SUPPORT_FILES_PERMS}
while [ $# -gt 0 ]
do
samplefile="$1"; file="$2"; owner="$3"; group="$4"; mode="$5"
shift; shift; shift; shift; shift
if [ -f ${file} ]
if [ -e ${file} ]
then
${ECHO} " ${file} already exists"
else
@ -107,28 +122,13 @@ POST-INSTALL)
${CHMOD} ${mode} ${file}
fi
done
set -- ${SUPPORT_FILES}
while [ $# -gt 0 ]
do
samplefile="$1"; file="$2"
shift; shift
if [ -f ${file} ]
then
${ECHO} " ${file} already exists"
else
${ECHO} " ${file}"
${CP} ${samplefile} ${file}
${CHMOD} @SUPPORT_FILES_MODE@ ${file}
fi
done
set -- ${RCD_SCRIPTS}
while [ $# -gt 0 ]
do
samplefile="$1"; file="$2"
shift; shift
if [ -f ${file} ]
if [ -e ${file} ]
then
${ECHO} " ${file} already exists"
else