2014-02-12 12:55:42 +01:00
|
|
|
# This hook compresses info(1) files.
|
|
|
|
|
|
|
|
hook() {
|
|
|
|
local f j dirat lnkat newlnk
|
|
|
|
local fpattern="s|${PKGDESTDIR}||g;s|^\./$||g;/^$/d"
|
|
|
|
#
|
|
|
|
# Find out if this package contains info files and compress
|
|
|
|
# all them with gzip.
|
|
|
|
#
|
|
|
|
if [ ! -f ${PKGDESTDIR}/usr/share/info/dir ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
# Always remove this file if curpkg is not texinfo.
|
|
|
|
if [ "$pkgname" != "texinfo" ]; then
|
|
|
|
rm -f ${PKGDESTDIR}/usr/share/info/dir
|
|
|
|
fi
|
|
|
|
|
|
|
|
find ${PKGDESTDIR}/usr/share/info -type f -follow | while read f
|
|
|
|
do
|
|
|
|
j=$(echo "$f"|sed -e "$fpattern")
|
|
|
|
[ "$j" = "" ] && continue
|
|
|
|
[ "$j" = "/usr/share/info/dir" ] && continue
|
|
|
|
# Ignore compressed files.
|
2019-04-14 13:05:31 +02:00
|
|
|
if [[ "$j" =~ .*.gz$ ]]; then
|
2014-02-12 12:55:42 +01:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
# Ignore non info files.
|
2019-04-14 13:05:31 +02:00
|
|
|
if ! [[ "$j" =~ .*.info$ ]] && ! [[ "$j" =~ .*.info-[0-9]*$ ]]; then
|
2014-02-12 12:55:42 +01:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
if [ -h ${PKGDESTDIR}/"$j" ]; then
|
2019-04-13 22:44:30 +02:00
|
|
|
dirat="${j%/*}/"
|
2014-02-12 12:55:42 +01:00
|
|
|
lnkat=$(readlink ${PKGDESTDIR}/"$j")
|
2015-09-11 07:55:40 +02:00
|
|
|
newlnk="${j##*/}"
|
2014-02-12 12:55:42 +01:00
|
|
|
rm -f ${PKGDESTDIR}/"$j"
|
|
|
|
cd ${PKGDESTDIR}/"$dirat"
|
|
|
|
ln -s "${lnkat}".gz "${newlnk}".gz
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
echo " Compressing info file: $j..."
|
|
|
|
gzip -nfq9 ${PKGDESTDIR}/"$j"
|
|
|
|
done
|
|
|
|
}
|