This file is indexed.

/usr/bin/dh_installtex is in tex-common 2.10.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
#!/usr/bin/perl -w
# dh_installtex --- register Type 1 fonts, languages, or formats with TeX
# Copyright (C) 2006, 2007 Florent Rougon
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Norbert Preining
# Copyright (C) 2006, 2007 Frank Küster
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 dated June, 1991.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING. If not, write to the
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA  02110-1301 USA.
#

=head1 NAME

dh_installtex - register Type 1 fonts, hyphenation patterns, or formats with TeX

=cut

use strict;
use Debian::Debhelper::Dh_Lib;

=head1 SYNOPSIS

B<dh_installtex>
[S<I<debhelper options>>]
[B<-n>]
[B<--priority=>I<n>]
[B<--flavor=>I<flavor>[,I<flavor>]]
[B<map=MixedMap,>I<file.map>]
[B<map=Map,>I<file.map>]
[B<mapfile=>I<file.cfg>[=I<n>]]
[B<hyphen=>I<lang>,I<file>[,lhm=I<n>][,rhm=I<n>][,synonym=I<syn>,...]]
[B<hyphenfile=>I<file.cnf>[=I<n>]]
[B<format=>I<format>,I<engine>,I<hyphenfile>,I<rest args>]
[B<formatfile=>I<file.cnf>[=I<n>]]

=head1 DESCRIPTION

dh_installtex is a debhelper program that is responsible for
updating the ls-R databases, registering map files, new formats, 
and new hyphenation patterns with TeX.

Your package should depend on an appropriate version of tex-common so
that the update-* commands are available. (This program adds that
dependency to ${misc:Depends}.)

B<WARNING> This program does B<not> check for the actual existence of any 
input files in TEXMF trees. If you call it without any further specification
on which packages to work on (using C<-p> or C<-N>) it will add calls to
management functions to B<all> packages. In this case don't forget to 
add ${misc:Depends} to all packages' dependencies.

=head1 SIMPLE USAGE: Registering Files 

If you only install files into /usr/share/texmf and want to be sure that 
mktexlsr is called in a correct way (e.g., also
in the postrm script when there is no functional mktexlsr), simply call

	dh_installtex

=head1 COMPLEX USAGE: Registering fonts, hyphenation patterns and formats

If in addition, you have to install map files, hyphenation patterns for
additional languages, or format definitions you can use three
different methods to specify what should be installed:

1) B<Pre made config files:> These files can be specified with the
different I<type>file= options, together with an optional priority.
I<type> can be one of map, format and hyphen, and these files will be
installed into /etc/texmf/I<configdir>/ for the respective type (updmap.d for
map files, hyphen.d for hyphenation pattern files, and fmt.d for format files).

Example:

        dh_installtex mapfile=foo.cfg formatfile=debian/bar.cnf=42

would install foo.cfg as /etc/texmf/updmap.d/20foo.cfg, and debian/bar.cnf
as /etc/texmf/fmt.d/42bar.cnf.


2) B<Directly on the cmd line:>
You can specify maps, formats, and hyphenations on the cmd line. The items
are stored in the respective config file 20package

Example:

        dh_installtex map=Map,foo.map hyphen=french,loadhyph-fr.tex,lhm=2,rhm=3,synonym=patois,synonym=francais

would install a file /etc/texmf/updmap.d/20package.cfg containing the line

        Map foo.map

and a file /etc/texmf/hyphen.d/20package.cnf containing the lines

	name=french file=loadhyphen-fr.tex lefthyphenmin=2 righthyphenmin=3 synonyms=patois,francais

3) B<Package files:>
You create a file debian/package.maps or debian/maps,
debian/package.hyphens or debian/hyphens, 
debian/package.formats or debian/formats. These files are
installed with default priority and the name of the package. Each of these
files will be installed into the first package dh_installtex
is told to act on. By default this is the first binary package in
debian/control, but if you use -p, -i, or -a flags, it will be the first
package specified by those flags.

