Rev 59 | Blame | Last modification | View Log | Download | RSS feed
#! /usr/bin/env perl
use warnings;
use strict;
my $clientName = '';
my $serialNumber = '';
my $hostname = '';
my $UUID = '';
my @moduleDirs = ();
my @scriptDirs = ();
my $transports;
my $input = shift;
open CONF,"<$input" or die "could not open $input for read: $!\n";
my $conf = join( '', <CONF> );
close CONF;
eval( $conf );
$UUID = &getUUID() unless $UUID;
$serialNumber = &getSerial unless $serialNumber;
print "\$configuration{'clientName'} = '$clientName';\n";
print "\$configuration{'serialNumber'} = '$serialNumber';\n";
print "\$configuration{'hostname'} = '$hostname';\n";
print "\$configuration{'UUID'} = '$UUID';\n";
print "\$configuration{'moduleDirs'} = ( '" . join( "','", @moduleDirs) . "' );\n";
print "\$configuration{'scriptDirs'} = ( '" . join( "','", @scriptDirs) . "' );\n";
foreach my $level ( sort keys %$transports ) {
foreach my $key ( sort keys %{ $$transports{$level} } ) {
print "\$configuration{'transports'}{$level}{'$key'} = '$$transports{$level}{$key}';\n";
}
}
1;
sub getSerial {
my $serial = `sudo dmidecode -s system-serial-number`;
chomp $serial;
return $serial;
}
sub getUUID {
my $UUID = `sudo dmidecode -s system-uuid`;
chomp $UUID;
return $UUID;
}