mirror of
https://github.com/xHyroM/void-packages.git
synced 2024-12-23 20:51:05 +01:00
58 lines
951 B
Text
58 lines
951 B
Text
|
#!/bin/sh
|
||
|
#
|
||
|
# 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 post-remove"
|
||
|
;;
|
||
|
run)
|
||
|
if [ ! -x $mkfontdir ]; then
|
||
|
exit 0
|
||
|
fi
|
||
|
|
||
|
if [ ! -x $mkfontscale ]; then
|
||
|
exit 0
|
||
|
fi
|
||
|
|
||
|
[ -z "${font_dirs}" ] && exit 0
|
||
|
|
||
|
case "$TARGET" in
|
||
|
post-install|post-remove)
|
||
|
for dir in ${font_dirs}; do
|
||
|
echo "Building ${dir}/fonts.dir..."
|
||
|
${mkfontdir} .${dir}
|
||
|
echo "Building ${dir}/fonts.scale..."
|
||
|
${mkfontscale} .${dir}
|
||
|
echo "Updating fontconfig's cache..."
|
||
|
${fccache} -f .${dir}
|
||
|
done
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
;;
|
||
|
*)
|
||
|
exit 1
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
exit 0
|