Example:

        dh_installtex

would install a present debian/package.maps file as
/etc/texmf/updmap.d/20package.cfg.


=head2 Mixing the different variants

The command line items (Variant 2) are merged into the debian/package.maps 
(debian/package.hyphens, debian/package.formats)
file and the merged file is installed as 20package.cfg/cnf. If you specify
an additional package.cfg/cnf (Variant 1) without a different priority than
the default one on the cmd line, this will raise an error since both files
would be installed as 20package.cfg/cnf. You can only specify 
package.cfg/cnf without
a different priority than the default one if no debian/package.maps nor
any command line Map files are present.

=head2 The pseudo-comment

If the provided cfg files do not contain the pseudo-comment as described
in the Debian TeX Policy, Font configuration, an additional header with
explanation, warning and the pseudo-comment is added.

This program automatically generates the postinst and postrm commands needed
to register the fonts with TeX.  See L<dh_installdeb(1)> for an explanation
of how this works.

=head1 OPTIONS

=over 4

=item B<-n>, B<--noscripts>

Do not modify postinst/prerm scripts.

=item B<--priority=>I<n>

Set the default priority to I<n> instead of 20.

=item B<--flavor=>I<flavor>[,I<flavor>]

This option will be used to switch additional options on. The argument
specify a list from flavors to be selected.
At the moment you can select from the following list of flavors:
B<map:config_for_active_maps>, B<map:config_for_all_maps>, 
B<format:build_all>, B<format:add_one:I<formatname>>, and
B<lsr:full>.

B<map:config_for_active_maps> will create a file I<config.bar> for each active
(i.e. uncommented) map in each of the cfg file generated by one of the
three methods described above. These files are installed in
/usr/share/texmf/dvips/config/.

If you select B<map:config_for_all_maps> the script will generate I<config.bar>
even for those map files which are present in a cfg file, but deactivated by a comment.

