2 # copyright-file -- lintian collector script
4 # Copyright (C) 1998 Richard Braakman
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, you can find it on the World Wide
18 # Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
19 # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
24 ($#ARGV == 1) or fail("syntax: copyright-file <pkg> <type>");
28 -f "fields/package" or fail("copyright-file invoked in wrong directory");
32 my $file1 = "unpacked/usr/share/doc/$pkg/copyright";
33 my $file2 = "unpacked/usr/doc/$pkg/copyright";
36 if (-f $file1 ) { $file = $file1; }
37 else { $file = $file2; }
40 link($file, "copyright")
41 or fail("cannot link $file to copyright: $!");
42 } elsif (-f "$file.gz") {
43 use lib "$ENV{'LINTIAN_ROOT'}/lib";
46 pipeline((sub { exec 'gzip', '-dc', $file }), "copyright") == 0
47 or fail("error in gzip");
49 # no copyright file found
50 open(DUMMY, ">copyright");
56 # -----------------------------------
60 print STDERR "internal error: $_[0]\n";
62 print STDERR "internal error: $!\n";
64 print STDERR "internal error.\n";