2009-12-11 06:23:49 +00:00
|
|
|
#!/bin/sh -e
|
2009-03-23 15:42:01 +00:00
|
|
|
#
|
|
|
|
# This trigger rebuilds the fonts.dir and fonts.scale files
|
2009-03-23 17:48:25 +00:00
|
|
|
# for packages that install X11 fonts, and update fontconfig's
|
|
|
|
# cache for those fonts.
|
2009-03-23 15:42:01 +00:00
|
|
|
#
|
2009-12-11 06:23:49 +00:00
|
|
|
# Arguments: $ACTION = [run/targets]
|
|
|
|
# $TARGET = [post-install/pre-remove]
|
|
|
|
# $PKGNAME
|
|
|
|
# $VERSION
|
|
|
|
# $UPDATE = [yes/no]
|
2009-03-23 15:42:01 +00:00
|
|
|
#
|
2009-12-11 06:23:49 +00:00
|
|
|
ACTION="$1"
|
|
|
|
TARGET="$2"
|
|
|
|
PKGNAME="$3"
|
|
|
|
VERSION="$4"
|
|
|
|
UPDATE="$5"
|
|
|
|
|
2009-05-19 00:13:58 +00:00
|
|
|
mkfontdir=usr/bin/mkfontdir
|
|
|
|
mkfontscale=usr/bin/mkfontscale
|
|
|
|
fccache=usr/bin/fc-cache
|
2009-03-23 16:39:24 +00:00
|
|
|
|
2009-12-11 06:23:49 +00:00
|
|
|
case "$ACTION" in
|
2009-03-23 15:42:01 +00:00
|
|
|
targets)
|
|
|
|
echo "post-install pre-remove"
|
|
|
|
;;
|
|
|
|
run)
|
|
|
|
if [ ! -x ${mkfontdir} -a ! -x ${mkfontscale} ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
[ -z "${font_dirs}" ] && exit 0
|
|
|
|
|
2009-12-11 06:23:49 +00:00
|
|
|
case "$TARGET" in
|
2009-03-23 15:42:01 +00:00
|
|
|
post-install)
|
|
|
|
for dir in ${font_dirs}; do
|
|
|
|
echo "Building ${dir}/fonts.dir..."
|
2009-03-23 16:39:24 +00:00
|
|
|
${mkfontdir} .${dir} || exit $?
|
2009-03-23 15:42:01 +00:00
|
|
|
echo "Building ${dir}/fonts.scale..."
|
2009-03-23 16:39:24 +00:00
|
|
|
${mkfontscale} .${dir} || exit $?
|
2009-03-23 17:48:25 +00:00
|
|
|
echo "Updating fontconfig's cache..."
|
2009-04-08 01:23:09 +00:00
|
|
|
${fccache} .${dir} 2>/dev/null
|
2009-03-23 15:42:01 +00:00
|
|
|
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
|