/[soft]/ldetect-lst/trunk/update-ldetect-lst
ViewVC logotype

Contents of /ldetect-lst/trunk/update-ldetect-lst

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1357 - (show annotations) (download)
Tue May 17 09:21:22 2011 UTC (12 years, 10 months ago) by dmorgan
File size: 569 byte(s)
Import  ldetect
1 #!/usr/bin/perl
2
3 my $dir = '/usr/share/ldetect-lst';
4 my @files = qw(pcitable usbtable isatable pcmciatable dmitable);
5
6 unlink("$dir/$_", "$dir/$_.gz") foreach @files;
7
8 $ARGV[0] eq '--clean' and exit 0;
9
10 foreach (@files) {
11 my $d = "$dir/$_.d";
12 -d $d or next;
13 my @l = sort(glob("$d/*.lst"), glob("$d/*.lst.gz")) or next;
14
15 if (@l == 1 && $l[0] =~ /gz$/) {
16 link $l[0], "$dir/$_.gz";
17 } else {
18 open(my $OUT, "| gzip -9 > $dir/$_.gz");
19 foreach (@l) {
20 open(my $IN, /gz$/ ? "gzip -dc $_ |" : $_) or next;
21 print $OUT $_ foreach <$IN>;
22 }
23 }
24 }

  ViewVC Help
Powered by ViewVC 1.1.30