common/hooks: add some hooks moved from xbps-src (not yet used).
This commit is contained in:
parent
372ed2763f
commit
907f392e4d
11 changed files with 486 additions and 0 deletions
45
common/hooks/post-install/00-compress-info-files.sh
Normal file
45
common/hooks/post-install/00-compress-info-files.sh
Normal file
|
@ -0,0 +1,45 @@
|
|||
# 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
|
||||
msg_normal "$pkgver: processing info(1) files...\n"
|
||||
|
||||
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.
|
||||
if $(echo "$j"|grep -q '.*.gz$'); then
|
||||
continue
|
||||
fi
|
||||
# Ignore non info files.
|
||||
if ! $(echo "$j"|grep -q '.*.info$') && \
|
||||
! $(echo "$j"|grep -q '.*.info-[0-9]*$'); then
|
||||
continue
|
||||
fi
|
||||
if [ -h ${PKGDESTDIR}/"$j" ]; then
|
||||
dirat=$(dirname "$j")
|
||||
lnkat=$(readlink ${PKGDESTDIR}/"$j")
|
||||
newlnk=$(basename "$j")
|
||||
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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue