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