source: MondoRescue/branches/3.3/mindi/mindi-hpsa@ 3684

Last change on this file since 3684 was 3684, checked in by Bruno Cornec, 7 years ago
  • Skip a potential Warning when calling parted (Warning: The disk CHS geometry (258,255,63) reported by the operating system does not match the geometry stored on the disk label (1012,128,32).)
  • Improve some error msgs for coherency
  • Improve ansible delivery for perl Hokks to add svn hook support
  • Property svn:executable set to *
File size: 4.2 KB
Line 
1#!/usr/bin/perl -w
2#
3# $Id$
4#
5# Gives the right driver to use for HP Smart Array Controllers for the corresponding Linux distribution
6# Vased on the HP document hpsa migration at
7#
8use strict;
9
10my $drv = {
11 "P420i"
12}
13
14# Handling Configuration files
15my $tool = "";
16my $ret = 0;
17my $productname = undef;
18
19die "ERROR: You need dmidecode for Hardware support\n" if (! -x "/usr/sbin/dmidecode");
20
21mkdir $bkpdir,0755 if (! -d $bkpdir) ;
22open(SYSTEM,"/usr/sbin/dmidecode -s 'system-product-name' 2> /dev/null |") || die "ERROR: You need /usr/sbin/dmidecode for mindi hardware support";
23while (<SYSTEM>) {
24 next if (/^#/);
25 $productname = $_;
26 chomp($productname);
27 }
28close(SYSTEM);
29
30die "INFO: No product name found for Hardware support\n" if (not defined $productname);
31
32if ($productname =~ /proliant/i) {
33 print "Detected a $productname. Nice. Continue to support my job :-)\n";
34 print "Activating ProLiant support for mindi\n";
35 print "You can install SDR packages to benefit from mindi's enhanced ProLiant support\n";
36 print "Get them from http://downloads.linux.hpe.com/SDR/\n";
37 open(PROLIANT,"$confdir/deplist.d/ProLiant.conf") || die "ERROR: Unable to open $confdir/deplist.d/ProLiant.conf";
38 # generate a list of what need to be put on the backup media
39 open(TOOLS,"> $bkpdir/../tools.files") || die "ERROR: Unable to open $bkpdir/../tools.files";
40 # generate a script that will be launched at rstore time to perform the HW setup
41 open(SCRIPT,"> $bkpdir/../mindi-rsthw") || die "ERROR: Unable to open $bkpdir/../mindi-rsthw";
42 print SCRIPT << 'EOF';
43#!/bin/bash
44#
45# Script generated by mindi
46#
47# This script will restore potentially your HW configuration
48# on your system before partioning occurs.
49#
50# You may want to reboot after that step if you think that
51# resetting BIOS parameters to the value restored
52# may have an impact on your restoration process or if
53# you want to benefit from any firmware update that could have happened.
54#
55EOF
56 while($tool = <PROLIANT>) {
57 my $hasfound = 0;
58 next if ($tool =~ /^#/);
59 chomp($tool);
60 # skip non-executable/exising binaries
61 if (! (-x $tool)) {
62 next;
63 } else {
64 print "Found $tool, activating enhanced HP ProLiant support in mindi\n";
65 print TOOLS "$tool\n";
66 }
67 if ($tool =~ /\/conrep$/) {
68 my $xmlf = "/opt/hp/hp-scripting-tools/etc/conrep.xml";
69 # From the package
70 if (-f $xmlf) {
71 $ret = system("$tool -s -x $xmlf -f$bkpdir/conrep.dat");
72 # From the SSSTK
73 } else {
74 $xmlf = "/usr/share/conrep/conrep.xml";
75 if (-f $xmlf) {
76 $ret = system("$tool -s -x $xmlf -f$bkpdir/conrep.dat");
77 } else {
78 next;
79 }
80 }
81 print SCRIPT "$tool -l -f$locbkpdir/conrep.dat\n";
82 print TOOLS "$xmlf\n";
83 }
84 if ($tool =~ /\/hp-rcu$/) {
85 $ret = system("$tool -s -f$bkpdir/conrep.dat");
86 print SCRIPT "$tool -l -f$locbkpdir/conrep.dat\n";
87 }
88 if ($tool =~ /\/hpacuscripting$/) {
89 $hasfound = 1;
90 my $dir=basename($tool);
91 # Just backup internal info for a DR
92 $ret = system("$tool -c $bkpdir/hpacuscripting.dat -internal");
93 # We could want to reset it before.
94 print SCRIPT "# $tool -reset -i $locbkpdir/hpacusripting.dat\n";
95 print SCRIPT "$tool -i $locbkpdir/hpacusripting.dat\n";
96 }
97 if ($tool =~ /\/hponcfg$/) {
98 $ret = system("$tool -a -w $bkpdir/hponcfg.dat");
99 print SCRIPT "$tool -f $locbkpdir/hponcfg.dat\n";
100 }
101 if ($tool =~ /\.scexe$/) {
102 print "Found $tool, that firmware will be applied at restore time on your HP ProLiant\n";
103 print SCRIPT "./$tool -s\n";
104 }
105 if ($tool =~ /\/hp-fm/) {
106 print "Found $tool, firmware will be upgraded at restore time on your HP ProLiant\n";
107 print SCRIPT "./$tool upgrade\n";
108 }
109 # Kept for compatibility with older version of tools
110 if (($tool =~ /\/hpacucli$/) && ($hasfound == 0)) {
111 my $dir=basename($tool);
112 $ret = system("$tool -c $bkpdir/hpacucli.dat");
113 print SCRIPT "$tool -i $locbkpdir/hpacucli.dat\n";
114 }
115 if ($ret != 0) {
116 print "$tool returned an error. Hardware support may not be complete\n";
117 }
118 }
119 close(PROLIANT);
120 close(TOOLS);
121 close(SCRIPT);
122} else {
123 print "INFO: No Hardware optimized support for your product $productname\n";
124 print " You may ask your manufacturer to contribute to the mindi project\n for firmware Disaster Recovery support (harmless)\n";
125}
126rmdir $bkpdir if (-d $bkpdir) ;
Note: See TracBrowser for help on using the repository browser.