source: MondoRescue/branches/stable/mindi/mindi-bkphw@ 1633

Last change on this file since 1633 was 1469, checked in by Bruno Cornec, 17 years ago

Improve the bkphw. Works now for conrep and hpacucli (+ doc and install procediures correct)

File size: 2.2 KB
Line 
1#!/usr/bin/perl -w
2#
3# Backup the hardware configuration on machine supporting it
4# (Bios configuration, Raid configuration, ...)
5#
6use strict;
7use AppConfig;
8use File::Basename;
9
10# Handling Configuration files
11my $mindiconf=YYY
12my $file1 = "$mindiconf/mindi.conf.dist";
13my $file2 = "$mindiconf/mindi.conf";
14my $tool = "";
15my $tooldir = "";
16my $ret = 0;
17
18my $config = AppConfig->new({
19 # Auto Create variables mentioned in Conf file
20 CREATE => 1,
21 DEBUG => 0,
22 GLOBAL => {
23 # Each conf item has one single parameter
24 ARGCOUNT => AppConfig::ARGCOUNT_ONE,
25 DEFAULT => '<undef>'
26 }
27 });
28$config->file($file1, $file2);
29
30open(SYSTEM,"dmidecode -s 'system-product-name' |") || die "You need dmidecode for mindi hardware support";
31my $productname = <SYSTEM>;
32close(SYSTEM);
33
34chomp($productname);
35if ($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);
42 $tooldir = dirname($tool);
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";
49 }
50 if ($tool =~ /conrep/) {
51 $ret = system("(cd $tooldir ; $tool -s -f".$config->get("mindi_cache_dir")."/conrep.dat)");
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 }
62 }
63} else {
64 print "No Hardware support for $productname\n";
65 print "Ask your manufacturer to contribute to the mindi project\n";
66}
Note: See TracBrowser for help on using the repository browser.