]> git.donarmstrong.com Git - debhelper.git/blob - dh_installxfonts
r338: * Patch from Jorgen `forcer' Schaefer <forcer at mindless.com> (much
[debhelper.git] / dh_installxfonts
1 #!/usr/bin/perl -w
2 #
3 # Integration with the Debian X11 font policy.
4
5 use Debian::Debhelper::Dh_Lib;
6 init();
7
8 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
9         $TMP=tmpdir($PACKAGE);
10         my $XFONTDIR="$TMP/usr/X11R6/lib/X11/fonts/";
11
12         # Find all fint directories in the package build directory.
13         opendir DIR, $XFONTDIR || next;
14         my @fontdirs = grep { -d "$XFONTDIR/$_" && !/^\./ } (readdir DIR);
15         closedir DIR;
16
17         if (@fontdirs) {
18                 # Figure out what commands the postinst will need to call.
19                 my @updatecmds=('/usr/bin/X11/mkfontdir');
20                 foreach my $f (@fontdirs) {
21                         push @updatecmds, '/usr/sbin/update-fonts-alias'
22                                 if -f "$TMP/etc/X11/fonts/$f/$PACKAGE.alias";
23                         # This must come _before_ mkfontdir, thus the unshift.
24                         unshift @updatecmds, '/usr/sbin/update-fonts-scale'
25                                 if -f "$TMP/etc/X11/fonts/$f/$PACKAGE.scale";
26                 }
27
28                 autoscript($PACKAGE, "postinst", "postinst-xfonts",
29                         "s:#FONTDIRS#:".join(' ', @fontdirs).
30                         ":;s:#UPDATECMDS#:".join(' ', @updatecmds).":");
31                 autoscript($PACKAGE, "postrm", "postrm-xfonts",
32                         "s:#FONTDIRS#:".join(' ', @fontdirs).
33                         ":;s:#UPDATECMDS#:".join(' ', @updatecmds).":");
34         }
35 }