]> git.donarmstrong.com Git - debhelper.git/blob - dh_installxfonts
r301: * dh_installxfonts: Patch from Anthony Wong to fix directory searching.
[debhelper.git] / dh_installxfonts
1 #!/usr/bin/perl -w
2 #
3 # Integration with the Debian X11 font policy.
4
5 BEGIN { push @INC, "debian", "/usr/share/debhelper" }
6 use Dh_Lib;
7 init();
8
9 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
10         $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 }