Subversion Repositories camp_sysinfo_client_3

Rev

Rev 32 | Rev 244 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#!/usr/bin/env perl

use warnings;
use strict;  

our $VERSION = '1.0';

# find our location and use it for searching for libraries
BEGIN {
   use FindBin;
   use File::Spec;
   use lib File::Spec->catdir($FindBin::Bin);
}

use sysinfoconf;

sub readManifest {
   my $filename = shift;
   my %manifest;
   my $directory = 'none';
   open FILE,"<$filename" or die "Could not read $filename: $!\n";
   while ( $line = <FILE> ) {
      chomp $line;
      next if $line =~ m/^#/;
      if ( $line =~ m/\[(.*)\]/ ) {
         $directory = $1;
      } else {
         my ( $filename, $flags ) = split( "\t", $line );
         $manifest{$filename}{'directory'} = $directory;
         $manifest{$filename}{$flags} = $flags;
      }
   }
   close FILE;
   return \%manifest;
}

sub installFile {
   my $fileSpec = shift;
   

my $manifest = &readManifest( 'MANIFEST' );

foreach my $filename ( keys %$manifest ) {
   if ( &installFile( $$manifest{$filename} ) ) {
      $$manifest{$filename}{'status'} = 'moved';
   } else {
      $$mainfest{$filename}{'status'} = 'error';
      print &dumpStatus( $manifest );
      die;
   }
}
      
}