2 # Copyright 1999-2011 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
5 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
7 if [[ $# -lt 1 ]] ; then
8 helpers_die "${0##*/}: at least one argument needed"
12 [[ " ${FEATURES} " == *" force-prefix "* ]] || \
13 case "$EAPI" in 0|1|2) ED=${D} ;; esac
20 if [[ ${x:0:6} == "-i18n=" ]] ; then
24 if [[ ${x:0:6} == ".keep_" ]] ; then
30 # These will be automatically decompressed by ecompressdir.
31 if has ${suffix} Z gz bz2 ; then
33 suffix=${realname##*.}
36 if has "${EAPI:-0}" 2 3 || [[ -z ${i18n} ]] \
37 && ! has "${EAPI:-0}" 0 1 \
38 && [[ $x =~ (.*)\.([a-z][a-z](_[A-Z][A-Z])?)\.(.*) ]]
40 name=${BASH_REMATCH[1]##*/}.${BASH_REMATCH[4]}
41 mandir=${BASH_REMATCH[2]}/man${suffix:0:1}
44 mandir=${i18n#/}man${suffix:0:1}
48 if [[ ${mandir} == *man[0-9n] ]] ; then
49 if [[ -s ${x} ]] ; then
50 if [[ ! -d ${ED}/usr/share/man/${mandir} ]] ; then
51 install -d "${ED}/usr/share/man/${mandir}"
54 install -m0644 "${x}" "${ED}/usr/share/man/${mandir}/${name}"
56 elif [[ ! -e ${x} ]] ; then
57 echo "!!! ${0##*/}: $x does not exist" 1>&2
61 vecho "doman: '${x}' is probably not a man page; skipping" 1>&2
66 [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"