die "$fontdir $!" unless $!==&ENOENT;
return;
}
+ my $changed = 0;
my $olddone = do "$fontdir/$donefile";
if (!$olddone) {
die "$fontdir $! $@ " unless $!==&ENOENT;
$olddone = { };
+ $changed = 1;
}
my $newdone = { };
my $log = new IO::File "$fontdir/$logfile", "w"
or die "$fontdir/$logfile $!";
my %outfiles; # bitmask: 1 /*exists*/ | 2 /*wanted*/
- my $changed;
my $updated=0;
my $reported=0;
+ my $anypcfs=0;
flush $reportfh or die $!;
while (my $dent = scalar readdir FD) {
next;
}
die "$fontdir $dent" unless -f _;
+ $anypcfs++;
+
my $stats = join ' ', ((stat _)[1,7,9,10]);
my $tdone = $olddone->{$dent};
my $outdent = $fontprefix.$dent;
or die "$fontdir $outdent $!";
$updated++;
$outfiles{$outdent} |= 3;
- $changed = 1;
}
$newdone->{$dent} = $stats;
+ $changed = 1;
}
my $affected=0;
foreach my $olddent (keys %outfiles) {
unlink "$fontdir/$olddent" or die "$fontdir $olddent $!";
$changed = 1;
}
- if (!%$newdone) {
+ if (!$anypcfs) {
unlink "$fontdir/$logfile" or die "$fontdir $!";
unlink "$fontdir/$donefile" or $!==&ENOENT or die "$fontdir $!";
} elsif ($changed) {
}
});
+define_mode('update', sub {
+ die "no arguments allowed with --postinst\n" unless !@ARGV;
+ loadfoundries();
+ foreach my $d (@fonttrees) {
+ processfonttree($d);
+ }
+});
+
Getopt::Long::Configure(qw(bundling));
GetOptions(@options) or exit 127;