Subversion Repositories camp_sysinfo_client_3

Rev

Rev 18 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18 Rev 20
Line 1... Line 1...
1
#!/usr/bin/env perl
1
#!/usr/bin/env perl
2
 
2
 
3
use warnings;
3
use warnings;
4
 
4
 
-
 
5
$main::VERSION = '1.0';
-
 
6
 
5
my $seedFile = 'sysinfo-client.seed';
7
my $seedFile = 'sysinfo-client.seed';
6
my $sysinfo2 = '/etc/sysinfo/sysinfo.conf';
8
my $sysinfo2 = '/etc/sysinfo/sysinfo.conf';
7
my $sysinfo3 = '/etc/camp/sysinfo-client/sysinfo-client.conf';
9
my $sysinfo3 = '/etc/camp/sysinfo-client/sysinfo-client.conf';
8
my $configPath = '/etc/camp/sysinfo-client';
10
my $configPath = '/etc/camp/sysinfo-client';
9
my $configFile = 'sysinfo-client.conf';
11
my $configFile = 'sysinfo-client.conf';
Line 65... Line 67...
65
   foreach my $priority ( sort { $a <=> $b } keys %$transports ) {
67
   foreach my $priority ( sort { $a <=> $b } keys %$transports ) {
66
      my $name = $$transports{ $priority }{'-name-'};
68
      my $name = $$transports{ $priority }{'-name-'};
67
      $config .= "# Tranport $name at priority $priority\n";
69
      $config .= "# Tranport $name at priority $priority\n";
68
      my $thisOne = $$transports{ $priority };
70
      my $thisOne = $$transports{ $priority };
69
      foreach my $key ( sort keys %$thisOne ) {
71
      foreach my $key ( sort keys %$thisOne ) {
70
         # if they are wanting variable substitution, surround with double quote
-
 
71
         # otherwise, use single quote
-
 
72
         if ( $$thisOne{$key} =~ m/(\$hostname)|(\$reportDate)|(\$clientName)|(\$serialNumber)/ ) {
-
 
73
            $config .= "\$\$transports{$priority}{'$key'} = \"$$thisOne{$key}\";\n";
-
 
74
         } else {
-
 
75
            $config .= "\$\$transports{$priority}{'$key'} = '$$thisOne{$key}';\n";
72
         $config .= "\$\$transports{$priority}{'$key'} = '$$thisOne{$key}';\n";
76
         }
-
 
77
      } # foreach
73
      } # foreach
78
   } # foreach
74
   } # foreach
79
   return $config;
75
   return $config;
80
} # transportsToConfig
76
} # transportsToConfig
81
 
77
 
Line 364... Line 360...
364
         eval( $temp );
360
         eval( $temp );
365
      }
361
      }
366
   }
362
   }
367
}
363
}
368
 
364
 
-
 
365
sub processParameters {
-
 
366
   while ( my $parameter = shift ) {
-
 
367
      if ( $parameter eq '-v' ) {
-
 
368
         print "$main::VERSION\n";
-
 
369
         exit;
-
 
370
      }
-
 
371
   } # while
-
 
372
}
-
 
373
 
-
 
374
&processParameters( @ARGV );
-
 
375
 
369
&loadConfig();
376
&loadConfig();
370
 
377
 
371
unless ( $hostname ) {
378
unless ( $hostname ) {
372
   $hostname = `hostname -f`;
379
   $hostname = `hostname -f`;
373
   chomp $hostname;
380
   chomp $hostname;