prepstrip: add support for elfutils strip
[portage.git] / bin / ebuild-helpers / prepinfo
1 #!/bin/bash
2 # Copyright 1999-2011 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4
5 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
6
7 if [[ -z $1 ]] ; then
8         infodir="/usr/share/info"
9 else
10         if [[ -d ${D}$1/share/info ]] ; then
11                 infodir="$1/share/info"
12         else
13                 infodir="$1/info"
14         fi
15 fi
16
17 if [[ ! -d ${D}${infodir} ]] ; then
18         if [[ -n $1 ]] ; then
19                 vecho "${0##*/}: '${infodir}' does not exist!"
20                 exit 1
21         else
22                 exit 0
23         fi
24 fi
25
26 find "${D}${infodir}" -type d -print0 | while read -r -d $'\0' x ; do
27         for f in "${x}"/.keepinfodir*; do
28                 [[ -e ${f} ]] && continue 2
29         done
30         rm -f "${x}"/dir{,.info}{,.gz,.bz2}
31 done
32
33 has "${EAPI}" 0 1 2 3 || exit 0
34 exec ecompressdir --queue "${infodir}"