Index: dodoc =================================================================== --- dodoc (Revision 13133) +++ dodoc (Arbeitskopie) @@ -1,10 +1,11 @@ #!/bin/bash -# Copyright 1999-2007 Gentoo Foundation +# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id$ +source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + if [ $# -lt 1 ] ; then - source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh vecho "${0##*/}: at least one argument needed" 1>&2 exit 1 fi @@ -15,14 +16,52 @@ fi ret=0 -for x in "$@" ; do - if [ -s "${x}" ] ; then - install -m0644 "${x}" "${dir}" - ecompress --queue "${dir}/${x##*/}" - elif [ ! -e "${x}" ] ; then - echo "!!! ${0##*/}: $x does not exist" 1>&2 - ((++ret)) + +if hasq "${EAPI:-0}" 0 1 ; then + + for x in "$@" ; do + if [ -s "${x}" ] ; then + install -m0644 "${x}" "${dir}" + ecompress --queue "${dir}/${x##*/}" + elif [ ! -e "${x}" ] ; then + echo "!!! ${0##*/}: $x does not exist" 1>&2 + ((++ret)) + fi + done + +else + + if [[ "$1" == "-r" ]] ; then + DOINSRECUR=y + shift + else + DOINSRECUR=n fi -done + for x in "$@" ; do + + if [ -d "${x}" ] ; then + if [[ ${DOINSRECUR} == "n" ]] ; then + continue + fi + + find "${x}" -mindepth 1 -maxdepth 1 -exec \ + env \ + _E_DOCDESTTREE_="$(basename \"${x}\")" \ + ${0} -r {} \; + + elif [ -s "${x}" ] ; then + install -m0644 "${x}" "${dir}" + ecompress --queue "${dir}/${x##*/}" + + elif [ ! -e "${x}" ] ; then + echo "!!! ${0##*/}: $x does not exist" 1>&2 + ((++ret)) + fi + + done + +fi + exit ${ret} +