Subversion Repositories camp_sysinfo_client_3

Rev

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

Rev 36 Rev 37
Line 15... Line 15...
15
our @EXPORT = qw( $clientName $serialNumber $hostname @moduleDirs @scriptDirs 
15
our @EXPORT = qw( $clientName $serialNumber $hostname @moduleDirs @scriptDirs 
16
                  $transports $sysinfo3 %sendTypes $binDir $modulesDir
16
                  $transports $sysinfo3 %sendTypes $binDir $modulesDir
17
                  $scriptsDir $confDir $binName $confName
17
                  $scriptsDir $confDir $binName $confName
18
                  &showConf &transportsToConfig &getAnswer &yesno  
18
                  &showConf &transportsToConfig &getAnswer &yesno  
19
                  &writeConfig &processParameters $TESTING &checkDirectoryExists
19
                  &writeConfig &processParameters $TESTING &checkDirectoryExists
20
                  &runCommand &setDryRun
20
                  &runCommand &setDryRun &enableModules
21
                );
21
                );
22
 
22
 
23
our $TESTING = 0;
23
our $TESTING = 0;
24
our $dryRun;
24
our $dryRun;
25
our $clientName = '';
25
our $clientName = '';
Line 74... Line 74...
74
                                      ]
74
                                      ]
75
                                    }
75
                                    }
76
                );
76
                );
77
 
77
 
78
 
78
 
-
 
79
sub enableModules {
-
 
80
   my $moduleDir = shift;
-
 
81
   my %modules;
-
 
82
   if ( opendir( my $dh, "$moduleDir" ) ) {
-
 
83
      %modules = map{ $_ => { 'enabled' => -x "$moduleDir/$_" } } 
-
 
84
                 grep { ! /^\./ } 
-
 
85
                 readdir $dh;
-
 
86
      closedir( $dh );
-
 
87
      foreach my $filename ( keys %modules ) {
-
 
88
         if ( open FILE,"<$moduleDir/$_" ) {
-
 
89
            my @descript = grep{ /^# Description: (.*)/ } <FILE>;
-
 
90
            close FILE;
-
 
91
            chomp @descript;
-
 
92
            $modules{$filename}{'description'} = $descript[0];
-
 
93
         } # if
-
 
94
      } # foreach
-
 
95
   } # if
-
 
96
} # enableModules
-
 
97
 
79
sub showConf {
98
sub showConf {
80
   my $configuration = shift;
99
   my $configuration = shift;
81
#   print Dumper( $configuration ); die;
100
#   print Dumper( $configuration ); die;
82
   my $conf;
101
   my $conf;
83
   $conf .= "\$clientName = '" .   ( defined( $$configuration{'clientName'}   ) ? $$configuration{'clientName'}   : '' ) . "';\n";
102
   $conf .= "\$clientName = '" .   ( defined( $$configuration{'clientName'}   ) ? $$configuration{'clientName'}   : '' ) . "';\n";