Changeset 2316 in MondoRescue for branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c
- Timestamp:
- Aug 18, 2009, 2:34:29 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c
r2296 r2316 42 42 */ 43 43 extern char *g_isodir_device; 44 extern char *g_isodir_format;45 44 extern long g_current_progress, g_maximum_progress; 46 45 extern char *g_biggielist_txt; // where 'biggielist.txt' is stored, on ramdisk / tempdir; … … 96 95 */ 97 96 paranoid_free(g_isodir_device); 98 paranoid_free(g_isodir_format);99 97 100 98 } … … 264 262 int retval = 0, i; 265 263 bool already_mounted = FALSE; 264 char *isodir_format = NULL; 266 265 267 266 assert(bkpinfo != NULL); … … 281 280 } 282 281 283 if (!get_isodir_info(g_isodir_device, g_isodir_format, bkpinfo->isodir, nuke_me_please)) { 282 if (!get_isodir_info(g_isodir_device, isodir_format, bkpinfo->isodir, nuke_me_please)) { 283 mr_free(isodir_format); 284 284 return (1); 285 285 } … … 291 291 } else { 292 292 mr_asprintf(&mount_isodir_command, "mount %s", g_isodir_device); 293 if (strlen(g_isodir_format) > 1) { 294 mr_strcat(mount_isodir_command, " -t %s", g_isodir_format); 295 } 293 if (isodir_format) { 294 mr_strcat(mount_isodir_command, " -t %s", isodir_format); 295 } 296 296 297 mr_strcat(mount_isodir_command, " -o ro %s", bkpinfo->isodir); 297 298 run_program_and_log_output("df -m", FALSE); … … 308 309 ("I have mounted the device where the ISO files are stored."); 309 310 } 311 mr_free(isodir_format); 312 310 313 if (!IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 311 314 mount_media(); … … 1426 1429 /** malloc **/ 1427 1430 char *command = NULL; 1428 char *boot_device ;1431 char *boot_device = NULL; 1429 1432 char *rootdev; 1430 1433 char *rootdrive; … … 1432 1435 char *tmp = NULL; 1433 1436 char *editor; 1434 1435 int res; 1436 int done;1437 1438 malloc_string(boot_device); 1437 char *p = NULL; 1438 1439 int res = 0; 1440 bool done; 1441 1439 1442 malloc_string(editor); 1440 1443 malloc_string(rootdev); … … 1443 1446 assert_string_is_neither_NULL_nor_zerolength(bd); 1444 1447 strcpy(editor, find_my_editor()); 1445 strcpy(boot_device, bd);1448 mr_asprintf(&boot_device, "%s", bd); 1446 1449 1447 1450 if (offer_to_run_stabgrub 1448 && ask_me_yes_or_no("Did you change the mountlist or cloned the system ?")) 1451 && ask_me_yes_or_no("Did you change the mountlist or cloned the system ?")) { 1449 1452 /* interactive mode */ 1450 {1451 1453 mvaddstr_and_log_it(g_currentY, 1452 1454 0, 1453 1455 "Modifying fstab, mtab, device.map and menu.lst, and running GRUB... "); 1454 1456 for (done = FALSE; !done;) { 1455 popup_and_get_string("Boot device", 1456 "Please confirm/enter the boot device. If in doubt, try /dev/hda", 1457 boot_device, MAX_STR_LEN / 4); 1458 mr_asprintf(&command, "stabgrub-me %s", boot_device); 1457 p = popup_and_get_string("Boot device", "Please confirm/enter the boot device. If in doubt, try /dev/hda", boot_device); 1458 if (p == NULL) { 1459 done = TRUE; 1460 mr_free(p); 1461 /* we want some warnings later on */ 1462 res = 1; 1463 continue; 1464 } 1465 mr_asprintf(&command, "stabgrub-me %s", p); 1466 mr_free(p); 1467 1459 1468 res = run_program_and_log_output(command, 1); 1460 1469 mr_free(command); … … 1494 1503 } 1495 1504 } 1496 } else 1505 } else { 1497 1506 /* nuke mode */ 1498 {1499 1507 if (!run_program_and_log_output("which grub-MR", FALSE)) { 1500 1508 log_msg(1, "Yay! grub-MR found..."); … … 1521 1529 } 1522 1530 } 1531 mr_free(boot_device); 1532 1523 1533 if (res) { 1524 1534 mvaddstr_and_log_it(g_currentY++, 74, "Failed."); … … 1540 1550 paranoid_free(rootdrive); 1541 1551 paranoid_free(conffile); 1542 paranoid_free(boot_device);1543 1552 paranoid_free(editor); 1544 1553 … … 1744 1753 /** malloc **/ 1745 1754 char *command = NULL; 1746 char *boot_device ;1755 char *boot_device = NULL; 1747 1756 char *tmp = NULL; 1748 1757 char *editor; 1758 char *p = NULL; 1749 1759 int res; 1750 1760 int done; 1751 1761 1752 malloc_string(boot_device);1753 1762 malloc_string(editor); 1754 1763 assert_string_is_neither_NULL_nor_zerolength(bd); 1755 1764 1756 1765 strcpy(editor, find_my_editor()); 1757 strcpy(boot_device, bd);1766 mr_asprintf(&boot_device, "%s", bd); 1758 1767 1759 1768 if (offer_to_hack_scripts 1760 && ask_me_yes_or_no("Did you change the mountlist or cloned the system ?")) 1769 && ask_me_yes_or_no("Did you change the mountlist or cloned the system ?")) { 1761 1770 /* interactive mode */ 1762 {1763 1771 mvaddstr_and_log_it(g_currentY, 0, 1764 1772 "Modifying fstab and restoring MBR... "); … … 1776 1784 } 1777 1785 } 1778 popup_and_get_string("Boot device", 1779 "Please confirm/enter the boot device. If in doubt, try /dev/hda", 1780 boot_device, MAX_STR_LEN / 4); 1781 mr_asprintf(&command, "stabraw-me %s", boot_device); 1786 p = popup_and_get_string("Boot device", "Please confirm/enter the boot device. If in doubt, try /dev/hda", boot_device); 1787 if (p == NULL) { 1788 done = TRUE; 1789 mr_free(p); 1790 /* we want some warnings later on */ 1791 res = 1; 1792 continue; 1793 } 1794 mr_asprintf(&command, "stabraw-me %s", p); 1795 mr_free(p); 1796 1782 1797 res = run_program_and_log_output(command, 3); 1783 1798 mr_free(command); … … 1789 1804 } 1790 1805 } 1791 } else 1806 } else { 1792 1807 /* nuke mode */ 1793 {1794 1808 mr_asprintf(&command, "raw-MR %s /tmp/mountlist.txt", boot_device); 1795 1809 log_msg(2, "run_raw_mbr() --- command='%s'", command); … … 1800 1814 mr_free(command); 1801 1815 } 1816 mr_free(boot_device); 1802 1817 1803 1818 if (res) { … … 1808 1823 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 1809 1824 } 1810 paranoid_free(boot_device);1811 1825 paranoid_free(editor); 1812 1826 return (res); … … 1839 1853 malloc_string(g_mondo_home); 1840 1854 malloc_string(g_isodir_device); 1841 malloc_string(g_isodir_format);1842 1855 1843 1856 temppath = bkpinfo->tmpdir;
Note:
See TracChangeset
for help on using the changeset viewer.