Changeset 1770 in MondoRescue for branches/stable/mindi/mindi-bkphw
- Timestamp:
- Nov 6, 2007, 11:01:53 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mindi/mindi-bkphw
r1469 r1770 5 5 # 6 6 use strict; 7 use AppConfig;8 7 use File::Basename; 9 8 10 9 # Handling Configuration files 11 my $mindiconf=YYY 12 my $file1 = "$mindiconf/mindi.conf.dist"; 13 my $file2 = "$mindiconf/mindi.conf"; 10 die "No CACHE_DIR parameter" if ((not defined $ARGV[0]) || (! -d $ARGV[0])); 11 my $bkpdir = "$ARGV[0]/bkphw"; 12 die "No CONF_DIR parameter" if ((not defined $ARGV[1]) || (! -d $ARGV[1])); 13 my $confdir = "$ARGV[1]"; 14 14 15 my $tool = ""; 15 16 my $tooldir = ""; 16 17 my $ret = 0; 17 18 18 my $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 19 mkdir $bkpdir,0755 if (! -d $bkpdir) ; 30 20 open(SYSTEM,"dmidecode -s 'system-product-name' |") || die "You need dmidecode for mindi hardware support"; 31 21 my $productname = <SYSTEM>; … … 36 26 print "Detected an HP Hardware. Nice. Continue to support my job :-)\n"; 37 27 print "Activating Proliant support for mindi\n"; 38 open(PROLIANT,"$mindiconf/deplist.d/proliant.conf") || die "Unable to open $mindiconf/deplist.d/proliant.conf"; 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 # 40 EOF 39 41 while($tool = <PROLIANT>) { 40 42 next if ($tool =~ /^#/); … … 47 49 } else { 48 50 print "Found $tool, activating enhanced HP Proliant support in mindi\n"; 51 print TOOLS "$tool\n"; 49 52 } 50 if ($tool =~ /conrep/) { 51 $ret = system("(cd $tooldir ; $tool -s -f".$config->get("mindi_cache_dir")."/conrep.dat)"); 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"; 52 57 } 53 if ($tool =~ /cpqacuxe/) { 54 $ret = system("$tool -c ".$config->get("mindi_cache_dir")."/cpqacuxe.dat"); 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"; 55 62 } 56 if ($tool =~ /hponcfg/) { 57 $ret = system("$tool -w ".$config->get("mindi_cache_dir")."/hponcfg.dat"); 63 if ($tool =~ /\/hponcfg$/) { 64 $ret = system("$tool -w $bkpdir/hponcfg.dat"); 65 print SCRIPT "$tool -r $bkpdir/hponcfg.dat"); 66 } 67 if ($tool =~ /\.scexe$/) { 68 print SCRIPT "$tool"); 58 69 } 59 70 if ($ret != 0) { … … 61 72 } 62 73 } 74 close(PROLIANT); 75 close(TOOLS); 76 close(SCRIPT); 63 77 } else { 64 78 print "No Hardware support for $productname\n"; 65 79 print "Ask your manufacturer to contribute to the mindi project\n"; 66 80 } 81 rmdir $bkpdir if (-d $bkpdir) ;
Note:
See TracChangeset
for help on using the changeset viewer.