diff options
Diffstat (limited to 'subr')
-rw-r--r-- | subr/ex_pkg_env.subr | 1 | ||||
-rw-r--r-- | subr/ex_pkg_exec.subr | 2 | ||||
-rw-r--r-- | subr/pkg_clean.subr | 3 | ||||
-rw-r--r-- | subr/pkg_install.subr | 50 |
4 files changed, 35 insertions, 21 deletions
diff --git a/subr/ex_pkg_env.subr b/subr/ex_pkg_env.subr index 2f2f674c..ff2338e1 100644 --- a/subr/ex_pkg_env.subr +++ b/subr/ex_pkg_env.subr @@ -40,6 +40,7 @@ exp_pkg_env_defaults() { PKG_BUILD_DIR="${PKG_BASE_DIR}/${PKG_BUILD_DIR}"; PKG_CONFIGURE="${PKG_BASE_DIR}/${PKG_CONFIGURE:-${PKG_SUBDIR}/configure}"; PKG_DESTDIR="${PKG_BASE_DIR}/${PKG_DESTDIR:-destdir}"; + PKG_DESTDIR_HOST="${PKG_BASE_DIR}/${PKG_DESTDIR_HOST:-destdir_host}"; }; # diff --git a/subr/ex_pkg_exec.subr b/subr/ex_pkg_exec.subr index d21289b7..992b7c8c 100644 --- a/subr/ex_pkg_exec.subr +++ b/subr/ex_pkg_exec.subr @@ -35,7 +35,7 @@ exp_pkg_exec_pre() { return 1; elif ! ex_pkg_state_test "${_pkg_name}" "start" "${_restart_at}"; then if [ "${PKG_NO_CLEAN_BASE_DIR:-0}" -eq 0 ]\ - && ! rtl_fileop rm "${PKG_BASE_DIR}" "${PKG_BUILD_DIR}" "${PKG_DESTDIR}"\ + && ! rtl_fileop rm "${PKG_BASE_DIR}" "${PKG_BUILD_DIR}" "${PKG_DESTDIR}" "${PKG_DESTDIR_HOST}"\ || ! rtl_fileop mkdir "${PKG_BASE_DIR}"; then return 1; fi; diff --git a/subr/pkg_clean.subr b/subr/pkg_clean.subr index 39b0ead5..a4a70d63 100644 --- a/subr/pkg_clean.subr +++ b/subr/pkg_clean.subr @@ -12,6 +12,9 @@ pkg_clean() { if rtl_lmatch "${ARG_CLEAN_BUILDS}" "dest" ","; then if ! rtl_fileop rm "${PKG_DESTDIR}"; then return 1; + elif [ -e "${PKG_DESTDIR_HOST}" ]\ + && ! rtl_fileop rm "${PKG_DESTDIR_HOST}"; then + return 1; fi; fi; if rtl_lmatch "${ARG_CLEAN_BUILDS}" "src" ","; then diff --git a/subr/pkg_install.subr b/subr/pkg_install.subr index 1f9f1d9d..f869ec5b 100644 --- a/subr/pkg_install.subr +++ b/subr/pkg_install.subr @@ -2,31 +2,41 @@ # set +o errexit -o noglob -o nounset is assumed. # +pkgp_install_perms() { + local _destdir="${1}" _fname="" _ifs_old="${IFS:- }" IFS; + IFS=" +"; for _fname in $(find "${_destdir}" -type d); do + if ! rtl_fileop chmod 0755 "${_fname}"; then + return 1; + fi; + done; + for _fname in $(find "${_destdir}" \( -not -perm /0111 \) -type f); do + if ! rtl_fileop chmod 0644 "${_fname}"; then + return 1; + fi; + done; + for _fname in $(find "${_destdir}" -perm /0111 -type f); do + if ! rtl_fileop chmod 0755 "${_fname}"; then + return 1; + fi; + done; +}; + pkg_install() { - local _fname="" _ifs_old="${IFS:- }" _pkglist_name="" IFS; + local _destdir="" _destdir_prefix="" _ifs_old="${IFS:- }" _pkglist_name="" IFS; if ! rtl_fileop mkdir "${PKG_PREFIX}"; then return 1; - else IFS=" -"; for _fname in $(find "${PKG_DESTDIR}" -type d); do - if ! rtl_fileop chmod 0755 "${_fname}"; then - return 1; + else for _destdir in "${PKG_DESTDIR}:${PKG_PREFIX}" "${PKG_DESTDIR_HOST}:${PREFIX}"; do + IFS=":"; set -- ${_destdir}; IFS="${_ifs_old}"; _destdir="${1}"; _destdir_prefix="${2}"; + if [ -e "${_destdir}" ]; then + pkgp_install_perms "${_destdir}"; + (set +o errexit -o noglob; rtl_flock_acquire 4 || exit "${?}"; date; + trap "rm -f \"${BUILD_WORKDIR}/install.lock\"" EXIT; + if ! tar -C "${_destdir}" -cpf - . | tar -C "${_destdir_prefix}" --overwrite -xpf -; then + exit 1; + fi) 4<>"${BUILD_WORKDIR}/install.lock"; fi; done; - for _fname in $(find "${PKG_DESTDIR}" \( -not -perm /0111 \) -type f); do - if ! rtl_fileop chmod 0644 "${_fname}"; then - return 1; - fi; - done; - for _fname in $(find "${PKG_DESTDIR}" -perm /0111 -type f); do - if ! rtl_fileop chmod 0755 "${_fname}"; then - return 1; - fi; - done; IFS="${_ifs_old}"; - (set +o errexit -o noglob; rtl_flock_acquire 4 || exit "${?}"; date; - trap "rm -f \"${BUILD_WORKDIR}/install.lock\"" EXIT; - if ! tar -C "${PKG_DESTDIR}" -cpf - . | tar -C "${PKG_PREFIX}" --overwrite -xpf -; then - exit 1; - fi) 4<>"${BUILD_WORKDIR}/install.lock"; if [ "${?}" -ne 0 ]; then return 1; elif [ "${PKG_PKGLIST_DISABLE:-0}" -eq 0 ]; then |