diff --git a/xorg-mkfontdir/PKGBUILD b/xorg-mkfontdir/PKGBUILD index 0901aef7e..d6a03efc6 100644 --- a/xorg-mkfontdir/PKGBUILD +++ b/xorg-mkfontdir/PKGBUILD @@ -3,7 +3,7 @@ pkgname=xorg-mkfontdir pkgver=1.0.7 -pkgrel=1 +pkgrel=2 pkgdesc="Create an index of X font files in a directory" arch=(any) url="http://xorg.freedesktop.org/" @@ -11,7 +11,10 @@ license=('custom') depends=('sh' 'xorg-mkfontscale') makedepends=('xorg-util-macros') groups=('xorg' 'xorg-apps') -source=(http://xorg.freedesktop.org/archive/individual/app/mkfontdir-${pkgver}.tar.bz2) +install=xorg-mkfontdir.install +source=(http://xorg.freedesktop.org/archive/individual/app/mkfontdir-${pkgver}.tar.bz2 + xorg-mkfontdir.hook + xorg-mkfontdir.script) sha1sums=('3c06dad8a5fbf7362b51fb7d6b1ab805eba40336') build() { @@ -25,4 +28,8 @@ package() { make DESTDIR="${pkgdir}" install install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}" install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/" + + # pacman hook + install -Dm644 ../xorg-mkfontdir.hook "${pkgdir}/usr/share/libalpm/hooks/xorg-mkfontdir.hook" + install -D ../xorg-mkfontdir.script "${pkgdir}/usr/share/libalpm/scripts/xorg-mkfontdir" } diff --git a/xorg-mkfontdir/xorg-mkfontdir.hook b/xorg-mkfontdir/xorg-mkfontdir.hook new file mode 100644 index 000000000..c131a84da --- /dev/null +++ b/xorg-mkfontdir/xorg-mkfontdir.hook @@ -0,0 +1,13 @@ +[Trigger] +Type = File +Operation = Install +Operation = Upgrade +Operation = Remove +Target = usr/share/fonts/*/ +Target = !usr/share/fonts/encodings/* + +[Action] +Description = Updating X fontdir indices... +When = PostTransaction +Exec = /usr/share/libalpm/scripts/xorg-mkfontdir +NeedsTargets diff --git a/xorg-mkfontdir/xorg-mkfontdir.install b/xorg-mkfontdir/xorg-mkfontdir.install new file mode 100644 index 000000000..2a2b31fa6 --- /dev/null +++ b/xorg-mkfontdir/xorg-mkfontdir.install @@ -0,0 +1,8 @@ +post_install() { + if [[ -d /usr/share/fonts ]]; then + echo -n "Creating X fontdir indices..." + find /usr/share/fonts -mindepth 1 -path /usr/share/fonts/encodings -prune \ + -o -type d -printf '%p/\n' | /usr/share/libalpm/scripts/xorg-mkfontdir + echo " done." + fi +} diff --git a/xorg-mkfontdir/xorg-mkfontdir.script b/xorg-mkfontdir/xorg-mkfontdir.script new file mode 100644 index 000000000..cca3afc08 --- /dev/null +++ b/xorg-mkfontdir/xorg-mkfontdir.script @@ -0,0 +1,9 @@ +#!/bin/bash + +sort -r | while read -r d; do + [[ -d $d ]] || continue + mkfontscale "$d" + mkfontdir "$d" + find "$d"fonts.{scale,dir} -maxdepth 0 -size -3c -delete + rmdir --ignore-fail-on-non-empty "$d" +done