The file I<config.bar> is used when called by `dvips -Pbar ...'. Thus it
allows the activation of single map files even if they are not automatically
activated via the updmap(-sys) mechanism.

Default is I<not> to generate any config files.

B<format:build_all> will add code to the postinst script to create all
defined formats, and to the postrm script to clean and recreate? FIXME?
the generated formats.

B<format:add_one:I<formatname>> allows to add the generation of a specific
format without actually providing it (in a cnf file).  This is useful if a 
package adds hyphenation patterns to an existing formats.

B<format:no_links>:
Usually, for every format that is specified in a configuration file in
/etc/texmf/fmt.d/, dh_installtex will create a symlink
/usr/bin/I<format> that points to the corresponding engine.  For
example, /usr/bin/latex would be created as a symlink to pdftex.  

The flavor B<format:no_links> inhibits this. If a link already
exists, dh_installtex will skip this format with an informational
message, even if this option is not given.

B<lsr:full>: Recreate the lsr database not only for the standard trees,
but also the distribution tree C</usr/share/texmf-texlive>.

=back

=head1 NOTES

Note that this command is not idempotent. "dh_clean -k" should be called
between invocations of this command, unless using the B<-n> option.
Otherwise, it may cause multiple instances of the same text to be added
to maintainer scripts.

Please refer to the Debian TeX policy for details about fonts configuration
for TeX by Debian packages.


=cut

init(options => { "flavor=s" => \$dh{FLAVOR} });




#
# GLOBAL VARIABLES
#
my $flavor;		
my $mapdoconfig =  0;	  # doconfig depending map/subflavor
my $doallformats = 0;	  # depending on flavor format:build_all
my $dofulllsr = 0;        # do include texmf-texlive in lsr making
my @addbuildformats = (); # additional formats to be build
my $priority=20;	# priority with which files are installed
my $doformatlinks = 1;
my %cmdlineargs;
my %cmdlinefiles;
my %cmdlinefilespriority;
my @cmdlinetexmftrees;

#
# definitions for the different flavors
#
# extension of package files debian/$package.formats and/or debian/formats etc
my %pkgfileext = ( 
	hyphen 		=> "hyphens", 
	format 		=> "formats", 
	map 		=> "maps" );
# extension of the config files
my %configfileext = ( 
	hyphen	 	=> "cnf", 
	format 		=> "cnf", 
	map 		=> "cfg" );
# comment char for magic header
my %commentchar = ( 
	hyphen	 	=> '%', 
	format 		=> '#', 
	map 		=> '#' );
# directory under /etc/texmf/ where files are installed
my %configdir = ( 
	hyphen	 	=> "hyphen.d", 
	format 		=> "fmt.d", 
	map 		=> "updmap.d" );
# directory under /var/lib/tex-common where list files are installed
my %managedir = ( 
	hyphen	 	=> "hyphen-cnf", 
	format 		=> "fmtutil-cnf", 
	map 		=> "fontmap-cfg" );
#
# dummy loop variables
my $i;
my $bn;
my $pr;
my $dofilen;

# the magic header without comment chars
my @magicheader = ( "You can change/add entries to this file and changes will be preserved", 
"over upgrades, even if you have removed the main package prior",
"(not if you purged it). You should leave the following pseudo comment",
"present in the file!",
"-_- DebPkgProvidedMaps -_-", "");

#
# collect data
# This function is used to extract certain information from the respective
# config files. Up to now we have to do the following:
# for config file for maps
# 	if we select to generate all dvips config files
# 	(with map:config_for_active_maps or map:config_for_all_maps)
# 	we collect the map files
# for config file for formats
# 	we extract format\tengine for
# 		- generation with fmtutil-sys --byfmt
# 		- creation of links /usr/bin/format -> /usr/bin/engine
sub collect_data {
	my ($type,$dataref,$entry) = @_;
	my $m;

	if ($type eq "map") {
		if ($m = extract_map($entry, $mapdoconfig)) { push @$dataref, $m; }
	} elsif ($type eq "format") {
		if ($m = extract_format($entry)) { push @$dataref, $m; }
	} 
	# TODO should we do something with hypehn here!????
}

sub extract_format {
	my ($line) = @_;
	if ($line =~ m/^([^#\s]\S+)\s*(\S*)\s+/) {
		return "$1\t$2";
	}
}

sub extract_map {
	my ($line,$mapdoconfig) = @_;
	if ($mapdoconfig == 0) { return ""; }
	if ($line =~ m/^[[:space:]]*([#[:space:]]*)[[:space:]]*(Mixed)?Map[[:space:]]*(.*\.map)[[:space:]]*(#.*)?$/) {
		my $comment = $1;
		my $map = $3;
		if (($comment eq "") || ($mapdoconfig == 2)) {
			return $map;
		}
	}
	return "";
}

#
# build_line
# used to create a correct config file entry from a cmd-line specification
sub build_line {
	my ($type,$line) = @_;
	if ($type eq "map") {
		if ($line =~ m/^(Map|MixedMap),(.*)$/) {
			return("$1 $2");
		} else {
			error("$line is neither of the form Map filename.map, nor MixedMap filename.map.");
		}
	} elsif ($type eq "format") {
		my ($format,$engine,$pat,@rest) = split(",",$line);
		my $ret = "$format\t$engine\t$pat\t" . join(",",@rest);
		return($ret);
	} elsif ($type eq "hyphen") {
		my ($lang,$pat,@rest) = split(",",$line);
		my $ret="name=$lang file=$pat";
		my @synonyms = ();
		my $lhm;
		my $rhm;
		foreach (@rest) {
			my ($a,$b) = split("=", $_, 2);
			if ($a eq "lhm") {
				$lhm = $b;
			} elsif ($a eq "rhm") {
				$rhm = $b;
			} elsif ($a eq "synonym") {
				push @synonyms, $b;
			} else {
				error("$line is not well formed.");
			}
		}
		$ret .= " lefthyphenmin=$lhm" if defined($lhm);
		$ret .= " righthyphenmin=$rhm" if defined($rhm);
		if ($#synonyms >= 0) {
			$ret .= " synonyms=" . join(",",@synonyms);
		}
		$ret .= "\n";
		return($ret);
	}
}

#
# check wether a magic comment is already present
sub magic_comment_present {
	my ($fname) = @_;
	my @args = ( "grep", "-q", "^[#%] -_- DebPkgProvidedMaps -_-", $fname );
	if (system(@args) == 0) { return 1; }
	return 0;
}

#
#
# START OF THE MAIN PROGRAM
#
#

if (defined($dh{PRIORITY}) && $dh{PRIORITY} ne '') {
	$priority=$dh{PRIORITY};
}

#
# parse the cmd line and fill in the various hashes
#
foreach (@ARGV) {
	if ((m/^(map)file=(.*\.cfg)(=([[:digit:]]+))?$/) ||
	    (m/^(hyphen)file=(.*\.cnf)(=([[:digit:]]+))?$/) ||
	    (m/^(format)file=(.*\.cnf)(=([[:digit:]]+))?$/)) {
		my $type=$1;
		my $fn=$2;
		my $pr=$priority;
		if (defined($4)) {
			$pr=$4;
		}
		$cmdlinefilespriority{$type}{$fn}=$pr;
	} elsif (m/^(map|hyphen|format)=(.*)$/) {
		push @{$cmdlineargs{$1}}, $2;
	} else {
		error("Unrecognized argument: $_\n");
	}
}

#
#
if (defined($dh{FLAVOR})) {
	foreach my $fl (split (/,/,$dh{FLAVOR})) {
		if ($fl eq "map:config_for_active_maps") {
			$mapdoconfig = 1;
		} elsif ($fl eq "map:config_for_all_maps") {
			$mapdoconfig = 2;
		} elsif ($fl eq "format:build_all") {
			$doallformats = 1;
		} elsif ($fl =~ /^format:add_one:(.*)$/) {
			push @addbuildformats , $1;
		} elsif ($fl eq "format:no_links") {
			$doformatlinks = 0;
		} elsif ($fl eq "lsr:full") {
			$dofulllsr = 1;
		} else {
			error("Specified flavor $fl not supported.\nPlease see man page for supported flavors!\n");
		}
	}
}



foreach my $package (@{$dh{DOPACKAGES}}) {
	# these variables should be local to the loop over packages
	# as they vary with package
	my $tmp=tmpdir($package);
	my %pkgprovidedfilecontents;
	my %data;
	my @whattodo = ();
	my @fmtconffiles;

	if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
		# we do nothing here
	} else {
		# we have to clear all the cmd line arguments!
		%cmdlinefilespriority = ();
		%cmdlineargs = ();
	}

	foreach my $type ("map", "hyphen", "format") {
		my @cmdlineconfigfiles = ();
		my @cmdlinearguments = ();
		my $pkgprovidedfile = 0;
		my $pkgfileoncmdline = 0;
		my @listlines;
		my $pkgfilename = pkgfile($package,$pkgfileext{$type});
		if ($pkgfilename) {
			open(FOO, "<$pkgfilename") || error("$pkgfilename cannot be opened.");
			my @bar = <FOO>;
			close(FOO);
			$pkgprovidedfilecontents{$type} = \@bar;
			$pkgprovidedfile = 1;
		}
		if (defined($cmdlinefilespriority{$type})) {
			my %priorityhash = %{$cmdlinefilespriority{$type}};
			@cmdlineconfigfiles = keys(%priorityhash);
		}
		if (defined($cmdlineargs{$type})) {
			@cmdlinearguments = @{$cmdlineargs{$type}};
		}
		foreach my $foo (@cmdlineconfigfiles) {
			my $bn=basename($foo);
			if ($bn eq "$package.$configfileext{$type}" && $cmdlinefilespriority{$type}{$foo} == $priority) {
				$pkgfileoncmdline = 1;
			}
		}
		if (!$pkgprovidedfile && ($#cmdlineconfigfiles < 0) && ($#cmdlinearguments < 0)) {
			# we have nothing to do here, skip to the next one!
			next;
		}
		# we got something, either a cmd line are for one of the
		# config files, or a package (e.g., debian/pkg.maps) file 
		# do the full maintainer stuff!
		push @whattodo, $type;
		if ($pkgfileoncmdline && ($pkgprovidedfile || ($#cmdlinearguments >= 0))) {
			error("This call would create multiple copies of $priority$package.$configfileext{$_}.\nPlease read the man page on how this should be fixed!\n");
		}

		if ( ! $dh{ONLYSCRIPTS} && ! -d "$tmp/etc/texmf/$configdir{$type}/") {
			doit("install","-d","$tmp/etc/texmf/$configdir{$type}/");
		};
		#
		# the cmd line cfg files
		#
		foreach (@cmdlineconfigfiles) {
			$bn=basename($_);
			$pr=$cmdlinefilespriority{$type}{$_};
			$dofilen = "$tmp/etc/texmf/$configdir{$type}/$pr$bn";
			WRITECMDLINECFGFILE: do {
				-r $dofilen &&
					error("The config file $dofilen already exists! Cannot recreate it, please call dh_clean -k!");
				open(CFGFILE, ">$dofilen") ||
					error("Cannot open $dofilen for writing!");
				verbose_print("Writing $dofilen");
				if (!magic_comment_present($_)) {
					print CFGFILE "$commentchar{$type} $pr$bn\n";
					foreach $i (@magicheader) {
						print CFGFILE "$commentchar{$type} $i\n";
					}
				}
				open(FOO,"<$_") || error("Cannot open $_ for reading!");
				while (<FOO>) { 
					print CFGFILE $_; 
					collect_data($type,\@{$data{$type}},$_);
				}
				close(FOO);
				close(CFGFILE);
				$bn =~ s/\.$configfileext{$type}$//;
				push @listlines, "$pr$bn";
			} unless ($dh{ONLYSCRIPTS});
		}
		#
		# now debian/package.maps and/or debian/maps formats languages
		# merge in the cmd line arguments
		#
		if ( ! $dh{ONLYSCRIPTS} && ( $pkgprovidedfile || ($#cmdlinearguments >= 0) )) {
			$dofilen = "$tmp/etc/texmf/$configdir{$type}/$priority$package.$configfileext{$type}";
			-r $dofilen && 
				error("The config file $dofilen already exists! Cannot recreate it, please call dh_clean -k!");
			open(CFGFILE, ">$dofilen") || 
				error("Cannot open $dofilen for writing!");
			verbose_print("Writing $dofilen");
			if (($pkgprovidedfile && !magic_comment_present($pkgfilename)) ||
				(!$pkgprovidedfile && ($#cmdlinearguments >= 0))) {
				print CFGFILE "$commentchar{$type} $priority$package.$configfileext{$type}\n";
				foreach (@magicheader) {
					print CFGFILE "$commentchar{$type} $_\n";
				}
			}
			foreach (@{$pkgprovidedfilecontents{$type}}) {
				print CFGFILE "$_";
				collect_data($type,\@{$data{$type}},$_);
			}
			foreach (@cmdlinearguments) {
				my $foo =  build_line($type,$_);
				print CFGFILE $foo,"\n";
				collect_data($type,\@{$data{$type}},$foo);
			}
			close(CFGFILE);
			push @listlines, "$priority$package";
		};

		WRITELISTFILE: do {
			if ( ! -d "$tmp/var/lib/tex-common/$managedir{$type}/") {
				doit("install","-d","$tmp/var/lib/tex-common/$managedir{$type}/");
			}		
			$dofilen = "$tmp/var/lib/tex-common/$managedir{$type}/$package.list";
			open(LISTFILE, ">>$dofilen") ||
				error("Cannot open $dofilen for writing/appending!");
			verbose_print("Writing $dofilen");
			foreach (@listlines) {
				print LISTFILE "$_\n";
			}
			if ($type eq "format") {
				@fmtconffiles = @listlines;
			}
			close(LISTFILE);
		}  unless ($dh{ONLYSCRIPTS});
	}
	
	my @mapdata = ();
	if (defined($data{"map"})) {
		@mapdata = @{$data{"map"}};
	}
	if ( ! $dh{ONLYSCRIPTS} && ($#mapdata >= 0) ) {
		doit("install","-d","$tmp/usr/share/texmf/dvips/config/");
	};
	INSTALLDVIPSCONF: do {
		foreach $i (@mapdata) {
			my $font = $i;
			$font =~ s/\.map$//;
			$dofilen = "$tmp/usr/share/texmf/dvips/config/config.$font";
			-r $dofilen &&
				error("The dvips config file $dofilen already exists!\nYou may have to call dh_clean -k!\n");
			open(CNFFILE, ">$dofilen") ||
				error("Cannot open $dofilen for writing!");
			verbose_print("Writing $dofilen");
			print CNFFILE "p +$i\n";
			close(CNFFILE);
		} 
	} unless ($dh{ONLYSCRIPTS});

	my @fmtpairs = ();
	my @fmtdata = ();
	my @postrmfmtdata = ();
	if (defined($data{"format"})) {
		@fmtpairs = @{$data{"format"}};
	}
 	installformatlink: do {
		foreach my $pair (@fmtpairs) {
			my ($format,$engine) = $pair =~ m/^(.*)\t(.*)$/;
			if ($engine =~ m/^(mf|mf-nowin)$/) {
				push @postrmfmtdata, "metafont/$format";
			} elsif ($engine eq "mpost") {
				push @postrmfmtdata, "metapost/$format";
			} else {
				push @postrmfmtdata, "$engine/$format";
			}
			push @postrmfmtdata, "$format";
			push @fmtdata, "$format";
			if ($doformatlinks && ($format ne $engine)) {
				my $formatlink = "$tmp/usr/bin/$format";
				if ( -e $formatlink ) {
					warning("/usr/bin/$format already exists, skipping");
				} else {
					doit("mkdir","-p","$tmp/usr/bin");
					doit("ln","-s","$engine","$formatlink");
		  		};
			}
		} 
	} unless ($dh{ONLYSCRIPTS});

	if ($#addbuildformats >= 0) {
		push @fmtdata, @addbuildformats;
		push @postrmfmtdata, @addbuildformats;
	}
	if ($doallformats == 1) {
		# in case we have allformats to do we ignore
		# 	language and format
		my @newwhat = ();
		push @newwhat, "allformats";
		foreach my $t (@whattodo) {
			if ($t eq "map") {
				push @newwhat, $t;
			}
		}
		@whattodo = @newwhat;
		# also include the full code
	}
	if (! $dh{NOSCRIPTS}) {
		push @whattodo, ($dofulllsr ? "lsrfull" : "lsr");
		autoscript($package, "postinst", "postinst-tex", "s|#FORMATSFILES#|@fmtconffiles|; s|#WHATTODO#|@whattodo|");
		# map entries have already been filtered out
		autoscript($package, "postrm",   "postrm-tex", "s|#FORMATS#|@postrmfmtdata|; s|#WHATTODO#|@whattodo|");
	}

	# for trigger support
	addsubstvar($package, "misc:Depends", "dpkg", ">= 1.14.18");
	addsubstvar($package, "misc:Depends", "tex-common", ">= 2.00");
}

=head1 SEE ALSO

L<debhelper(7)>

=head1 AUTHOR

This program and its documentation was written by
Norbert Preining <F<preining@logic.at>> for the Debian Operating System
and both are licensed under the GNU General Public License Version 2 or later.

=cut

### Local Variables:
### perl-indent-level: 4
### tab-width: 4
### indent-tabs-mode: t
### End:
# vim:set tabstop=4 fileencoding=utf-8: #