terragrunt: update to 0.69.12.
[void-pkg.git] / common / hooks / post-install / 00-compress-info-files.sh
blob0a1bec5360cd0fbea9b2709c417deee347c641d7
1 # This hook compresses info(1) files.
3 hook() {
4 local f j dirat lnkat newlnk
5 local fpattern="s|${PKGDESTDIR}||g;s|^\./$||g;/^$/d"
7 # Find out if this package contains info files and compress
8 # all them with gzip.
10 if [ ! -f ${PKGDESTDIR}/usr/share/info/dir ]; then
11 return 0
13 # Always remove this file if curpkg is not texinfo.
14 if [ "$pkgname" != "texinfo" ]; then
15 rm -f ${PKGDESTDIR}/usr/share/info/dir
18 find ${PKGDESTDIR}/usr/share/info -type f -follow | while read -r f; do
19 j=$(echo "$f"|sed -e "$fpattern")
20 [ "$j" = "" ] && continue
21 [ "$j" = "/usr/share/info/dir" ] && continue
22 # Ignore compressed files.
23 if [[ "$j" =~ .*.gz$ ]]; then
24 continue
26 # Ignore non info files.
27 if ! [[ "$j" =~ .*.info$ ]] && ! [[ "$j" =~ .*.info-[0-9]*$ ]]; then
28 continue
30 if [ -h ${PKGDESTDIR}/"$j" ]; then
31 dirat="${j%/*}/"
32 lnkat=$(readlink ${PKGDESTDIR}/"$j")
33 newlnk="${j##*/}"
34 rm -f ${PKGDESTDIR}/"$j"
35 cd ${PKGDESTDIR}/"$dirat"
36 ln -s "${lnkat}".gz "${newlnk}".gz
37 continue
39 echo " Compressing info file: $j..."
40 gzip -nfq9 ${PKGDESTDIR}/"$j"
41 done