Changeset 2984 in MondoRescue for branches/3.0/mondo/src/mondorestore/mondo-prep.c
- Timestamp:
- Mar 30, 2012, 2:43:31 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/mondo/src/mondorestore/mondo-prep.c
r2972 r2984 564 564 char *program = NULL; 565 565 char *tmp = NULL; 566 char *tmp1 = NULL; 566 567 char *oldmd = NULL; 567 568 char *bootdevice; … … 586 587 log_msg(1, "RAID device %s not found in list.", device); 587 588 return 1; 589 } else { 590 log_msg(1, "RAID device %s found in list (%d).", device, i); 588 591 } 592 589 593 // create device list from normal disks followed by spare ones 590 594 mr_asprintf(&devices, "%s", raidlist->el[i].data_disks.el[0].device); … … 612 616 // 2) grub bootloader < v1 is used. 613 617 // Otherwise it won't boot which is bad. 614 read_cfg_var(g_mondo_cfg_file, "bootloader.device", bootdevice); 615 read_cfg_var(g_mondo_cfg_file, "bootloader.name", name); 618 if (read_cfg_var(g_mondo_cfg_file, "bootloader.device", bootdevice) != 0) { 619 log_msg(2, "Unable to find bootloader.device param in %s conf file\n", g_mondo_cfg_file); 620 } 621 if (read_cfg_var(g_mondo_cfg_file, "bootloader.name", name) != 0) { 622 log_msg(2, "Unable to find bootloader.name param in %s conf file\n", g_mondo_cfg_file); 623 strcpy(name,"NONE"); 624 } 616 625 if (strcmp(name,"GRUB") == 0) { 617 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("grub --version")); 626 mr_asprintf(&tmp1, "chroot %s grub --version", MNT_RESTORING); 627 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(tmp1)); 628 mr_free(tmp1); 618 629 if ((strstr(tmp, "GRUB 0.9") != NULL) && (strcmp(raidlist->el[i].raid_device,device) == 0)) { 619 mr_free(oldmd);620 630 mr_asprintf(&oldmd, "-e 0.90"); 621 631 log_it("Forcing old metadata 0.90 for md on %s for old GRUB", device); 632 } else { 633 mr_asprintf(&oldmd, ""); 622 634 } 623 635 } else if ((strcmp(name,"LILO") == 0) && (strcmp(raidlist->el[i].raid_device,device) == 0)) { 624 mr_free(oldmd);625 636 mr_asprintf(&oldmd, "-e 0.90"); 626 637 log_it("Forcing old metadata 0.90 for md on %s for LILO", device); … … 640 651 if (raidlist->el[i].additional_vars.el[v].value != NULL) { 641 652 // force its restoration in order to avoid modifying all conf files using it 653 log_it("Managing previous UUID %s", raidlist->el[i].additional_vars.el[v].value); 642 654 mr_strcat(program, " --update=uuid --uuid %s",raidlist->el[i].additional_vars.el[v].value); 643 655 break; 656 } else { 657 log_it("Unable to manage previous NULL UUID"); 644 658 } 645 659 } … … 671 685 } 672 686 mr_strcat(program, " %s", devices); 687 log_msg(2, "RAID device re-created with the following command:\n%s\n", program); 673 688 res = run_program_and_log_output(program, 1); 674 689 // free memory … … 814 829 paranoid_free(tmp); 815 830 816 // Shouldn't be necessary.831 // Shouldn't be necessary. 817 832 log_to_screen("Stopping %s", device); 818 833 stop_raid_device(device);
Note:
See TracChangeset
for help on using the changeset viewer.