diff options
author | jlam <jlam> | 2003-01-29 19:47:29 +0000 |
---|---|---|
committer | jlam <jlam> | 2003-01-29 19:47:29 +0000 |
commit | a8f8e0eeee12725d6c0d9da36e307c2527815f2a (patch) | |
tree | 6eaa3a77a8914cfc563170ce4f0dc0c52090207c /mk | |
parent | bd6b026393bf2e63fb92bfefad9d88a6e45a3ae0 (diff) | |
download | pkgsrc-a8f8e0eeee12725d6c0d9da36e307c2527815f2a.tar.gz |
Create directories at pre-install time instead of post-install so that
we can more accurately determine if we "own" a directory. Ownership is
determined by seeing if the directory doesn't exist before the package is
installed.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/install/install | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/mk/install/install b/mk/install/install index d9db7e555de..0227cfb95d8 100644 --- a/mk/install/install +++ b/mk/install/install @@ -1,6 +1,6 @@ # start of install # -# $NetBSD: install,v 1.18 2002/11/21 10:11:57 jlam Exp $ +# $NetBSD: install,v 1.19 2003/01/29 19:47:29 jlam Exp $ case ${STAGE} in PRE-INSTALL) @@ -91,6 +91,41 @@ PRE-INSTALL) fi done fi + + # Create package directories at pre-install time. + # + if [ -n "${MAKE_DIRS}" -o -n "${OWN_DIRS}" -o \ + -n "${MAKE_DIRS_PERMS}" -o -n "${OWN_DIRS_PERMS}" ]; then + if [ -z "${RCD_SCRIPTS}" -o "${_PKG_RCD_SCRIPTS}" = "NO" ]; then + _RCD_SCRIPTS_DIR= + else + _RCD_SCRIPTS_DIR="${RCD_SCRIPTS_DIR}" + fi + eval set -- ${_RCD_SCRIPTS_DIR} ${MAKE_DIRS} ${OWN_DIRS} + for dir; do + if [ -d "${dir}" ]; then + continue + fi + if [ "${_PKG_CONFIG}" = "YES" ]; then + ${MKDIR} "${dir}" + ${ECHO} "${PKGBASE}" > "${dir}/.pkgsrc" + 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}" = "YES" ]; then + 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 if ! msgempty; then ${ECHO} "===========================================================================" msgprint @@ -103,10 +138,10 @@ PRE-INSTALL) ;; POST-INSTALL) - msginit # - # Create package directories. + # Note any missing package directories. # + msginit if [ -n "${MAKE_DIRS}" -o -n "${OWN_DIRS}" -o \ -n "${MAKE_DIRS_PERMS}" -o -n "${OWN_DIRS_PERMS}" ]; then _print_dir_header=1 @@ -128,9 +163,6 @@ POST-INSTALL) msgadd "" fi msgadd "#${dir}" - else - ${MKDIR} "${dir}" - ${ECHO} "${PKGBASE}" > "${dir}/.pkgsrc" fi done eval set -- ${MAKE_DIRS_PERMS} ${OWN_DIRS_PERMS} @@ -145,14 +177,6 @@ POST-INSTALL) msgadd "" fi msgadd "#${dir} (o=${owner}, g=${group}, m=${mode})" - else - 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 |