void-packages/srcpkgs/xbps-triggers/files/x11-fonts
Juan RP 771ff3b40e xbps-triggers: update to 0.5.
The code for all triggers is handled in ${FILESDIR} now.
Modify the initramfs-tools trigger to always use relative path for /boot,
and to not mount/umount /proc and /sys, left this for the user.
2010-11-04 13:53:46 +01:00

66 lines
1.2 KiB
Bash
Executable file

#!/bin/sh -e
#
# This trigger rebuilds the fonts.dir and fonts.scale files
# for packages that install X11 fonts, and update fontconfig's
# cache for those fonts.
#
# Arguments: $ACTION = [run/targets]
# $TARGET = [post-install/pre-remove]
# $PKGNAME
# $VERSION
# $UPDATE = [yes/no]
#
ACTION="$1"
TARGET="$2"
PKGNAME="$3"
VERSION="$4"
UPDATE="$5"
mkfontdir=usr/bin/mkfontdir
mkfontscale=usr/bin/mkfontscale
fccache=usr/bin/fc-cache
case "$ACTION" in
targets)
echo "post-install pre-remove"
;;
run)
if [ ! -x ${mkfontdir} -a ! -x ${mkfontscale} ]; then
exit 0
fi
[ -z "${font_dirs}" ] && exit 0
case "$TARGET" in
post-install)
for dir in ${font_dirs}; do
echo "Building ${dir}/fonts.dir..."
${mkfontdir} .${dir} || exit $?
echo "Building ${dir}/fonts.scale..."
${mkfontscale} .${dir} || exit $?
echo "Updating fontconfig's cache..."
${fccache} .${dir} 2>/dev/null
done
;;
pre-remove)
for dir in ${font_dirs}; do
if [ -f .${dir}/fonts.dir ]; then
rm -f .${dir}/fonts.dir
fi
if [ -f .${dir}/fonts.scale ]; then
rm -f .${dir}/fonts.scale
fi
if [ -f .${dir}/encodings.dir ]; then
rm -f .${dir}/encodings.dir
fi
done
;;
esac
;;
*)
exit 1
;;
esac
exit 0