Added MoinMoin-1.9.2 build template.
[xbps.git] / xbps-src / triggers / x11-fonts
blob5219631f9edaa395bcc8a36c2d113683ececde8e
1 #!/bin/sh -e
3 # This trigger rebuilds the fonts.dir and fonts.scale files
4 # for packages that install X11 fonts, and update fontconfig's
5 # cache for those fonts.
7 # Arguments: $ACTION = [run/targets]
8 # $TARGET = [post-install/pre-remove]
9 # $PKGNAME
10 # $VERSION
11 # $UPDATE = [yes/no]
13 ACTION="$1"
14 TARGET="$2"
15 PKGNAME="$3"
16 VERSION="$4"
17 UPDATE="$5"
19 mkfontdir=usr/bin/mkfontdir
20 mkfontscale=usr/bin/mkfontscale
21 fccache=usr/bin/fc-cache
23 case "$ACTION" in
24 targets)
25 echo "post-install pre-remove"
27 run)
28 if [ ! -x ${mkfontdir} -a ! -x ${mkfontscale} ]; then
29 exit 0
32 [ -z "${font_dirs}" ] && exit 0
34 case "$TARGET" in
35 post-install)
36 for dir in ${font_dirs}; do
37 echo "Building ${dir}/fonts.dir..."
38 ${mkfontdir} .${dir} || exit $?
39 echo "Building ${dir}/fonts.scale..."
40 ${mkfontscale} .${dir} || exit $?
41 echo "Updating fontconfig's cache..."
42 ${fccache} .${dir} 2>/dev/null
43 done
45 pre-remove)
46 for dir in ${font_dirs}; do
47 if [ -f .${dir}/fonts.dir ]; then
48 rm -f .${dir}/fonts.dir
50 if [ -f .${dir}/fonts.scale ]; then
51 rm -f .${dir}/fonts.scale
53 if [ -f .${dir}/encodings.dir ]; then
54 rm -f .${dir}/encodings.dir
56 done
58 esac
62 exit 1
64 esac
66 exit 0