Subversion Repositories camp_sysinfo_client_3

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
27 rodolico 1
#!/usr/bin/env perl
2
 
3
use warnings;
4
use strict;  
5
 
6
our $VERSION = '1.0';
7
 
8
# find our location and use it for searching for libraries
9
BEGIN {
10
   use FindBin;
11
   use File::Spec;
12
   use lib File::Spec->catdir($FindBin::Bin);
13
}
14
 
15
use sysinfoconf;
16
 
31 rodolico 17
sub readManifest {
18
   my $filename = shift;
19
   my %manifest;
20
   my $directory = 'none';
21
   open FILE,"<$filename" or die "Could not read $filename: $!\n";
22
   while ( $line = <FILE> ) {
23
      chomp $line;
24
      next if $line =~ m/^#/;
25
      if ( $line =~ m/\[(.*)\]/ ) {
26
         $directory = $1;
27
      } else {
28
         my ( $filename, $flags ) = split( "\t", $line );
29
         $manifest{$filename}{'directory'} = $directory;
30
         $manifest{$filename}{$flags} = $flags;
31
      }
32
   }
33
   close FILE;
34
   return \%manifest;
35
}
36
 
37
sub installFile {
38
   my $fileSpec = shift;
39
 
40
 
41
my $manifest = &readManifest( 'MANIFEST' );
42
 
43
foreach my $filename ( keys %$manifest ) {
44
   if ( &installFile( $$manifest{$filename} ) ) {
45
      $$manifest{$filename}{'status'} = 'moved';
46
   } else {
47
      $$mainfest{$filename}{'status'} = 'error';
48
      print &dumpStatus( $manifest );
49
      die;
50
   }
51
}
52
 
53
}