Changeset 2937 in MondoRescue for branches/3.1/mindi/mindi-bkphw
- Timestamp:
- Jan 28, 2012, 1:51:28 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.1/mindi/mindi-bkphw
r2709 r2937 11 11 # Handling Configuration files 12 12 my $tool = ""; 13 my $tooldir = "";14 13 my $ret = 0; 14 my $productname = undef; 15 15 16 16 die "No CACHE_DIR parameter" if ((not defined $ARGV[0]) || (! -d $ARGV[0])); … … 24 24 mkdir $bkpdir,0755 if (! -d $bkpdir) ; 25 25 open(SYSTEM,"/usr/sbin/dmidecode -s 'system-product-name' 2> /dev/null |") || die "You need /usr/sbin/dmidecode for mindi hardware support"; 26 my $productname = <SYSTEM>; 26 while (<SYSTEM>) { 27 next if (/^#/); 28 $productname = $_; 29 chomp($productname); 30 } 27 31 close(SYSTEM); 28 32 29 die " ERROR: No product name found for Hardware support\n" if (not defined $productname);33 die "WARNING: No product name found for Hardware support\n" if (not defined $productname); 30 34 31 chomp($productname);32 35 if ($productname =~ /proliant/i) { 33 36 print "Detected a $productname. Nice. Continue to support my job :-)\n"; 34 print "Activating Proliant support for mindi\n"; 35 open(PROLIANT,"$confdir/proliant.files") || die "Unable to open $confdir/proliant.files"; 37 print "Activating ProLiant support for mindi\n"; 38 print "You can install the SmartStart Scripting toolkit tool $tool\nto benefit from mindi's enhanced ProLiant support\n"; 39 print "Get it from http://www.hp.com/servers/sstoolkit\n"; 40 print "And use the SDR to get all other HP ProLiant packages\n"; 41 print "Get it from http://downloads.linux.hp.com/SDR/downloads/ProLiantSupportPack/\n"; 42 open(PROLIANT,"$confdir/deplist.d/ProLiant.conf") || die "Unable to open $confdir/deplist.d/ProLiant.conf"; 43 # generate a list of what need to be put on the backup media 36 44 open(TOOLS,"> $bkpdir/../tools.files") || die "Unable to open $bkpdir/../tools.files"; 45 # generate a script that will be launched at rstore time to perform the HW setup 37 46 open(SCRIPT,"> $bkpdir/../mindi-rsthw") || die "Unable to open $bkpdir/../mindi-rsthw"; 38 47 print SCRIPT << 'EOF'; 39 48 #!/bin/bash 40 49 # 50 # Script generated by mindi 51 # 41 52 # This script will restore potentially your HW configuration 42 # on your system before partioning occurs 53 # on your system before partioning occurs. 54 # 43 55 # You may want to reboot after that step if you think that 44 56 # resetting BIOS parameters to the value restored 45 # may have an impact on you restoration process 57 # may have an impact on your restoration process or if 58 # you want to benefit from any firmware update that could have happened. 46 59 # 47 # put dynamic libraries at an accessible place48 for l in /usr/local/lib/*; do49 ln -sf $l /usr/lib50 done51 60 EOF 52 61 while($tool = <PROLIANT>) { 62 my $hasfound = 0; 53 63 next if ($tool =~ /^#/); 54 64 chomp($tool); 55 $tooldir = dirname($tool);65 # skip non-executable/exising binaries 56 66 if (! (-x $tool)) { 57 print "You could install the SmartStart Scripting toolkit tool $tool\nto benefit from mindi's enhanced hardware support\n";58 print "Get it from http://www.hp.com/servers/sstoolkit\n";59 67 next; 60 68 } else { 61 print "Found $tool, activating enhanced HP Pro liant support in mindi\n";69 print "Found $tool, activating enhanced HP ProLiant support in mindi\n"; 62 70 print TOOLS "$tool\n"; 63 71 } 64 72 if ($tool =~ /\/conrep$/) { 65 $ret = system("cd $tooldir ; $tool -s -f$bkpdir/conrep.dat"); 66 print SCRIPT "(cd $tooldir ; $tool -l -f$locbkpdir/conrep.dat)\n"; 73 # From the package 74 if (! -f "/opt/hp/hp-scripting-tools/etc/conrep.xml") { 75 $ret = system("$tool -s -x /opt/hp/hp-scripting-tools/etc/conrep.xml -f$bkpdir/conrep.dat"); 76 # From the SSSTK 77 } elsif (! -f "/usr/share/conrep/conrep.xml") { 78 $ret = system("$tool -s -x /usr/share/conrep/conrep.xml -f$bkpdir/conrep.dat"); 79 } else { 80 next; 81 } 82 print SCRIPT "$tool -l -f$locbkpdir/conrep.dat\n"; 67 83 print TOOLS "$tool.xml\n"; 68 84 } 69 if ($tool =~ /\/.acuxebin$/) { 85 if ($tool =~ /\/hpacuscripting$/) { 86 $hasfound = 1; 70 87 my $dir=basename($tool); 71 $ret = system("export ACUXE_BIN_INSTALLATION_DIR=$dir ; export IM_CFGFILE_PATH=$dir ; export ACUXE_LOCK_FILES_DIR=$dir/locks ; $tool -c $bkpdir/cpqacuxe.dat"); 72 print SCRIPT "export ACUXE_BIN_INSTALLATION_DIR=$dir ; export IM_CFGFILE_PATH=$dir ; export ACUXE_LOCK_FILES_DIR=$dir/locks ; $tool -i $locbkpdir/cpqacuxe.dat\n"; 73 print TOOLS "$tooldir/bld\n"; 74 } 75 if ($tool =~ /\/hpacucli$/) { 76 my $dir=basename($tool); 77 $ret = system("export ACUXE_BIN_INSTALLATION_DIR=$dir ; export IM_CFGFILE_PATH=$dir ; export ACUXE_LOCK_FILES_DIR=$dir/locks ; $tool -c $bkpdir/hpacucli.dat"); 78 print SCRIPT "export ACUXE_BIN_INSTALLATION_DIR=$dir ; export IM_CFGFILE_PATH=$dir ; export ACUXE_LOCK_FILES_DIR=$dir/locks ; $tool -i $locbkpdir/hpacucli.dat\n"; 79 print TOOLS "$tooldir/bld\n"; 88 # Just backup internal info for a DR 89 $ret = system("$tool -c $bkpdir/hpacuscripting.dat -internal"); 90 # We could want to reset it before. 91 print SCRIPT "# $tool -reset -i $locbkpdir/hpacusripting.dat\n"; 92 print SCRIPT "$tool -i $locbkpdir/hpacusripting.dat\n"; 80 93 } 81 94 if ($tool =~ /\/hponcfg$/) { 82 $ret = system("$tool - w $bkpdir/hponcfg.dat");83 print SCRIPT "$tool - r$locbkpdir/hponcfg.dat\n";95 $ret = system("$tool -a -w $bkpdir/hponcfg.dat"); 96 print SCRIPT "$tool -f $locbkpdir/hponcfg.dat\n"; 84 97 } 85 98 if ($tool =~ /\.scexe$/) { 86 print "Found $tool, that firmware will be applied at restore time on your HP Proliant\n"; 87 print SCRIPT "./$tool\n"; 99 print "Found $tool, that firmware will be applied at restore time on your HP ProLiant\n"; 100 print SCRIPT "./$tool -s\n"; 101 } 102 # Kept for compatibility with older version of tools 103 if (($tool =~ /\/hpacucli$/) && ($hasfound == 0)) { 104 my $dir=basename($tool); 105 $ret = system("$tool -c $bkpdir/hpacucli.dat"); 106 print SCRIPT "$tool -i $locbkpdir/hpacucli.dat\n"; 88 107 } 89 108 if ($ret != 0) { … … 96 115 } else { 97 116 print "\nWARNING: No Hardware support for $productname.\nNot a big issue, just less features and risks ;-)\n"; 98 print "You may ask your manufacturer to contribute to the mindi project \n";117 print "You may ask your manufacturer to contribute to the mindi project (harmless)\n"; 99 118 } 100 119 rmdir $bkpdir if (-d $bkpdir) ;
Note:
See TracChangeset
for help on using the changeset viewer.