aboutsummaryrefslogtreecommitdiff
path: root/common/hooks/post-install/00-uncompress-manpages.sh
blob: 3c0d2e2392e2955a0dd9e2c09458ed39cabbb0b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# This hook uncompresses man(1) files.

hook() {
	local f lnkat mandir=${PKGDESTDIR}/usr/share/man

	if [ ! -d $mandir ] ||
	   [ -z "$(find $mandir -regex '.*\.\(gz\|bz2\)' -print -quit)" ]; then
		return 0
	fi

	# rewrite symlinks
	find $mandir -type l -regex '.*\.\(gz\|bz2\)' | while read -r f; do
		lnkat=$(readlink "$f")
		ln -s ${lnkat%.*} ${f%.*}
		rm $f
	done

	find $mandir -type f -name '*.gz' -exec gunzip -v -f {} + &>/dev/null
	find $mandir -type f -name '*.bz2' -exec bunzip2 -v -f {} + &>/dev/null
}