summaryrefslogtreecommitdiff
path: root/mk/install
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2003-09-17 02:38:22 +0000
committerjlam <jlam@pkgsrc.org>2003-09-17 02:38:22 +0000
commit399f83c52684953c1f0a9bb47fc6e1d31bf8e921 (patch)
tree075c2f5dda579f36707f768f171254501ff90c89 /mk/install
parented80fbf036a40411e1b2b3b1334cbd555e4d6324 (diff)
downloadpkgsrc-399f83c52684953c1f0a9bb47fc6e1d31bf8e921.tar.gz
Introduce a new variable "CONF_DEPENDS" for pkgviews: a package's
config directory matches the config directory for the dependency listed in CONF_DEPENDS. Use symlinks to physically point the package's config directory to the dependency's config directory, and handle all of this in the INSTALL/DEINSTALL scripts. Also make the INSTALL/DEINSTALL scripts a bit smarter about not copying files and not removing files if the source and destination file locations point to the same thing.
Diffstat (limited to 'mk/install')
-rw-r--r--mk/install/deinstall12
-rw-r--r--mk/install/header6
-rw-r--r--mk/install/install40
3 files changed, 46 insertions, 12 deletions
diff --git a/mk/install/deinstall b/mk/install/deinstall
index 84e70d14a3a..eed6f0533bc 100644
--- a/mk/install/deinstall
+++ b/mk/install/deinstall
@@ -1,6 +1,6 @@
# start of deinstall
#
-# $NetBSD: deinstall,v 1.21 2003/09/13 10:06:36 jlam Exp $
+# $NetBSD: deinstall,v 1.22 2003/09/17 02:38:29 jlam Exp $
eval set -- ${PKG_USERS}
for userset; do
@@ -116,7 +116,7 @@ DEINSTALL)
samplefile="$1"; file="$2"
shift; shift
- if [ "${file}" != "${samplefile}" -a \
+ if [ ! "${file}" -ef "${samplefile}" -a \
-e "${file}" -a -e "${samplefile}" ]; then
if ${CMP} -s "${file}" "${samplefile}"; then
${RM} -f "${file}"
@@ -138,6 +138,14 @@ POST-DEINSTALL)
fi
done
+ if [ "${PKG_INSTALLATION_TYPE}" = "pkgviews" -a \
+ "${_PKG_CONFIG}" = "YES" -a -n "${CONF_DEPENDS}" ]; then
+ if [ -h ${PKG_SYSCONFDIR} ]; then
+ ${RM} -f ${PKG_SYSCONFDIR}
+ fi
+ ${RMDIR} -p `${DIRNAME} ${PKG_SYSCONFDIR}` 2>/dev/null || ${TRUE}
+ fi
+
existing_dirs=''
eval set -- ${ALL_DIRS}
for dir; do
diff --git a/mk/install/header b/mk/install/header
index a86d04e4b09..4f78b37545f 100644
--- a/mk/install/header
+++ b/mk/install/header
@@ -2,7 +2,7 @@
#
# start of header
#
-# $NetBSD: header,v 1.22 2003/09/13 10:06:36 jlam Exp $
+# $NetBSD: header,v 1.23 2003/09/17 02:38:30 jlam Exp $
PKGNAME=$1
STAGE=$2
@@ -31,6 +31,8 @@ LN="@LN@"
MKDIR="@MKDIR@"
MV="@MV@"
PERL5="@PERL5@"
+PKG_ADMIN="@PKG_ADMIN@"
+PKG_INFO="@PKG_INFO@"
RM="@RM@"
RMDIR="@RMDIR@"
SED="@SED@"
@@ -49,6 +51,7 @@ PKGBASE="@PKGBASE@"
LOCALBASE="@LOCALBASE@"
X11BASE="@X11BASE@"
+DEPOTBASE="@DEPOTBASE@"
PREFIX="@PREFIX@"
case ${PKG_PREFIX} in
${LOCALBASE}/*) VIEW="${PKG_PREFIX#${LOCALBASE}/}" ;;
@@ -77,6 +80,7 @@ PKG_SYSCONFBASE="@PKG_SYSCONFBASE@"
PKG_SYSCONFDEPOTBASE="@PKG_SYSCONFDEPOTBASE@"
PKG_SYSCONFBASEDIR="@PKG_SYSCONFBASEDIR@"
PKG_SYSCONFDIR="@PKG_SYSCONFDIR@"
+CONF_DEPENDS="@CONF_DEPENDS@"
case ${VIEW} in
"") PKG_SYSCONFVIEWBASE="${PKG_SYSCONFBASE}" ;;
diff --git a/mk/install/install b/mk/install/install
index fe296488be1..be97abf0bbb 100644
--- a/mk/install/install
+++ b/mk/install/install
@@ -1,6 +1,6 @@
# start of install
#
-# $NetBSD: install,v 1.24 2003/09/13 10:06:36 jlam Exp $
+# $NetBSD: install,v 1.25 2003/09/17 02:38:30 jlam Exp $
if [ -z "${CONF_FILES}" -a -z "${CONF_FILES_PERMS}" -a \
-z "${SUPPORT_FILES}" -a -z "${SUPPORT_FILES_PERMS}" -o \
@@ -108,6 +108,20 @@ PRE-INSTALL)
# Create package directories at pre-install time.
#
+ if [ "${PKG_INSTALLATION_TYPE}" = "pkgviews" -a \
+ "${_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=/ { \
+ gsub("^PKG_SYSCONFDIR=[ ]*", ""); \
+ print; \
+ }' \
+ `
+ if [ -d $sysconfdir -a ! -e ${PKG_SYSCONFDIR} ]; then
+ ${MKDIR} -p `${DIRNAME} ${PKG_SYSCONFDIR}`
+ ${LN} -sf $sysconfdir ${PKG_SYSCONFDIR}
+ fi
+ fi
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}
@@ -227,8 +241,10 @@ EOF
fi
msgadd "#${file} (m=@CONF_FILES_MODE@)"
elif [ -e "${file}" ]; then
- ${ECHO} " ${file} already exists, example file is"
- ${ECHO} " ${samplefile}"
+ if [ ! "${file}" -ef "${samplefile}" ]; then
+ ${ECHO} " ${file} already exists, example file is"
+ ${ECHO} " ${samplefile}"
+ fi
else
if [ -e "${samplefile}" ]; then
${ECHO} " ${file}"
@@ -251,8 +267,10 @@ EOF
fi
msgadd "#${file} (m=@SUPPORT_FILES_MODE@)"
elif [ -e "${file}" ]; then
- ${ECHO} " ${file} already exists, example file is"
- ${ECHO} " ${samplefile}"
+ if [ ! "${file}" -ef "${samplefile}" ]; then
+ ${ECHO} " ${file} already exists, example file is"
+ ${ECHO} " ${samplefile}"
+ fi
else
if [ -e "${samplefile}" ]; then
${ECHO} " ${file}"
@@ -276,8 +294,10 @@ EOF
fi
msgadd "#${file} (o=${owner}, g=${group}, m=${mode})"
elif [ -e ${file} ]; then
- ${ECHO} " ${file} already exists, example file is"
- ${ECHO} " ${samplefile}"
+ if [ ! "${file}" -ef "${samplefile}" ]; then
+ ${ECHO} " ${file} already exists, example file is"
+ ${ECHO} " ${samplefile}"
+ fi
else
if [ -e "${samplefile}" ]; then
${ECHO} " ${file}"
@@ -303,8 +323,10 @@ EOF
fi
msgadd "#${file} (m=@RCD_SCRIPTS_MODE@)"
elif [ -e "${file}" ]; then
- ${ECHO} " ${file} already exists, example file is"
- ${ECHO} " ${samplefile}"
+ if [ ! "${file}" -ef "${samplefile}" ]; then
+ ${ECHO} " ${file} already exists, example file is"
+ ${ECHO} " ${samplefile}"
+ fi
else
if [ -e "${samplefile}" ]; then
${ECHO} " ${file}"