[925] | 1 | #!/usr/bin/perl -w
|
---|
| 2 | #
|
---|
| 3 | # Backup the hardware configuration on machine supporting it
|
---|
| 4 | # (Bios configuration, Raid configuration, ...)
|
---|
| 5 | #
|
---|
[1280] | 6 | use strict;
|
---|
| 7 | use AppConfig;
|
---|
[1469] | 8 | use File::Basename;
|
---|
[925] | 9 |
|
---|
[1280] | 10 | # Handling Configuration files
|
---|
| 11 | my $mindiconf=YYY
|
---|
| 12 | my $file1 = "$mindiconf/mindi.conf.dist";
|
---|
| 13 | my $file2 = "$mindiconf/mindi.conf";
|
---|
| 14 | my $tool = "";
|
---|
[1469] | 15 | my $tooldir = "";
|
---|
[1280] | 16 | my $ret = 0;
|
---|
[925] | 17 |
|
---|
[1280] | 18 | my $config = AppConfig->new({
|
---|
| 19 | # Auto Create variables mentioned in Conf file
|
---|
| 20 | CREATE => 1,
|
---|
| 21 | DEBUG => 0,
|
---|
| 22 | GLOBAL => {
|
---|
[1467] | 23 | # Each conf item has one single parameter
|
---|
| 24 | ARGCOUNT => AppConfig::ARGCOUNT_ONE,
|
---|
| 25 | DEFAULT => '<undef>'
|
---|
[1280] | 26 | }
|
---|
| 27 | });
|
---|
| 28 | $config->file($file1, $file2);
|
---|
| 29 |
|
---|
| 30 | open(SYSTEM,"dmidecode -s 'system-product-name' |") || die "You need dmidecode for mindi hardware support";
|
---|
| 31 | my $productname = <SYSTEM>;
|
---|
| 32 | close(SYSTEM);
|
---|
| 33 |
|
---|
| 34 | chomp($productname);
|
---|
[1467] | 35 | if ($productname =~ /proliant/i) {
|
---|
| 36 | print "Detected an HP Hardware. Nice. Continue to support my job :-)\n";
|
---|
| 37 | print "Activating Proliant support for mindi\n";
|
---|
| 38 | open(PROLIANT,"$mindiconf/deplist.d/proliant.conf") || die "Unable to open $mindiconf/deplist.d/proliant.conf";
|
---|
| 39 | while($tool = <PROLIANT>) {
|
---|
| 40 | next if ($tool =~ /^#/);
|
---|
| 41 | chomp($tool);
|
---|
[1469] | 42 | $tooldir = dirname($tool);
|
---|
[1467] | 43 | if (! (-e $tool)) {
|
---|
| 44 | print "You should install the SmartStart Scripting toolkit tool $tool\nto benefit from mindi's enhanced hardware support\n";
|
---|
| 45 | print "Get it from http://www.hp.com/servers/sstoolkit\n";
|
---|
| 46 | next;
|
---|
| 47 | } else {
|
---|
| 48 | print "Found $tool, activating enhanced HP Proliant support in mindi\n";
|
---|
[1280] | 49 | }
|
---|
[1467] | 50 | if ($tool =~ /conrep/) {
|
---|
[1469] | 51 | $ret = system("(cd $tooldir ; $tool -s -f".$config->get("mindi_cache_dir")."/conrep.dat)");
|
---|
[1467] | 52 | }
|
---|
| 53 | if ($tool =~ /cpqacuxe/) {
|
---|
| 54 | $ret = system("$tool -c ".$config->get("mindi_cache_dir")."/cpqacuxe.dat");
|
---|
| 55 | }
|
---|
| 56 | if ($tool =~ /hponcfg/) {
|
---|
| 57 | $ret = system("$tool -w ".$config->get("mindi_cache_dir")."/hponcfg.dat");
|
---|
| 58 | }
|
---|
| 59 | if ($ret != 0) {
|
---|
| 60 | print "$tool returned an error. Hardware support may not be complete\n";
|
---|
| 61 | }
|
---|
[1280] | 62 | }
|
---|
| 63 | } else {
|
---|
| 64 | print "No Hardware support for $productname\n";
|
---|
| 65 | print "Ask your manufacturer to contribute to the mindi project\n";
|
---|
| 66 | }
|
---|