void-packages

Void Source Packages
git clone git://ezup.dev/void-packages.git
Log | Files | Refs | README | LICENSE

00-compress-info-files.sh (1112B)


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