X-Git-Url: https://git.distorted.org.uk/~mdw/xfonts-traditional/blobdiff_plain/1f0fee99f0b4dad7de9ebc42521a8548adf7e4a6..489ffe219bed26ff9669f17750c08d4d9f867b60:/update-xfonts-traditional diff --git a/update-xfonts-traditional b/update-xfonts-traditional index 4b71d14..df71fce 100755 --- a/update-xfonts-traditional +++ b/update-xfonts-traditional @@ -148,7 +148,7 @@ sub processpcfgz ($$$$) { my ($usread,$uswrite); my ($reader,$writer); my @children; - foreach my $proc (['zcat'], ['pcf2bdf'], [], + foreach my $proc (['gunzip'], ['pcf2bdf'], [], ['bdftopcf'],['',qw(gzip -1)]) { my $isfinal = (@$proc && $proc->[0] eq ''); if (!$isfinal) { @@ -214,18 +214,20 @@ sub processfontdir ($) { 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) { @@ -245,6 +247,8 @@ sub processfontdir ($) { next; } die "$fontdir $dent" unless -f _; + $anypcfs++; + my $stats = join ' ', ((stat _)[1,7,9,10]); my $tdone = $olddone->{$dent}; my $outdent = $fontprefix.$dent; @@ -265,9 +269,9 @@ sub processfontdir ($) { or die "$fontdir $outdent $!"; $updated++; $outfiles{$outdent} |= 3; - $changed = 1; } $newdone->{$dent} = $stats; + $changed = 1; } my $affected=0; foreach my $olddent (keys %outfiles) { @@ -278,13 +282,18 @@ sub processfontdir ($) { } unlink "$fontdir/$olddent" or die "$fontdir $olddent $!"; $changed = 1; + $updated++; + } + if (!stat "$fontdir/fonts.dir") { + $!==&ENOENT or die "$fontdir $!"; + } else { + $!=0; $?=0; system 'mkfontdir',$fontdir; + die "$fontdir $? $!" if $? or $!; } - if (!%$newdone) { + if (!$anypcfs) { unlink "$fontdir/$logfile" or die "$fontdir $!"; unlink "$fontdir/$donefile" or $!==&ENOENT or die "$fontdir $!"; } elsif ($changed) { - $!=0; $?=0; system 'mkfontdir',$fontdir; - die "$fontdir $? $!" if $? or $!; my $newdoneh = new IO::File "$fontdir/$donefile.new", 'w' or die "$fontdir $!"; print $newdoneh Dumper($newdone) or die "$fontdir $!"; @@ -366,6 +375,14 @@ define_mode('process-fonttrees', sub { } }); +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;