summaryrefslogtreecommitdiff
path: root/mk/install
diff options
context:
space:
mode:
authorjlam <jlam>2003-09-02 06:59:37 +0000
committerjlam <jlam>2003-09-02 06:59:37 +0000
commit984af56c94635ccfc049443eb0a6f3d0db8421f8 (patch)
tree84e91cd88c93c01f847527b25d244510cb5b95db /mk/install
parentc052edd7f8371af00df92c1a984619eca0c9c254 (diff)
downloadpkgsrc-984af56c94635ccfc049443eb0a6f3d0db8421f8.tar.gz
Merge pkgviews-mk branch into the HEAD by running:
cd pkgsrc/mk cvs update -Pd -A cvs update -Pd -j pkgviews-mk-base -j pkgviews-mk
Diffstat (limited to 'mk/install')
-rw-r--r--mk/install/deinstall51
-rw-r--r--mk/install/header10
-rw-r--r--mk/install/install42
-rw-r--r--mk/install/install-info4
4 files changed, 82 insertions, 25 deletions
diff --git a/mk/install/deinstall b/mk/install/deinstall
index a0e041b7725..470c5ffc811 100644
--- a/mk/install/deinstall
+++ b/mk/install/deinstall
@@ -1,6 +1,6 @@
# start of deinstall
#
-# $NetBSD: deinstall,v 1.17 2003/05/06 17:42:04 jmmv Exp $
+# $NetBSD: deinstall,v 1.18 2003/09/02 07:00:06 jlam Exp $
eval set -- ${PKG_USERS}
for userset; do
@@ -22,8 +22,11 @@ for groupset; do
done
eval set -- ${CONF_FILES} ${SUPPORT_FILES}
-for file; do
- ALL_FILES="${ALL_FILES} \"${file}\""
+while [ $# -gt 0 ]; do
+ samplefile="$1"; file="$2"
+ shift; shift
+ ALL_FILES="${ALL_FILES} \"${samplefile}\" \"${file}\""
+ VIEW_FILES="${VIEW_FILES} \"${file}\""
done
if [ "${_PKG_RCD_SCRIPTS}" = "YES" ]; then
eval set -- ${RCD_SCRIPTS}
@@ -39,6 +42,7 @@ 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}\""
+ VIEW_FILES="${VIEW_FILES} \"${file}\""
done
eval set -- ${RCD_SCRIPTS_DIR} ${MAKE_DIRS}
@@ -70,7 +74,37 @@ ALL_DIRS=`
`
case ${STAGE} in
+VIEW-DEINSTALL)
+ if [ "${_PKG_CONFIG}" = "YES" -a \
+ -n "${PKG_SYSCONFVIEWBASE}" -a -n "${VIEW_FILES}" ]; then
+ if [ -n "${PKG_SYSCONFDEPOTBASE}" ]; then
+ ${LINKFARM} -D -t ${PKG_SYSCONFVIEWBASE} -d ${PKG_SYSCONFDEPOTBASE} ${PKGNAME}
+ else
+ eval set -- ${VIEW_FILES}
+ for file; do
+ link=`${ECHO} ${file} | ${SED} "s,^${PREFIX}/,${PKG_PREFIX}/,"`
+ dir=`${DIRNAME} ${link}`
+ if [ -h "${link}" ]; then
+ ${RM} -f ${link}
+ ${RMDIR} -p ${dir} 2>/dev/null || ${TRUE}
+ fi
+ done
+ fi
+ fi
+ if [ -n "${PKG_SHELL}" -a "${PKG_REGISTER_SHELLS}" = "YES" ]; then
+ ${ECHO} "===> Updating /etc/shells"
+ ${CP} /etc/shells /etc/shells.pkgsrc."$$"
+ (${GREP} -v ${PKG_SHELL} /etc/shells.pkgsrc."$$" || ${TRUE}) > /etc/shells
+ ${RM} /etc/shells.pkgsrc."$$"
+ fi
+ ;;
+
DEINSTALL)
+ if [ "${PKG_INSTALLATION_TYPE}" = "overwrite" ]; then
+ ${SETENV} PKG_PREFIX="${PKG_PREFIX}" \
+ $0 ${PKGNAME} VIEW-DEINSTALL
+ fi
+
# Remove configuration files if they don't differ from the default
# config file.
#
@@ -88,12 +122,6 @@ DEINSTALL)
fi
done
fi
- if [ -n "${PKG_SHELL}" -a "${PKG_REGISTER_SHELLS}" = "YES" ]; then
- ${ECHO} "===> Updating /etc/shells"
- ${CP} /etc/shells /etc/shells.pkgsrc."$$"
- (${GREP} -v ${PKG_SHELL} /etc/shells.pkgsrc."$$" || ${TRUE}) > /etc/shells
- ${RM} /etc/shells.pkgsrc."$$"
- fi
;;
POST-DEINSTALL)
@@ -216,11 +244,6 @@ EOF
EOF
fi
;;
-
-*)
- ${ECHO} "Unexpected argument: ${STAGE}"
- exit 1
- ;;
esac
# end of deinstall
diff --git a/mk/install/header b/mk/install/header
index a585fcbc094..a6bc0ee4692 100644
--- a/mk/install/header
+++ b/mk/install/header
@@ -2,7 +2,7 @@
#
# start of header
#
-# $NetBSD: header,v 1.18 2003/08/30 18:42:37 jlam Exp $
+# $NetBSD: header,v 1.19 2003/09/02 07:00:07 jlam Exp $
PKGNAME=$1
STAGE=$2
@@ -26,6 +26,7 @@ GROUPADD="@GROUPADD@"
GTAR="@GTAR@"
HEAD="@HEAD@"
ID="@ID@"
+LINKFARM="@LINKFARM@"
LN="@LN@"
MKDIR="@MKDIR@"
MV="@MV@"
@@ -33,6 +34,7 @@ PERL5="@PERL5@"
RM="@RM@"
RMDIR="@RMDIR@"
SED="@SED@"
+SETENV="@SETENV@"
SH="@SH@"
SORT="@SORT@"
SU="@SU@"
@@ -44,6 +46,7 @@ USERADD="@USERADD@"
XARGS="@XARGS@"
PKGBASE="@PKGBASE@"
+PREFIX="@PREFIX@"
PKG_USERS="@PKG_USERS@"
PKG_GROUPS="@PKG_GROUPS@"
@@ -64,6 +67,8 @@ OWN_DIRS="@OWN_DIRS@"
OWN_DIRS_PERMS="@OWN_DIRS_PERMS@"
PKG_SYSCONFBASE="@PKG_SYSCONFBASE@"
+PKG_SYSCONFDEPOTBASE="@PKG_SYSCONFDEPOTBASE@"
+PKG_SYSCONFVIEWBASE="@PKG_SYSCONFVIEWBASE@"
PKG_SYSCONFDIR="@PKG_SYSCONFDIR@"
PKG_REGISTER_SHELLS="@PKG_REGISTER_SHELLS@"
@@ -74,6 +79,9 @@ ALL_GROUPS=
ALL_FILES=
ALL_MAKE_DIRS=
ALL_DIRS=
+VIEW_FILES=
+
+PKG_INSTALLATION_TYPE="@PKG_INSTALLATION_TYPE@"
case "${PKG_CREATE_USERGROUP:-@PKG_CREATE_USERGROUP@}" in
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
diff --git a/mk/install/install b/mk/install/install
index 99e95a56f9e..d3a3505a9b0 100644
--- a/mk/install/install
+++ b/mk/install/install
@@ -1,6 +1,6 @@
# start of install
#
-# $NetBSD: install,v 1.20 2003/06/25 08:26:51 jlam Exp $
+# $NetBSD: install,v 1.21 2003/09/02 07:00:07 jlam Exp $
case ${STAGE} in
PRE-INSTALL)
@@ -108,7 +108,14 @@ PRE-INSTALL)
fi
if [ "${_PKG_CONFIG}" = "YES" ]; then
${MKDIR} "${dir}"
- ${ECHO} "${PKGBASE}" > "${dir}/.pkgsrc"
+ if [ "${PKG_INSTALLATION_TYPE}" = "pkgviews" ]; then
+ case "${dir}" in
+ ${PKG_PREFIX}|${PKG_PREFIX}/*) ;;
+ *) ${ECHO} "${PKGBASE}" > "${dir}/.pkgsrc" ;;
+ esac
+ else
+ ${ECHO} "${PKGBASE}" > "${dir}/.pkgsrc"
+ fi
fi
done
eval set -- ${MAKE_DIRS_PERMS} ${OWN_DIRS_PERMS}
@@ -118,7 +125,14 @@ PRE-INSTALL)
if [ "${_PKG_CONFIG}" = "YES" ]; then
if [ ! -d "${dir}" ]; then
${MKDIR} "${dir}"
- ${ECHO} "${PKGBASE}" > "${dir}/.pkgsrc"
+ if [ "${PKG_INSTALLATION_TYPE}" = "pkgviews" ]; then
+ case "${dir}" in
+ ${PKG_PREFIX}|${PKG_PREFIX}/*) ;;
+ *) ${ECHO} "${PKGBASE}" > "${dir}/.pkgsrc" ;;
+ esac
+ else
+ ${ECHO} "${PKGBASE}" > "${dir}/.pkgsrc"
+ fi
${CHOWN} -R "${owner}" "${dir}"
${CHGRP} -R "${group}" "${dir}"
${CHMOD} -R "${mode}" "${dir}"
@@ -346,6 +360,13 @@ EOF
EOF
fi
fi
+ if [ "${PKG_INSTALLATION_TYPE}" = "overwrite" ]; then
+ ${SETENV} PKG_PREFIX="${PKG_PREFIX}" \
+ $0 ${PKGNAME} VIEW-INSTALL
+ fi
+ ;;
+
+VIEW-INSTALL)
if [ -n "${PKG_SHELL}" -a "${PKG_REGISTER_SHELLS}" = "YES" ]; then
${ECHO} "===> Updating /etc/shells"
${TOUCH} /etc/shells
@@ -353,11 +374,16 @@ EOF
(${GREP} -v ${PKG_SHELL} /etc/shells.pkgsrc."$$" || ${TRUE}; ${ECHO} ${PKG_SHELL}) > /etc/shells
${RM} /etc/shells.pkgsrc."$$"
fi
- ;;
-
-*)
- ${ECHO} "Unexpected argument: ${STAGE}"
- exit 1
+ if [ "${_PKG_CONFIG}" = "YES" -a \
+ -n "${PKG_SYSCONFVIEWBASE}" -a \
+ -n "${PKG_SYSCONFDEPOTBASE}" ]; then
+ if [ -n "${CONF_FILES}" -o \
+ -n "${CONF_FILES_PERMS}" -o \
+ -n "${SUPPORT_FILES}" -o \
+ -n "${SUPPORT_FILES_PERMS}" ]; then
+ ${LINKFARM} -t ${PKG_SYSCONFVIEWBASE} -d ${PKG_SYSCONFDEPOTBASE} ${PKGNAME}
+ fi
+ fi
;;
esac
diff --git a/mk/install/install-info b/mk/install/install-info
index dca9f475bf1..bb3dc2e1c03 100644
--- a/mk/install/install-info
+++ b/mk/install/install-info
@@ -8,7 +8,7 @@ INSTALL_INFO="@INSTALL_INFO@"
INFO_DIR="@INFO_DIR@"
case ${STAGE} in
-POST-INSTALL)
+VIEW-INSTALL)
if [ -f ${PKG_PREFIX}/${INFO_DIR}/dir ]; then
_nentries="`${GREP} -c '^\*' ${PKG_PREFIX}/${INFO_DIR}/dir 2>/dev/null`"
if [ x"${_nentries}" != x -a "${_nentries}" -lt 1 ]; then
@@ -23,7 +23,7 @@ POST-INSTALL)
${PKG_PREFIX}/${INFO_DIR}/${f}
done
;;
-DEINSTALL)
+VIEW-DEINSTALL)
for f in ${INFO_FILES}; do
${INSTALL_INFO} --delete --info-dir=${PKG_PREFIX}/${INFO_DIR} \
${PKG_PREFIX}/${INFO_DIR}/${f} 1>/dev/null 2>&1