summaryrefslogtreecommitdiff
blob: 8d585d2363e1eddc126173f4a656967a319e3d8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh

z="$(find "${D}"usr/share/doc \( -type f -or -type l \) -not -name "*.gz" -not -name "*.js" 2>/dev/null)"

for y in ${z} ; do
	if [ -L "${y}" ] ; then
		# Symlink ...
		mylink="${y}"
		linkto="$(readlink "${y}")"

		if [ "${linkto##*.}" != "gz" ] ; then
			linkto="${linkto}.gz"
		fi
		if [ "${mylink##*.}" != "gz" ] ; then
			mylink="${mylink}.gz"
		fi

		vecho "fixing doc symlink: ${mylink##*/}"
		ln -snf "${linkto}" "${mylink}"
		if [ "${y}" != "${mylink}" ] ; then
			vecho "removing old symlink: ${y##*/}"
			rm -f "${y}"
		fi
	else
		if [ "${y##*.}" != "gz" ] ; then
			vecho "gzipping doc: ${y##*/}"
			gzip -f -9 "${y}"
		fi
	fi	
done