]> git.donarmstrong.com Git - debhelper.git/blob - dh_installxfonts
r294: * Fixed problem with dh_installemacsen options not working, patch from
[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
12         # Find all fint directories in the package build directory.
13         opendir DIR, "$TMP/usr/X11R6/lib/X11/fonts/" || next;
14         my @fontdirs = grep { -d $_ && !/^\./ } (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 }