diff options
Diffstat (limited to 'bash/helpers/common/dodoc')
-rwxr-xr-x | bash/helpers/common/dodoc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/bash/helpers/common/dodoc b/bash/helpers/common/dodoc new file mode 100755 index 000000000..e64adda36 --- /dev/null +++ b/bash/helpers/common/dodoc @@ -0,0 +1,35 @@ +#!/usr/bin/env pkgcore-ebuild-helper +# Copyright: 2012 Brian Harring <ferringb@gmail.com> +# License: GPL2/BSD 3 clause + +recursive=false +if ${PKGCORE_DODOC_ALLOW_RECURSIVE} && [[ $1 == "-r" ]]; then + recursive=true + shift +fi + +check_args 1 - + +install_paths() { + local mydir=$1 + shift + check_command install -d -- "${mydir}" || return + + for x in "${@}"; do + if [[ ! -e ${x} ]]; then + error "file '${x}' doesn't exist" + elif [[ -d ${x} ]]; then + if ! ${recursive}; then + error "'${x}' is a directory$($PKGCORE_DODOC_ALLOW_RECURSIVE && echo ", perhaps you forgot -r?")" + continue + fi + __directory_is_empty "${x}" && continue + install_paths "${mydir}/${x##*/}" "${x}"/* + elif [[ -s ${x} ]]; then + check_command install -m0644 -- "${x}" "${mydir}" && \ + check_command "${PORTAGE_COMPRESS}" "${PORTAGE_COMPRESS_FLAGS}" -f "${mydir}/${x##*/}" + fi + done +} + +install_paths "${ED}usr/share/doc/${PF}/${PKGCORE_DOCDESTTREE}" "$@" |