blob: 405b3448ae2ea7f7b48a91c7980e8a68c0177637 (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#!/bin/bash
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/prepman,v 1.12 2005/05/04 23:50:33 vapier Exp $
if [ -z "$1" ] ; then
z="${D}usr/share/man"
else
z="${D}$1/man"
fi
[ ! -d "${z}" ] && exit 0
PORTAGE_COMPRESS=${PORTAGE_COMPRESS:-gzip}
PORTAGE_COMPRESS_FLAGS=${PORTAGE_COMPRESS_FLAGS:--9}
if [ -z "${PORTAGE_COMPRESS_SUFFIX}" ] ; then
case ${PORTAGE_COMPRESS} in
gzip) suffix="gz";;
bzip2) suffix="bz2";;
*) echo "prepman error: please set PORTAGE_COMPRESS_SUFFIX in make.conf" 1>&2
exit 1;;
esac
fi
if [ -z "${prepallman_banner}" ] ; then
echo "man: ${PORTAGE_COMPRESS} ${PORTAGE_COMPRESS_FLAGS}"
fi
for x in `find "${z}"/ -type d 2>/dev/null` ; do
for y in `find "${x}"/ \( -type f -or -type l \) ! -name '.keep' -maxdepth 1 -mindepth 1 2>/dev/null` ; do
if [ -L "${y}" ] ; then
# Symlink ...
mylink=${y}
linkto=$(readlink "${y}")
# Do NOT change links to directories
if [ -d "${z}/${linkto}" ] ; then
continue
fi
if [ "${linkto##*.}" != "${suffix}" ] ; then
linkto="${linkto}.${suffix}"
fi
if [ "${mylink##*.}" != "${suffix}" ] ; then
mylink="${mylink}.${suffix}"
fi
echo " link fixed ${mylink##*/}"
ln -snf "${linkto}" "${mylink}"
if [ "${y}" != "${mylink}" ] ; then
echo " link removed ${y##*/}"
rm -f "${y}"
fi
else
if [ "${y##*.}" != "${suffix}" ] && [ ! -d "${y}" ] ; then
echo " compressing ${y##*/}"
"${PORTAGE_COMPRESS}" ${PORTAGE_COMPRESS_FLAGS} -f "${y}"
fi
fi
done
done
|