| #!/bin/bash |
| # Copyright 1999-2004 Gentoo Foundation |
| # Distributed under the terms of the GNU General Public License v2 |
| # $Id: /var/cvsroot/gentoo-src/portage/bin/prepinfo,v 1.6.2.1 2005/05/29 12:40:08 jstubbs Exp $ |
| |
| if [ -z "$1" ] ; then |
| z="${D}usr/share/info" |
| else |
| if [ -d "${D}$1/share/info" ] ; then |
| z="${D}$1/share/info" |
| else |
| z="${D}$1/info" |
| fi |
| fi |
| |
| [ ! -d "${z}" ] && exit 0 |
| |
| rm -f "${z}"/{dir,dir.info,dir.info.gz} |
| |
| for x in `find "${z}"/ -mindepth 1 -maxdepth 1 \( -type f -or -type l \) 2>/dev/null` ; do |
| if [ -L "${x}" ] ; then |
| # Symlink ... |
| mylink="${x}" |
| linkto="`readlink "${x}"`" |
| |
| if [ "${linkto##*.}" != "gz" ] ; then |
| linkto="${linkto}.gz" |
| fi |
| if [ "${mylink##*.}" != "gz" ] ; then |
| mylink="${mylink}.gz" |
| fi |
| |
| echo "fixing GNU info symlink: ${mylink##*/}" |
| ln -snf "${linkto}" "${mylink}" |
| if [ "${x}" != "${mylink}" ] ; then |
| echo "removing old symlink: ${x##*/}" |
| rm -f "${x}" |
| fi |
| else |
| if [ "${x##*.}" != "gz" ] ; then |
| echo "gzipping GNU info page: ${x##*/}" |
| gzip -f -9 "${x}" |
| fi |
| fi |
| done |