source: MondoRescue/branches/2.2.5/mindi/mindi-bkphw@ 1761

Last change on this file since 1761 was 1761, checked in by Bruno Cornec, 16 years ago

Adds preliminary Hardware support to mindi (Proliant SSSTK)
Not tested yet, just coded, and saved in SVN as a backup :-)

File size: 2.6 KB
RevLine 
[1761]1#!/usr/bin/perl -w
2#
3# Backup the hardware configuration on machine supporting it
4# (Bios configuration, Raid configuration, ...)
5#
6use strict;
7use File::Basename;
8
9# Handling Configuration files
10my $tool = "";
11my $tooldir = "";
12my $ret = 0;
13
14die "No CACHE_DIR parameter" if ((not defined $ARGV[0]) || (! -d $ARGV[0]));
15my $bkpdir = "$ARGV[0]/bkphw";
16die "No CONF_DIR parameter" if ((not defined $ARGV[1]) || (! -d $ARGV[1]));
17my $confdir = "$ARGV[1]";
18
19mkdir 0755,$bkpdir if (! -d $bkpdir) ;
20open(SYSTEM,"dmidecode -s 'system-product-name' |") || die "You need dmidecode for mindi hardware support";
21my $productname = <SYSTEM>;
22close(SYSTEM);
23
24chomp($productname);
25if ($productname =~ /proliant/i) {
26 print "Detected an HP Hardware. Nice. Continue to support my job :-)\n";
27 print "Activating Proliant support for mindi\n";
28 open(PROLIANT,"$confdir/proliant.files") || die "Unable to open $confdir/proliant.files";
29 open(TOOLS,"> $bkpdir/../tools.files") || die "Unable to open $bkpdir/../tools.files";
30 open(SCRIPT,"> $bkpdir/../mindi-rsthw") || die "Unable to open $bkpdir/../mindi-rsthw";
31 print SCRIPT << "EOF";
32#!/bin/bash
33#
34# This script will restore potentially your HW configuration
35# on your system before partioning occurs
36# You may want to reboot after that step if you think that
37# resetting BIOS parameters to the value restored
38# may have an impact on you restoration process
39#
40EOF
41 while($tool = <PROLIANT>) {
42 next if ($tool =~ /^#/);
43 chomp($tool);
44 $tooldir = dirname($tool);
45 if (! (-e $tool)) {
46 print "You should install the SmartStart Scripting toolkit tool $tool\nto benefit from mindi's enhanced hardware support\n";
47 print "Get it from http://www.hp.com/servers/sstoolkit\n";
48 next;
49 } else {
50 print "Found $tool, activating enhanced HP Proliant support in mindi\n";
51 print TOOLS "$tool\n";
52 }
53 if ($tool =~ /\/conrep$/) {
54 $ret = system("(cd $tooldir ; $tool -s -f$bkpdir/conrep.dat)");
55 print SCRIPT "(cd $tooldir ; $tool -s -f$bkpdir/conrep.dat)");
56 print TOOLS "$tool.xml\n";
57 }
58 if ($tool =~ /\/cpqacuxe$/) {
59 $ret = system("$tool -c $bkpdir/cpqacuxe.dat");
60 print SCRIPT "$tool -r $bkpdir/cpqacuxe.dat)");
61 print TOOLS "$tooldir/bld\n";
62 }
63 if ($tool =~ /\/hponcfg$/) {
64 $ret = system("$tool -w $bkpdir/hponcfg.dat");
65 print SCRIPT "$tool -r $bkpdir/hponcfg.dat)");
66 }
67 if ($ret != 0) {
68 print "$tool returned an error. Hardware support may not be complete\n";
69 }
70 }
71 close(PROLIANT);
72 close(TOOLS);
73 close(SCRIPT);
74} else {
75 print "No Hardware support for $productname\n";
76 print "Ask your manufacturer to contribute to the mindi project\n";
77}
78rmdir $bkpdir if (-d $bkpdir) ;
Note: See TracBrowser for help on using the repository browser.