Subversion Repositories camp_sysinfo_client_3

Rev

Rev 218 | Rev 223 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 218 Rev 219
Line 198... Line 198...
198
      my $thisConfig = &readConfig( $configFile );
198
      my $thisConfig = &readConfig( $configFile );
199
      # add the new config to %config, overwriting any existing keys which are duplicated
199
      # add the new config to %config, overwriting any existing keys which are duplicated
200
      $config = $merge->merge( $config, $thisConfig );
200
      $config = $merge->merge( $config, $thisConfig );
201
      #@config{keys %$thisConfig} = values %$thisConfig;
201
      #@config{keys %$thisConfig} = values %$thisConfig;
202
   }
202
   }
203
   use Data::Dumper;
-
 
204
 
-
 
205
   die Dumper( $config );
-
 
206
   # now, ensure the correct values are loaded in some areas
203
   # now, ensure the correct values are loaded in some areas
207
   unless ( $config->{'hostname'} ) {
204
   unless ( $config->{'hostname'} ) {
208
      $hostname = `hostname -f`;
205
      $hostname = `hostname -f`;
209
      chomp $hostname;
206
      chomp $hostname;
210
      $config->{'hostname'} = $hostname;
207
      $config->{'hostname'} = $hostname;
211
   }
208
   }
212
   unless ( $config->{'serialNumber'} ) {
209
   unless ( $config->{'serialNumber'} ) {
213
      $serialNumber = `dmidecode -t 1 | grep 'Serial Number' | cut -d':' -f2` if `which dmidecode`;
210
      $serialNumber = `dmidecode -s system-serial-number` if `which dmidecode`;
214
      chomp $serialNumber;
211
      chomp $serialNumber;
215
      $serialNumber =~ s/\s//gi;
212
      $serialNumber =~ s/\s//gi;
216
      $config->{'serialNumber'} = $serialNumber;
213
      $config->{'serialNumber'} = $serialNumber;
217
   }
214
   }
218
   unless ( $config->{'UUID'} ) {
215
   unless ( $config->{'UUID'} ) {
219
      my $UUID = `which dmidecode` ?  `dmidecode -t 1 | grep -i uuid | cut -d':' -f2` : '';
216
      my $UUID = `which dmidecode` ?  `dmidecode -t 1 | grep -i uuid | cut -d':' -f2` : '';
220
      $UUID =~ s/\s//gi;
217
      $UUID =~ s/\s//gi;
221
      $config->{'UUID'} = $UUID;
218
      $config->{'UUID'} = $UUID;
222
   }
219
   }
223
 
-
 
224
   # ensure we have the default SaveLocal transport defined
-
 
225
   unless ( defined $config->{'transports'}{'99'} ) {
-
 
226
      $config->{'transports'}{'99'} = {
-
 
227
                         'name'=> 'SaveLocal',
-
 
228
                         'output directory' => '/tmp',
-
 
229
                         'sendScript' => 'save_local'
-
 
230
                        };
-
 
231
   }
220
   
232
 
-
 
233
   return $config;
221
   return $config;
234
}
222
}
235
 
223
 
236
# prompt the user for a response, then allow them to enter it
224
# prompt the user for a response, then allow them to enter it
237
# the first response is considered the default and is printed
225
# the first response is considered the default and is printed