Changeset 3161 in MondoRescue for branches/3.1/mondo/src/mondorestore
- Timestamp:
- Jun 25, 2013, 10:53:14 PM (11 years ago)
- Location:
- branches/3.1/mondo/src/mondorestore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.1/mondo/src/mondorestore/mondo-prep.c
r3148 r3161 188 188 char *p; 189 189 char *q; 190 char *r;191 190 192 191 /** int ***************************************************/ … … 391 390 } 392 391 mr_asprintf(tmp1, "echo \"%s\" >> /tmp/out.sh", command); 393 system(tmp1); 392 if (system(tmp1)) { 393 //FIXME 394 } 394 395 mr_free(tmp1); 395 396 sleep(1); … … 443 444 /** pointers *********************************************************/ 444 445 char *p; 445 char *q;446 446 447 447 /** init *************************************************************/ … … 533 533 int i = 0; 534 534 int j = 0; 535 int v = 0;536 535 int res = 0; 537 536 … … 540 539 char *level = NULL; 541 540 char *program = NULL; 542 543 malloc_string(bootdevice); 544 malloc_string(name); 545 541 char *strtmp = NULL; 542 char *oldmd = NULL; 543 546 544 // leave straight away if raidlist is initial or has no entries 547 545 if (!raidlist || raidlist->entries == 0) { … … 587 585 // - faulty devices ignored 588 586 // - persistent superblock always used as this is recommended 589 // As per bug #473, the parameter "-e 0.90" is used only when:590 // 1) It detects that system boots from Raid-1591 // 2) grub bootloader < v1 is used.592 // Otherwise it won't boot which is bad.593 read_cfg_var(g_mondo_cfg_file, "bootloader.device", bootdevice);594 read_cfg_var(g_mondo_cfg_file, "bootloader.name", name);595 if (strcmp(name,"GRUB") == 0) {596 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("grub --version"));597 if ((strstr(tmp, "GRUB 0.9") != NULL) && (strcmp(raidlist->el[i].raid_device,device) == 0)) {598 mr_free(oldmd);599 mr_asprintf(oldmd, "-e 0.90");600 log_it("Forcing old metadata 0.90 for md on %s for old GRUB", device);601 }602 } else if ((strcmp(name,"LILO") == 0) && (strcmp(raidlist->el[i].raid_device,device) == 0)) {603 mr_free(oldmd);604 mr_asprintf(oldmd, "-e 0.90");605 log_it("Forcing old metadata 0.90 for md on %s for LILO", device);606 } else {607 mr_asprintf(oldmd, "");608 }609 mr_free(device);610 mr_free(name);611 587 612 588 mr_asprintf(program, "mdadm --create --force --run --auto=yes %s --level=%s --raid-devices=%d %s", raidlist->el[i].raid_device, level, raidlist->el[i].data_disks.entries, oldmd); … … 632 608 break; 633 609 } 634 paranoid_free(strtmp);610 mr_free(strtmp); 635 611 } 636 612 if (raidlist->el[i].chunk_size != -1) { … … 1039 1015 sync(); 1040 1016 sync(); 1041 system("reboot"); 1017 if (system("reboot")) { 1018 // FIXME 1019 } 1042 1020 } 1043 1021 } else { … … 1420 1398 char *tmp = NULL; 1421 1399 char *tmp1 = NULL; 1422 char *tmp1 = NULL;1423 char *tmp1 = NULL;1424 1400 1425 1401 /** end *************************************************************/ … … 1594 1570 sync(); 1595 1571 paranoid_pclose(pout_to_fdisk); 1596 paranoid_system("sync");1572 sync(); 1597 1573 log_msg(0,"------------------- fdisk.log looks like this ------------------"); 1598 1574 mr_asprintf(tmp, "cat %s >> %s", FDISK_LOG, MONDO_LOGFILE); 1599 system(tmp); 1575 if (system(tmp)) { 1576 // FIXME 1577 } 1600 1578 mr_free(tmp); 1601 1579 … … 1645 1623 1646 1624 /** pointers **********************************************************/ 1647 char *p;1648 1625 char *part_table_fmt = NULL; 1649 1626 FILE *fout; … … 1676 1653 return (1); 1677 1654 } 1678 1679 1680 p = (char *) strrchr(partition_name, '/');1681 1655 1682 1656 /* BERLIOS: should not be called each time */ … … 1916 1890 1917 1891 /** pointers *********************************************************/ 1918 char *p;1919 1892 FILE *fout; 1920 1893 … … 1928 1901 1929 1902 partition = build_partition_name(drive, partno); 1930 p = (char *) strrchr(partition, '/');1931 1903 if (strcmp(format, "swap") == 0) { 1932 1904 mr_asprintf(partcode, "82"); … … 2169 2141 char *dev; 2170 2142 char *p; 2171 int res;2172 2143 #endif 2173 2144 2174 2145 /** pointers ********************************************************/ 2175 2146 FILE *fin; 2176 char *q;2177 2147 int i; 2178 2148 … … 2233 2203 char *which_format_command_do_i_need(char *format) 2234 2204 { 2235 /** int *************************************************************/2236 int res = 0;2237 2238 2205 /** buffers *********************************************************/ 2239 2206 char *program = NULL; … … 2292 2259 #endif 2293 2260 log_it("Unknown format (%s) - assuming '%s' will do", format, program); 2294 res = 0;2295 2261 } 2296 2262 return (program); … … 2320 2286 float factor; 2321 2287 long long new_size; 2288 char *tmp = NULL; 2322 2289 2323 2290 /** long *************************************************************/ -
branches/3.1/mondo/src/mondorestore/mondo-rstr-compare.c
r3147 r3161 228 228 char *archiver_exe = NULL; 229 229 char *tmp1 = NULL; 230 char *filelist_name = NULL;231 230 char *logfile = NULL; 232 231 char *compressor_exe = NULL; … … 234 233 use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE; 235 234 assert_string_is_neither_NULL_nor_zerolength(tarball_fname); 236 mr_asprintf(filelist_name, MNT_CDROM "/archives/filelist.%d", current_tarball_number);237 noof_lines = count_lines_in_file(filelist_name);238 mr_free(filelist_name);239 235 240 236 if (strstr(tarball_fname, ".bz2")) { -
branches/3.1/mondo/src/mondorestore/mondo-rstr-newt.c
r3147 r3161 531 531 assert(raidrec != NULL); 532 532 533 system("grep Pers /proc/mdstat > /tmp/raid-personalities.txt 2> /dev/null"); 533 if (system("grep Pers /proc/mdstat > /tmp/raid-personalities.txt 2> /dev/null")) { 534 // FIXME 535 } 534 536 personalities = last_line_of_file("/tmp/raid-personalities.txt"); 535 537 mr_asprintf(prompt, "Please enter the RAID level you want. %s", personalities); … … 2272 2274 char *q = NULL; 2273 2275 char *r = NULL; 2274 char *s = NULL;2275 2276 char *idev = NULL; 2276 2277 bool ret = FALSE; /* Should be false by default, and modfiy if conditions respected */ -
branches/3.1/mondo/src/mondorestore/mondo-rstr-tools.c
r3148 r3161 80 80 char *incoming = NULL; 81 81 char *question = NULL; 82 char *q;83 char *q;84 82 85 83 assert_string_is_neither_NULL_nor_zerolength(infname); … … 182 180 char *mds = NULL; 183 181 int retval = 0, i; 184 bool already_mounted = FALSE;185 182 char *isodir_format = NULL; 186 183 … … 553 550 mr_free(command); 554 551 555 chdir(bkpinfo->tmpdir); 552 if (chdir(bkpinfo->tmpdir)) { 553 //FIXME 554 } 556 555 557 556 mr_free(mountpt); … … 576 575 if (try_plan_B) { 577 576 log_msg(2, "gcffa --- OK, switching to Plan B"); 578 chdir(bkpinfo->tmpdir); 577 if (chdir(bkpinfo->tmpdir)) { 578 // FIXME 579 } 579 580 run_program_and_log_output("mkdir -p tmp", FALSE); 580 581 … … 1082 1083 char *command = NULL; 1083 1084 char *tmp; 1084 char *tmp1 = NULL;1085 1085 char *q; 1086 1086 int res = 0; … … 1402 1402 bool mntlistchg = FALSE; 1403 1403 FILE *fin = NULL; 1404 bool mntlistchg = FALSE;1405 FILE *fin = NULL;1406 1404 1407 1405 assert_string_is_neither_NULL_nor_zerolength(bd); … … 1436 1434 } 1437 1435 1438 if ((res) || (mntlistchg)){ 1439 popup_and_OK 1440 ("GRUB installation failed. You will now edit fstab, mtab, device.map and menu.lst/grub.cfg in order to fix grub install"); 1441 } else { 1442 popup_and_OK("The mountlist was changed. You will now edit fstab, mtab, device.map and menu.lst/grub.cfg in order to fix grub install"); 1443 } 1444 if (!g_text_mode) { 1445 newtSuspend(); 1446 } 1447 sprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor); 1448 paranoid_system(tmp); 1449 sprintf(tmp, "chroot %s %s /etc/mtab", MNT_RESTORING, editor); 1450 paranoid_system(tmp); 1451 if (does_file_exist(MNT_RESTORING"/boot/grub/menu.lst")) { 1452 sprintf(tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor); 1453 } else if (does_file_exist(MNT_RESTORING"/boot/grub/grub.cfg")) { 1454 sprintf(tmp, "chroot %s %s /boot/grub/grub.cfg", MNT_RESTORING, editor); 1455 } else if (does_file_exist(MNT_RESTORING"/boot/grub2/grub.cfg")) { 1456 sprintf(tmp, "chroot %s %s /boot/grub2/grub.cfg", MNT_RESTORING, editor); 1457 } 1458 paranoid_system(tmp); 1459 if (does_file_exist(MNT_RESTORING"/boot/grub/device.map")) { 1460 sprintf(tmp, "chroot %s %s /boot/grub/device.map", MNT_RESTORING, editor); 1461 } else if (does_file_exist(MNT_RESTORING"/boot/grub2/device.map")) { 1462 sprintf(tmp, "chroot %s %s /boot/grub2/device.map", MNT_RESTORING, editor); 1463 } 1464 paranoid_system(tmp); 1465 if (!g_text_mode) { 1466 newtResume(); 1467 } 1468 sprintf(command, "stabgrub-me %s", boot_device); 1469 res = run_program_and_log_output(command, 1); 1470 if (res) { 1471 popup_and_OK 1472 ("GRUB installation failed. Please fix the conf files so that a manual install using 'grub-install' or similar command works. You are now chroot()'ed to your restored system. Please type 'exit' when you are done."); 1473 newtSuspend(); 1474 paranoid_system("chroot " MNT_RESTORING); 1475 newtResume(); 1476 popup_and_OK("Thank you."); 1477 } else { 1478 popup_and_OK("GRUB is now installed correctly"); 1479 done = TRUE; 1480 } 1436 if ((res) || (mntlistchg)) { 1437 popup_and_OK("GRUB installation failed. You will now edit fstab, mtab, device.map and menu.lst/grub.cfg in order to fix grub install"); 1481 1438 } else { 1439 popup_and_OK("The mountlist was changed. You will now edit fstab, mtab, device.map and menu.lst/grub.cfg in order to fix grub install"); 1440 } 1441 if (!g_text_mode) { 1442 newtSuspend(); 1443 } 1444 mr_asprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor); 1445 paranoid_system(tmp); 1446 mr_free(tmp); 1447 1448 mr_asprintf(tmp, "chroot %s %s /etc/mtab", MNT_RESTORING, editor); 1449 paranoid_system(tmp); 1450 mr_free(tmp); 1451 1452 if (does_file_exist(MNT_RESTORING"/boot/grub/menu.lst")) { 1453 mr_asprintf(tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor); 1454 } else if (does_file_exist(MNT_RESTORING"/boot/grub/grub.cfg")) { 1455 mr_asprintf(tmp, "chroot %s %s /boot/grub/grub.cfg", MNT_RESTORING, editor); 1456 } else if (does_file_exist(MNT_RESTORING"/boot/grub2/grub.cfg")) { 1457 mr_asprintf(tmp, "chroot %s %s /boot/grub2/grub.cfg", MNT_RESTORING, editor); 1458 } 1459 paranoid_system(tmp); 1460 mr_free(tmp); 1461 1462 if (does_file_exist(MNT_RESTORING"/boot/grub/device.map")) { 1463 mr_asprintf(tmp, "chroot %s %s /boot/grub/device.map", MNT_RESTORING, editor); 1464 } else if (does_file_exist(MNT_RESTORING"/boot/grub2/device.map")) { 1465 mr_asprintf(tmp, "chroot %s %s /boot/grub2/device.map", MNT_RESTORING, editor); 1466 } 1467 paranoid_system(tmp); 1468 mr_free(tmp); 1469 1470 if (!g_text_mode) { 1471 newtResume(); 1472 } 1473 mr_asprintf(command, "stabgrub-me %s", boot_device); 1474 res = run_program_and_log_output(command, 1); 1475 mr_free(command); 1476 if (res) { 1477 popup_and_OK("GRUB installation failed. Please fix the conf files so that a manual install using 'grub-install' or similar command works. You are now chroot()'ed to your restored system. Please type 'exit' when you are done."); 1478 newtSuspend(); 1479 paranoid_system("chroot " MNT_RESTORING); 1480 newtResume(); 1481 popup_and_OK("Thank you."); 1482 } else { 1483 popup_and_OK("GRUB is now installed correctly"); 1482 1484 done = TRUE; 1483 1485 } … … 1879 1881 FILE *fout; 1880 1882 char *incoming = NULL; 1881 char *q;1882 char *q;1883 1883 1884 1884 assert_string_is_neither_NULL_nor_zerolength(output_file); -
branches/3.1/mondo/src/mondorestore/mondorestore.c
r3147 r3161 1230 1230 1231 1231 if (strcmp(outfile_fname, "/dev/null")) { 1232 chown(outfile_fname, biggiestruct.properties.st_uid, biggiestruct.properties.st_gid); 1232 if (chown(outfile_fname, biggiestruct.properties.st_uid, biggiestruct.properties.st_gid)) { 1233 // FIXME 1234 } 1233 1235 chmod(outfile_fname, biggiestruct.properties.st_mode); 1234 1236 ubuf->actime = biggiestruct.properties.st_atime; … … 1475 1477 if (strcmp(outfile_fname, "/dev/null")) { 1476 1478 chmod(outfile_fname, biggiestruct.properties.st_mode); 1477 chown(outfile_fname, biggiestruct.properties.st_uid, biggiestruct.properties.st_gid); 1479 if (chown(outfile_fname, biggiestruct.properties.st_uid, biggiestruct.properties.st_gid)) { 1480 // FIXME 1481 } 1478 1482 ubuf->actime = biggiestruct.properties.st_atime; 1479 1483 ubuf->modtime = biggiestruct.properties.st_mtime;
Note:
See TracChangeset
for help on using the changeset viewer.