From 825d751b0315799b144bc40beb0cb5804790f68c Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Sun, 6 Jul 2014 16:15:09 +0200 Subject: [PATCH] new hook: post-install/00-uncompress-manpages.sh --- .../post-install/00-uncompress-manpages.sh | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 common/hooks/post-install/00-uncompress-manpages.sh diff --git a/common/hooks/post-install/00-uncompress-manpages.sh b/common/hooks/post-install/00-uncompress-manpages.sh new file mode 100644 index 00000000000..5547e053db9 --- /dev/null +++ b/common/hooks/post-install/00-uncompress-manpages.sh @@ -0,0 +1,27 @@ +# This hook uncompresses man(1) files. + +hook() { + local f lnkat mandir=${PKGDESTDIR}/usr/share/man + + if [ -d ${PKGDESTDIR}/usr/man ]; then + msg_error "${pkgver}: /usr/man directory is not allowed, use /usr/share/man.\n" + fi + + if [ ! -d $mandir ] || + [ -z "$(find $mandir -regex '.*\.\(gz\|bz2\)' -print -quit)" ]; then + return 0 + fi + + echo " Uncompressing manpages..." + + # rewrite symlinks + find $mandir -type l -regex '.*\.\(gz\|bz2\)' | while read f + do + lnkat=$(readlink "$f") + ln -vs ${lnkat%.*} ${f%.*} + rm $f + done + + find $mandir -type f -name '*.gz' -exec gunzip -v {} + + find $mandir -type f -name '*.bz2' -exec bunzip2 -v {} + +}