diff options
author | jlam <jlam@pkgsrc.org> | 2002-11-21 10:11:57 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2002-11-21 10:11:57 +0000 |
commit | e44ac5236f55723bf720ee64e941fab373d86a41 (patch) | |
tree | 6df7ca5032ac2dce1392495a7edde738cd5bfda3 /mk | |
parent | d2054ffc609007ad2dca038dbbe5c8aec91dbb7d (diff) | |
download | pkgsrc-e44ac5236f55723bf720ee64e941fab373d86a41.tar.gz |
Don't blindly assume that directores listed in OWN_DIRS* and MAKE_DIRS*
that are outside of ${LOCALBASE} belong to the package that lists them.
If the directory already exists before the package is installed, then
we don't presume ownership of the directory.
This addresses pkg/18383 by Grant Beattie.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/install/deinstall | 10 | ||||
-rw-r--r-- | mk/install/install | 14 |
2 files changed, 17 insertions, 7 deletions
diff --git a/mk/install/deinstall b/mk/install/deinstall index 854283fa15f..87ff7254e49 100644 --- a/mk/install/deinstall +++ b/mk/install/deinstall @@ -1,6 +1,6 @@ # start of deinstall # -# $NetBSD: deinstall,v 1.15 2002/11/17 08:58:50 salo Exp $ +# $NetBSD: deinstall,v 1.16 2002/11/21 10:11:57 jlam Exp $ eval set -- ${PKG_USERS} for userset; do @@ -112,7 +112,13 @@ POST-DEINSTALL) eval set -- ${ALL_DIRS} for dir; do if [ "${_PKG_CONFIG}" = "YES" ]; then - ${RMDIR} -p "${dir}" 2>/dev/null || ${TRUE} + if [ -f "${dir}/.pkgsrc" ]; then + dirowner=`${HEAD} -1 "${dir}/.pkgsrc"` + if [ "${dirowner}" = "${PKGBASE}" ]; then + ${RM} -f "${dir}/.pkgsrc" + ${RMDIR} -p "${dir}" 2>/dev/null || ${TRUE} + fi + fi is_make_dir=` \ eval set -- ${ALL_MAKE_DIRS}; \ is_make_dir=0; \ diff --git a/mk/install/install b/mk/install/install index a7f939dac7f..d9db7e555de 100644 --- a/mk/install/install +++ b/mk/install/install @@ -1,6 +1,6 @@ # start of install # -# $NetBSD: install,v 1.17 2002/11/17 08:58:51 salo Exp $ +# $NetBSD: install,v 1.18 2002/11/21 10:11:57 jlam Exp $ case ${STAGE} in PRE-INSTALL) @@ -130,6 +130,7 @@ POST-INSTALL) msgadd "#${dir}" else ${MKDIR} "${dir}" + ${ECHO} "${PKGBASE}" > "${dir}/.pkgsrc" fi done eval set -- ${MAKE_DIRS_PERMS} ${OWN_DIRS_PERMS} @@ -145,10 +146,13 @@ POST-INSTALL) fi msgadd "#${dir} (o=${owner}, g=${group}, m=${mode})" else - ${MKDIR} "${dir}" - ${CHOWN} "${owner}" "${dir}" - ${CHGRP} "${group}" "${dir}" - ${CHMOD} "${mode}" "${dir}" + if [ ! -d "${dir}" ]; then + ${MKDIR} "${dir}" + ${ECHO} "${PKGBASE}" > "${dir}/.pkgsrc" + fi + ${CHOWN} -R "${owner}" "${dir}" + ${CHGRP} -R "${group}" "${dir}" + ${CHMOD} -R "${mode}" "${dir}" fi done fi |