Changeset 1592 in MondoRescue for branches/stable/mondo/src/common
- Timestamp:
- Aug 9, 2007, 3:19:05 PM (17 years ago)
- Location:
- branches/stable/mondo/src/common
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/common/libmondo-archive.c
r1581 r1592 20 20 #include "mondostructures.h" 21 21 22 #include "mr_conf.h"23 22 #include "mr_mem.h" 24 23 #include "mr_msg.h" … … 41 40 42 41 #define DVDRWFORMAT 1 43 44 extern struct mr_ar_conf *mr_conf;45 42 46 43 #ifndef __FreeBSD__ … … 1659 1656 } else { 1660 1657 log_to_screen("%s...OK", message_to_screen); 1661 sprintf(tmp, "tail -n10 %s | grep -F ':-('", MONDO_LOGFILE);1658 mr_asprintf(&tmp, "tail -n10 %s | grep -F ':-('", MONDO_LOGFILE); 1662 1659 if (!run_program_and_log_output(tmp, 1)) { 1663 1660 log_to_screen 1664 1661 ("Despite nonfatal errors, growisofs confirms the write was successful."); 1665 1662 } 1663 mr_free(tmp); 1666 1664 } 1667 1665 retval += res; … … 1738 1736 mr_free(message_to_screen); 1739 1737 } else { 1740 mr_asprintf(&message_to_screen, "Running %s to make %s #%d", 1741 mr_conf->iso_creation_cmd, 1742 bkpinfo->backup_media_string, 1743 g_current_media_number); 1744 mr_msg(1, message_to_screen); 1745 mr_asprintf(&result_sz, "Call to %s to make ISO (%s #%d) ", 1746 mr_conf->iso_creation_cmd, 1747 bkpinfo->backup_media_string, 1748 g_current_media_number); 1749 if (bkpinfo->nonbootable_backup) { 1750 mr_msg(1, "Making nonbootable backup"); 1751 res = eval_call_to_make_ISO(bkpinfo, 1752 "mkisofs -o '_ISO_' -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", 1753 destfile, g_current_media_number, 1754 MONDO_LOGFILE, message_to_screen); 1755 } else { 1756 mr_msg(1, "Making bootable backup"); 1757 1758 #ifdef __FreeBSD__ 1759 bkpinfo->make_cd_use_lilo = TRUE; 1760 #endif 1761 1762 1763 mr_msg(1, "make_cd_use_lilo is actually %d", 1764 bkpinfo->make_cd_use_lilo); 1765 if (bkpinfo->make_cd_use_lilo) { 1766 mr_msg(1, "make_cd_use_lilo = TRUE"); 1767 // FIXME --- change mkisofs string to MONDO_MKISOFS_REGULAR_SYSLINUX/LILO depending on bkpinfo->make_cd_usE_lilo 1768 // and add ' .' at end 1769 #ifdef __IA64__ 1770 mr_msg(1, "IA64 --> elilo"); 1771 res = eval_call_to_make_ISO(bkpinfo, 1772 //-b images/mindi-boot.2880.img 1773 "mkisofs -no-emul-boot -b images/mindi-bootroot." 1774 IA64_BOOT_SIZE 1775 ".img -c boot.cat -o '_ISO_' -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", 1776 destfile, 1777 g_current_media_number, 1778 MONDO_LOGFILE, 1779 message_to_screen); 1780 #else 1781 // FIXME --- change mkisofs string to MONDO_MKISOFS_REGULAR_SYSLINUX/LILO depending on bkpinfo->make_cd_usE_lilo 1782 // and add ' .' at end 1783 mr_msg(1, "Non-ia64 --> lilo"); 1784 res = eval_call_to_make_ISO(bkpinfo, 1785 "mkisofs -b images/mindi-bootroot.2880.img -c boot.cat -o '_ISO_' -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", 1786 destfile, 1787 g_current_media_number, 1788 MONDO_LOGFILE, 1789 message_to_screen); 1790 #endif 1791 } else { 1792 mr_msg(1, "make_cd_use_lilo = FALSE"); 1793 mr_msg(1, "Isolinux"); 1794 res = eval_call_to_make_ISO(bkpinfo, 1795 "mkisofs -no-emul-boot -b isolinux.bin -boot-load-size 4 -boot-info-table -c boot.cat -o '_ISO_' -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", 1796 destfile, 1797 g_current_media_number, 1798 MONDO_LOGFILE, 1799 message_to_screen); 1800 } 1801 } 1802 mr_free(message_to_screen); 1803 if (res) { 1804 log_to_screen("%s...failed", result_sz); 1805 } else { 1806 log_to_screen("%s...OK", result_sz); 1807 } 1808 retval += res; 1809 mr_free(result_sz); 1738 fatal_error("call_make_iso undefined. Not normal in this case"); 1810 1739 } 1811 1740 … … 1820 1749 mr_free(tmp); 1821 1750 } 1822 }1823 1824 if (bkpinfo->call_burn_iso[0] != '\0') {1825 mr_msg(2, "bkpinfo->call_burn_iso = %s", bkpinfo->call_burn_iso);1826 mr_asprintf(&message_to_screen, "Burning %s #%d",1827 bkpinfo->backup_media_string,1828 g_current_media_number);1829 pause_and_ask_for_cdr(2, &cd_is_mountable);1830 res = eval_call_to_make_ISO(bkpinfo, bkpinfo->call_burn_iso,1831 destfile, g_current_media_number,1832 MONDO_LOGFILE, message_to_screen);1833 if (res) {1834 log_to_screen("%s...failed", message_to_screen);1835 } else {1836 log_to_screen("%s...OK", message_to_screen);1837 }1838 mr_free(message_to_screen);1839 retval += res;1840 1751 } 1841 1752 -
branches/stable/mondo/src/common/libmondo-fork.c
r1548 r1592 100 100 101 101 /*@ buffers *** */ 102 char *midway_call, *ultimate_call, *tmp; 102 char *ultimate_call; 103 char *midway_call; 103 104 char *p = NULL; 104 105 char *cd_number_str = NULL; … … 115 116 assert_string_is_neither_NULL_nor_zerolength(logstub); 116 117 118 ultimate_call = mr_malloc(1200); 117 119 midway_call = mr_malloc(1200); 118 ultimate_call = mr_malloc(1200);119 tmp = mr_malloc(1200);120 120 121 121 mr_asprintf(&cd_number_str, "%d", cd_no); 122 122 resolve_naff_tokens(midway_call, basic_call, isofile, "_ISO_"); 123 resolve_naff_tokens( tmp, midway_call, cd_number_str, "_CD#_");123 resolve_naff_tokens(ultimate_call, midway_call, cd_number_str, "_CD#_"); 124 124 mr_free(cd_number_str); 125 125 126 resolve_naff_tokens(ultimate_call, tmp, MONDO_LOGFILE, "_ERR_");127 126 mr_msg(4, "basic call = '%s'", basic_call); 128 mr_msg(4, "midway_call = '%s'", midway_call); 129 mr_msg(4, "tmp = '%s'", tmp); 127 mr_msg(4, "midway call = '%s'", midway_call); 130 128 mr_msg(4, "ultimate call = '%s'", ultimate_call); 131 129 mr_asprintf(&command, "%s >> %s", ultimate_call, MONDO_LOGFILE); … … 157 155 popup_and_OK(_("Press ENTER to continue.")); 158 156 popup_and_OK 159 (_(" mkisofs and/or cdrecord returned an error. CD was not created"));157 (_("CD was not created due to an error.")); 160 158 } 161 159 } … … 172 170 mr_free(midway_call); 173 171 mr_free(ultimate_call); 174 mr_free(tmp);175 172 return (retval); 176 173 } -
branches/stable/mondo/src/common/libmondo-tools.c
r1549 r1592 13 13 #include "mr_file.h" 14 14 #include "mr_gettext.h" 15 #include "mr_conf.h" 15 16 16 17 #include "mondostructures.h" … … 36 37 extern int g_current_media_number; 37 38 extern char *MONDO_LOGFILE; 39 40 extern struct mr_ar_conf *mr_conf; 38 41 39 42 /** … … 359 362 long avm = 0; 360 363 char *colon = NULL; 361 char *cdr_exe = NULL;362 364 char *tmp = NULL; 363 365 char *call_before_iso_user = NULL; … … 450 452 } 451 453 452 // DVD 453 454 if (bkpinfo->backup_media_type == dvd) { 455 if (find_home_of_exe("growisofs")) { 456 mr_asprintf(&cdr_exe, "growisofs"); 457 } else { 458 fatal_error("Please install growisofs."); 454 // CD-R or CD-RW or DVD 455 if (bkpinfo->backup_media_type == cdrw 456 || bkpinfo->backup_media_type == dvd 457 || bkpinfo->backup_media_type == iso 458 || bkpinfo->backup_media_type == nfs 459 || bkpinfo->backup_media_type == cdr) { 460 if (!bkpinfo->manual_cd_tray) { 461 mr_strcat(extra_cdrom_params, "-waiti "); 462 } 463 if (bkpinfo->backup_media_type == cdrw) { 464 mr_strcat(extra_cdrom_params, "blank=fast "); 459 465 } 460 466 if (bkpinfo->nonbootable_backup) { 461 mr_asprintf(&mondo_mkisofs_sz, MONDO_GROWISOFS_NONBOOT);467 mr_asprintf(&mondo_mkisofs_sz, "%s -no-boot", mr_conf->iso_creation_opt); 462 468 } else if 463 469 #ifdef __FreeBSD__ … … 468 474 #ifdef __IA64__ 469 475 { 470 mr_asprintf(&mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_ELILO);476 mr_asprintf(&mondo_mkisofs_sz, "%s -b images/mindi-boot.2880.img -c boot.cat", mr_conf->iso_creation_opt); 471 477 } 472 478 #else 473 479 { 474 mr_asprintf(&mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_LILO); 475 } 476 #endif 477 else 478 { 479 mr_asprintf(&mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_SYSLINUX); 480 mr_asprintf(&mondo_mkisofs_sz, "%s -b isolinux.bin -c boot.cat", mr_conf->iso_creation_opt); 481 } 482 #endif 483 else { 484 mr_asprintf(&mondo_mkisofs_sz, "%s -b isolinux.bin -c boot.cat", mr_conf->iso_creation_opt); 480 485 } 481 486 if (bkpinfo->manual_cd_tray) { 482 fatal_error("Manual CD tray + DVD not supported yet."); 483 // -m isn't supported by growisofs, BTW... 484 } else { 485 sprintf(bkpinfo->call_make_iso, 486 "%s %s -Z %s . 2>> _ERR_", 487 mondo_mkisofs_sz, "", bkpinfo->media_device); 488 } 489 mr_free(mondo_mkisofs_sz); 490 491 if (getenv ("SUDO_COMMAND")) { 492 mr_asprintf(&command, "strings `which growisofs` | grep -c SUDO_COMMAND"); 493 if (!strcmp(call_program_and_get_last_line_of_output(command), "1")) { 494 popup_and_OK("Fatal Error: Can't write DVDs as sudo because growisofs doesn't support this - see the growisofs manpage for details."); 495 fatal_error("Can't write DVDs as sudo because growisofs doesn't support this - see the growisofs manpage for details."); 487 if (strstr(mr_conf->mondo_iso_burning_cmd,"growisofs") == NULL) { 488 fatal_error("Unable to use manual CD tray with growisofs"); 496 489 } 497 mr_free(command);498 }499 mr_msg(2, "call_make_iso (DVD res) is ... %s",500 bkpinfo->call_make_iso);501 } // end of DVD code502 503 // CD-R or CD-RW504 if (bkpinfo->backup_media_type == cdrw505 || bkpinfo->backup_media_type == cdr) {506 if (!bkpinfo->manual_cd_tray) {507 mr_strcat(extra_cdrom_params, "-waiti ");508 }509 if (bkpinfo->backup_media_type == cdrw) {510 mr_strcat(extra_cdrom_params, "blank=fast ");511 }512 if (find_home_of_exe("cdrecord")) {513 mr_asprintf(&cdr_exe, "cdrecord");514 } else if (find_home_of_exe("dvdrecord")) {515 mr_asprintf(&cdr_exe, "dvdrecord");516 } else {517 fatal_error("Please install either cdrecord or dvdrecord.");518 }519 if (bkpinfo->nonbootable_backup) {520 mr_asprintf(&mondo_mkisofs_sz, MONDO_MKISOFS_NONBOOT);521 } else if522 #ifdef __FreeBSD__523 (TRUE)524 #else525 (bkpinfo->make_cd_use_lilo)526 #endif527 #ifdef __IA64__528 {529 mr_asprintf(&mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_ELILO);530 }531 #else532 {533 mr_asprintf(&mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_LILO);534 }535 #endif536 else537 {538 mr_asprintf(&mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_SYSLINUX);539 }540 if (bkpinfo->manual_cd_tray) {541 490 if (bkpinfo->call_before_iso[0] == '\0') { 542 sprintf(bkpinfo->call_before_iso,543 "%s -o %s/temporary.iso . 2>> _ERR_",544 m ondo_mkisofs_sz, bkpinfo->tmpdir);491 sprintf(bkpinfo->call_before_iso, 492 "%s %s -o %s/temporary.iso . 2>> %s", 493 mr_conf->iso_creation_cmd,mondo_mkisofs_sz, bkpinfo->tmpdir, MONDO_LOGFILE); 545 494 } else { 546 495 mr_asprintf(&call_before_iso_user, bkpinfo->call_before_iso); 547 496 sprintf (bkpinfo->call_before_iso, 548 "( %s -o %s/temporary.iso . 2>> _ERR_; %s )",549 m ondo_mkisofs_sz, bkpinfo->tmpdir, call_before_iso_user);497 "(%s %s -o %s/temporary.iso . 2>> %s ; %s )", 498 mr_conf->iso_creation_cmd,mondo_mkisofs_sz, bkpinfo->tmpdir, MONDO_LOGFILE, call_before_iso_user); 550 499 mr_free(call_before_iso_user); 551 500 } 552 501 log_it("bkpinfo->call_before_iso = %s", bkpinfo->call_before_iso); 553 502 sprintf(bkpinfo->call_make_iso, 554 "%s %s -v %s fs=4m dev=%s speed=%d %s/temporary.iso", 555 cdr_exe, (bkpinfo->please_dont_eject) ? " " : "-eject", 556 extra_cdrom_params, bkpinfo->media_device, 557 bkpinfo->cdrw_speed, bkpinfo->tmpdir); 503 "%s %s %s dev=%s speed=%d %s/temporary.iso", 504 mr_conf->mondo_iso_burning_cmd, 505 extra_cdrom_params, 506 mr_conf->mondo_iso_burning_opt, 507 bkpinfo->media_device, 508 bkpinfo->cdrw_speed, 509 bkpinfo->tmpdir); 558 510 } else { 559 sprintf(bkpinfo->call_make_iso, 560 "%s . 2>> _ERR_ | %s %s %s fs=4m dev=%s speed=%d -", 561 mondo_mkisofs_sz, cdr_exe, 562 (bkpinfo->please_dont_eject) ? " " : "-eject", 563 extra_cdrom_params, bkpinfo->media_device, 511 if (strstr(mr_conf->mondo_iso_burning_cmd,"growisofs") == NULL) { 512 if (getenv ("SUDO_COMMAND")) { 513 mr_asprintf(&command, "strings `which growisofs` | grep -c SUDO_COMMAND"); 514 if (!strcmp(call_program_and_get_last_line_of_output(command), "1")) { 515 fatal_error("Can't write DVDs as sudo because growisofs doesn't support this - see the growisofs manpage for details."); 516 } 517 mr_free(command); 518 } 519 sprintf(bkpinfo->call_make_iso, 520 "%s %s %s %s -Z %s -speed=%d . 2>> %s", 521 mr_conf->mondo_iso_burning_cmd, 522 mondo_mkisofs_sz, 523 extra_cdrom_params, 524 mr_conf->mondo_iso_burning_opt, 525 bkpinfo->media_device, 526 bkpinfo->cdrw_speed, 527 MONDO_LOGFILE); 528 } else { 529 sprintf(bkpinfo->call_make_iso, 530 "%s %s . 2>> %s | %s %s %s dev=%s speed=%d -", 531 mr_conf->iso_creation_cmd, 532 mondo_mkisofs_sz, 533 MONDO_LOGFILE, 534 mr_conf->mondo_iso_burning_cmd, 535 extra_cdrom_params, 536 mr_conf->mondo_iso_burning_opt, 537 bkpinfo->media_device, 564 538 bkpinfo->cdrw_speed); 539 } 565 540 } 566 541 mr_free(mondo_mkisofs_sz); 567 mr_free(cdr_exe);568 542 mr_free(extra_cdrom_params); 569 543 } // end of CD code … … 651 625 fprintf(stderr, "Type 'man mondoarchive' for help.\n"); 652 626 } 653 mr_asprintf(&tmp, "%s", MONDO_TMPISOS);654 if (does_file_exist(tmp)) {655 unlink(tmp);656 }657 mr_free(tmp);658 627 659 628 if (strlen(bkpinfo->tmpdir) < 2 || strlen(bkpinfo->scratchdir) < 2) { … … 755 724 bkpinfo->call_before_iso[0] = '\0'; 756 725 bkpinfo->call_make_iso[0] = '\0'; 757 bkpinfo->call_burn_iso[0] = '\0';758 726 bkpinfo->call_after_iso[0] = '\0'; 759 727 bkpinfo->image_devs[0] = '\0'; … … 810 778 * - make sure user has enough free space in @c / 811 779 * - check kernel for ramdisk support 812 * - make sure afio, cdrecord, mkisofs,bzip2, awk, md5sum, strings, mindi, and buffer exist780 * - make sure afio, cdrecord, bzip2, awk, md5sum, strings, mindi, and buffer exist 813 781 * - make sure CD-ROM is unmounted 814 782 * - make sure /etc/modules.conf exists … … 880 848 } 881 849 #endif 850 retval += whine_if_not_found(mr_conf->mr_iso_creation_cmd); 851 retval += whine_if_not_found(mr_conf->mondo_iso_burning_cmd); 882 852 retval += whine_if_not_found(MKE2FS_OR_NEWFS); 883 retval += whine_if_not_found("mkisofs");884 if (system("which dvdrecord > /dev/null 2> /dev/null")) {885 retval += whine_if_not_found("cdrecord");886 }887 853 retval += whine_if_not_found("bzip2"); 888 854 retval += whine_if_not_found("gzip"); -
branches/stable/mondo/src/common/mondostructures.h
r1365 r1592 512 512 */ 513 513 char call_make_iso[MAX_STR_LEN]; 514 515 /**516 * A command to call to burn the ISO image.517 */518 char call_burn_iso[MAX_STR_LEN];519 514 520 515 /**
Note:
See TracChangeset
for help on using the changeset viewer.