#!/bin/bash # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: prepalldocs 3483 2006-06-10 21:40:40Z genone $ if [[ -z $1 ]] ; then echo "${0##*/}: at least one argument needed" 1>&2 exit 1 fi # figure out the new suffix suffix=$(ecompress --suffix) if [[ -z ${suffix} ]] ; then vecho "${0##*/}: unable to figure out compressed suffix" exit 1 fi source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh ret=0 for dir in "$@" ; do dir="${D}${dir}" if [[ ! -d ${dir} ]] ; then vecho "${0##*/}: ${dir#${D}} does not exist!" continue else vecho "${0##*/}: $(ecompress --bin) ${dir#${D}}" fi find "${dir}" -type f '!' -name '*'${suffix} -print0 | ${XARGS} -0 ecompress ((ret+=$?)) find -L "${dir}" -type l | \ while read brokenlink ; do olddest=$(readlink "${brokenlink}") newdest="${olddest}${suffix}" rm -f "${brokenlink}" ln -snf "${newdest}" "${brokenlink}${suffix}" ((ret+=$?)) done done exit ${ret}