]> git.donarmstrong.com Git - debhelper.git/blob - dh_installxfonts
r491: * dh_installxfonts: Do not specify /usr/sbin/ paths; that should be in
[debhelper.git] / dh_installxfonts
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_installxfonts - register X fonts
6
7 =cut
8
9 use strict;
10 use Debian::Debhelper::Dh_Lib;
11
12 =head1 SYNOPSIS
13
14   dh_installxfonts [debhelper options]
15
16 =head1 DESCRIPTION
17
18 dh_installxfonts is a debhelper program that is responsible for
19 registering X fonts, so their corresponding fonts.dir, fonts.alias,
20 and fonts.scale be rebuilt properly at install time.
21
22 Before calling this program, you should have installed any X fonts
23 provided by your package into the appropriate location in the package build
24 directory. Also, your package should depend on xbase-clients (>=
25 3.3.3.1-5).
26
27 It automatically generates the postinst and postrm commands needed to
28 register X fonts.  See L<dh_installdeb(1)> for an explanation of how this
29 works.
30
31 =head1 NOTES
32
33 See L<update-fonts-alias(8)>, L<update-fonts-scale(8)>, and L<mkfontdir(1x)>
34 for more information about X font installation.
35
36 =cut
37
38 init();
39
40 foreach my $package (@{$dh{DOPACKAGES}}) {
41         my $tmp=tmpdir($package);
42         my $XFONTDIR="$tmp/usr/X11R6/lib/X11/fonts/";
43
44         # Find all fint directories in the package build directory.
45         opendir DIR, $XFONTDIR || next;
46         my @fontdirs = grep { -d "$XFONTDIR/$_" && !/^\./ } (readdir DIR);
47         closedir DIR;
48
49         if (@fontdirs) {
50                 # Figure out what commands the postinst will need to call.
51                 my @updatecmds=('makefontdir');
52                 foreach my $f (@fontdirs) {
53                         push @updatecmds, 'update-fonts-alias'
54                                 if -f "$tmp/etc/X11/fonts/$f/$package.alias";
55                         # This must come _before_ mkfontdir, thus the unshift.
56                         unshift @updatecmds, 'update-fonts-scale'
57                                 if -f "$tmp/etc/X11/fonts/$f/$package.scale";
58                 }
59
60                 autoscript($package, "postinst", "postinst-xfonts",
61                         "s:#FONTDIRS#:".join(' ', @fontdirs).
62                         ":;s:#UPDATECMDS#:".join(' ', @updatecmds).":");
63                 autoscript($package, "postrm", "postrm-xfonts",
64                         "s:#FONTDIRS#:".join(' ', @fontdirs).
65                         ":;s:#UPDATECMDS#:".join(' ', @updatecmds).":");
66         }
67 }
68
69 =head1 SEE ALSO
70
71 L<debhelper(1)>
72
73 This program is a part of debhelper.
74
75 =head1 AUTHOR
76
77 Joey Hess <joeyh@debian.org>
78
79 =cut