summaryrefslogtreecommitdiff
blob: 6c540a2fd1593c8631cff305c937c4fd1549a9b1 (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
#!/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/prepalldocs,v 1.6 2004/10/04 13:56:50 vapier Exp $

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

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