Added lots more modules from lintian. Maemian appears to work.
[maemian] / collection / override-file
1 #!/usr/bin/perl -w
2 # override-file -- maemian collector script
3
4 # Copyright (C) 1999 by Darren Benham
5 # Derived from debian-readme by Richard Braakman
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program.  If not, you can find it on the World Wide
19 # Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
20 # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
21 # MA 02110-1301, USA.
22
23 use strict;
24
25 use lib "$ENV{'MAEMIAN_ROOT'}/lib";
26 use Util;
27
28 ($#ARGV == 1) or fail("syntax: override-file <pkg> <type>");
29 my $pkg = shift;
30 my $type = shift;
31
32 -d "unpacked" or fail("override-file invoked in wrong directory");
33
34 unlink("override");
35
36 # Pick the first of these files that exists.
37 my $file;
38 if ($type eq 'source') {
39     $file = "unpacked/debian/source.maemian-overrides";
40 } else {
41     $file = "unpacked/usr/share/maemian/overrides/$pkg";
42 }
43
44 if ( ! -f $file ) 
45 {       if ( -f $file . ".gz" ) { $file = $file . ".gz"; }
46         else { $file = ''; }
47 }
48
49 if ( $file eq '' ) {
50     # no override found
51 } elsif ($file =~ /\.gz$/) {
52     gunzip_file($file, "override");
53 } else {
54     link($file, "override")
55         or fail("cannot link $file to override: $!");
56 }