Changeset 2338 in MondoRescue for branches/2.2.10/mondo
- Timestamp:
- Aug 21, 2009, 1:47:12 AM (15 years ago)
- Location:
- branches/2.2.10/mondo/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-archive.c
r2334 r2338 509 509 char *use_lzo_sz = NULL; 510 510 char *use_gzip_sz = NULL; 511 char *use_lzma_sz = NULL; 511 512 char *use_comp_sz = NULL; 512 513 char *use_star_sz = NULL; … … 544 545 } 545 546 546 mvaddstr_and_log_it(g_currentY, 0, 547 "Calling MINDI to create boot+data disks"); 547 mvaddstr_and_log_it(g_currentY, 0, "Calling MINDI to create boot+data disks"); 548 548 mr_asprintf(tmp, "%s/filelist.full", bkpinfo->tmpdir); 549 549 if (!does_file_exist(tmp)) { … … 594 594 } else { 595 595 mr_asprintf(use_gzip_sz, "no"); 596 } 597 if (bkpinfo->use_lzma) { 598 mr_asprintf(use_lzma_sz, "yes"); 599 } else { 600 mr_asprintf(use_lzma_sz, "no"); 596 601 } 597 602 if (bkpinfo->use_star) { … … 835 840 11=\"%s\" 12=%s 13=%ld 14=\"%s\" 15=\"%s\" 16=\"%s\" 17=\"%s\" 18=%ld 19=%d",*/ 836 841 mr_asprintf(command, "mindi %s --custom %s %s/images '%s' '%s' '%s' %ld '%s' '%s' '%s' \ 837 '%s' %s %ld '%s' '%s' '%s' '%s' %ld %d '%s'", tmp2, bkpinfo->tmpdir, // parameter #2 842 '%s' %s %ld '%s' '%s' '%s' '%s' %ld %d '%s' >> %s", 843 tmp2, // parameter #1 844 bkpinfo->tmpdir, // parameter #2 838 845 bkpinfo->scratchdir, // parameter #3 839 846 bkpinfo->kernel_path, // parameter #4 … … 843 850 use_lzo_sz, // parameter #8 844 851 cd_recovery_sz, // parameter #9 845 bkpinfo->image_devs, // parameter #10852 (bkpinfo->image_devs == NULL) ? "\"\"" : bkpinfo->image_devs, // parameter #10 846 853 broken_bios_sz, // parameter #11 847 854 last_filelist_number, // parameter #12 (STRING) … … 853 860 bkpinfo->internal_tape_block_size, // parameter #18 (LONG) 854 861 bkpinfo->differential, // parameter #19 (INT) 855 use_gzip_sz); // parameter #20 (STRING) 862 use_gzip_sz, // parameter #20 (STRING) 863 use_lzma_sz, // parameter #21 (STRING) 864 MONDO_LOGFILE); 856 865 857 866 mr_free(tmp2); … … 861 870 mr_free(use_lzo_sz); 862 871 mr_free(use_gzip_sz); 872 mr_free(use_lzma_sz); 863 873 mr_free(use_star_sz); 864 874 mr_free(use_comp_sz); … … 868 878 mr_free(tape_size_sz); 869 879 880 /* This parameter is always the last one and optional */ 870 881 if (bkpinfo->nonbootable_backup) { 871 882 mr_strcat(command, " NONBOOTABLE"); … … 875 886 // popup_and_OK("Pausing"); 876 887 877 res = run_ program_and_log_to_screen(command, "Generating boot+data disks");888 res = run_external_binary_with_percentage_indicator_NEW("Generating boot+data disks", command); 878 889 paranoid_free(command); 879 890 … … 1667 1678 if (bkpinfo->call_before_iso) { 1668 1679 mr_asprintf(message_to_screen, "Running pre-ISO call for CD#%d", g_current_media_number); 1669 res = eval_call_to_make_ISO(bkpinfo->call_before_iso, destfile, g_current_media_number, MONDO_LOGFILE,message_to_screen);1680 res = eval_call_to_make_ISO(bkpinfo->call_before_iso, destfile, g_current_media_number, message_to_screen); 1670 1681 if (res) { 1671 1682 mr_strcat(message_to_screen, "...failed"); … … 1691 1702 } else { 1692 1703 res = 1693 eval_call_to_make_ISO(bkpinfo->call_make_iso, bkpinfo->scratchdir, g_current_media_number, MONDO_LOGFILE,message_to_screen);1704 eval_call_to_make_ISO(bkpinfo->call_make_iso, bkpinfo->scratchdir, g_current_media_number, message_to_screen); 1694 1705 if (res) { 1695 1706 log_to_screen("%s...failed to write", message_to_screen); … … 1729 1740 res = run_external_binary_with_percentage_indicator_NEW("Blanking DVD disk", sz_blank_disk); 1730 1741 if (res) { 1731 log_to_screen 1732 ("Warning - format failed. (Was it a DVD-R?) Sleeping for 5 seconds to take a breath..."); 1733 pause_for_N_seconds(5, 1734 "Letting DVD drive settle... and trying again."); 1735 res = 1736 run_external_binary_with_percentage_indicator_NEW 1737 ("Blanking DVD disk", sz_blank_disk); 1742 log_to_screen("Warning - format failed. (Was it a DVD-R?) Sleeping for 5 seconds to take a breath..."); 1743 pause_for_N_seconds(5, "Letting DVD drive settle... and trying again."); 1744 res = run_external_binary_with_percentage_indicator_NEW("Blanking DVD disk", sz_blank_disk); 1738 1745 if (res) { 1739 1746 log_to_screen("Format failed a second time."); … … 1751 1758 } 1752 1759 pause_for_N_seconds(5, "Letting DVD drive settle"); 1753 res = eval_call_to_make_ISO(bkpinfo->call_make_iso, bkpinfo->scratchdir, g_current_media_number, MONDO_LOGFILE,message_to_screen);1760 res = eval_call_to_make_ISO(bkpinfo->call_make_iso, bkpinfo->scratchdir, g_current_media_number, message_to_screen); 1754 1761 retval += res; 1755 1762 if (!bkpinfo->please_dont_eject) { … … 1780 1787 log_msg(1, "Making nonbootable backup"); 1781 1788 // FIXME --- change mkisofs string to MONDO_MKISOFS_NONBOOTABLE and add ' .' at end 1782 res = 1783 eval_call_to_make_ISO("mkisofs -o '_ISO_' -r -p MondoRescue -publisher www.mondorescue.org -A MondoRescue_GPL -V _CD#_ .", 1784 destfile, g_current_media_number, 1785 MONDO_LOGFILE, message_to_screen); 1789 res = eval_call_to_make_ISO("mkisofs -o '_ISO_' -r -p MondoRescue -publisher www.mondorescue.org -A MondoRescue_GPL -V _CD#_ .", destfile, g_current_media_number, message_to_screen); 1786 1790 } else { 1787 1791 log_msg(1, "Making bootable backup"); … … 1800 1804 #ifdef __IA64__ 1801 1805 log_msg(1, "IA64 --> elilo"); 1802 res = eval_call_to_make_ISO("mkisofs -no-emul-boot -b images/mindi-bootroot." 1803 IA64_BOOT_SIZE 1804 ".img -c boot.cat -o '_ISO_' -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", 1805 destfile, 1806 g_current_media_number, 1807 MONDO_LOGFILE, 1808 message_to_screen); 1806 res = eval_call_to_make_ISO("mkisofs -no-emul-boot -b images/mindi-bootroot." IA64_BOOT_SIZE ".img -c boot.cat -o '_ISO_' -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", destfile, g_current_media_number, message_to_screen); 1809 1807 #else 1810 1808 // FIXME --- change mkisofs string to MONDO_MKISOFS_REGULAR_SYSLINUX/LILO depending on bkpinfo->make_cd_usE_lilo … … 1812 1810 log_msg(1, "Non-ia64 --> lilo"); 1813 1811 res = 1814 eval_call_to_make_ISO("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#_ .", 1815 destfile, g_current_media_number, 1816 MONDO_LOGFILE, 1817 message_to_screen); 1812 eval_call_to_make_ISO("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#_ .", destfile, g_current_media_number, message_to_screen); 1818 1813 #endif 1819 1814 } else { 1820 1815 log_msg(1, "make_cd_use_lilo = FALSE"); 1821 1816 log_msg(1, "Isolinux"); 1822 res = 1823 eval_call_to_make_ISO("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#_ .", 1824 destfile, g_current_media_number, 1825 MONDO_LOGFILE, 1826 message_to_screen); 1817 res = eval_call_to_make_ISO("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#_ .", destfile, g_current_media_number, message_to_screen); 1827 1818 } 1828 1819 } … … 1855 1846 mr_free(mds); 1856 1847 pause_and_ask_for_cdr(2, &cd_is_mountable); 1857 res = eval_call_to_make_ISO(bkpinfo->call_burn_iso, destfile, g_current_media_number, MONDO_LOGFILE,message_to_screen);1848 res = eval_call_to_make_ISO(bkpinfo->call_burn_iso, destfile, g_current_media_number, message_to_screen); 1858 1849 if (res) { 1859 1850 mr_strcat(message_to_screen, "...failed"); … … 1871 1862 mr_asprintf(message_to_screen, "Running post-ISO call (%s #%d)", mds, g_current_media_number); 1872 1863 mr_free(mds); 1873 res = eval_call_to_make_ISO(bkpinfo->call_after_iso, destfile, g_current_media_number, MONDO_LOGFILE,message_to_screen);1864 res = eval_call_to_make_ISO(bkpinfo->call_after_iso, destfile, g_current_media_number, message_to_screen); 1874 1865 if (res) { 1875 1866 mr_strcat(message_to_screen, "...failed"); … … 2013 2004 && is_dev_an_NTFS_dev(bigfile_fname)) { 2014 2005 use_ntfsprog = TRUE; 2015 log_msg(2, 2016 "Calling ntfsclone in background because %s is an NTFS partition", 2017 bigfile_fname); 2006 log_msg(2, "Calling ntfsclone in background because %s is an NTFS partition", bigfile_fname); 2018 2007 mr_asprintf(sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, (int) (random() % 32768), (int) (random() % 32768)); 2019 2008 mkfifo(sz_devfile, 0x770); … … 2024 2013 fatal_error("Fork failure"); 2025 2014 case 0: 2026 log_msg(2, 2027 "CHILD - fip - calling feed_into_ntfsprog(%s, %s)", 2028 bigfile_fname, sz_devfile); 2015 log_msg(2, "CHILD - fip - calling feed_into_ntfsprog(%s, %s)", bigfile_fname, sz_devfile); 2029 2016 res = feed_into_ntfsprog(bigfile_fname, sz_devfile); 2030 /* BCO/BERLIOS Does the child need to unalocate memory as well ?2031 paranoid_free(bigfile_fname);2017 /* The child needs to unalocate memory as well */ 2018 mr_free(bigfile_fname); 2032 2019 mr_free(sz_devfile); 2033 */2034 2020 exit(res); 2035 2021 break; 2036 2022 default: 2037 log_msg(2, 2038 "feed_into_ntfsprog() called in background --- pid=%ld", 2039 (long int) (pid)); 2023 log_msg(2, "feed_into_ntfsprog() called in background --- pid=%ld", (long int) (pid)); 2040 2024 mr_free(sz_devfile); 2041 2025 } … … 2053 2037 BLK_START_A_NORMBIGGIE); 2054 2038 } 2055 res = 2056 slice_up_file_etc(bigfile_fname, 2057 ntfsprog_fifo, biggie_file_number, 2058 noof_biggie_files, use_ntfsprog); 2039 res = slice_up_file_etc(bigfile_fname, ntfsprog_fifo, biggie_file_number, noof_biggie_files, use_ntfsprog); 2059 2040 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 2060 write_header_block_to_stream((off_t)0, 2061 calc_checksum_of_file 2062 (bigfile_fname), 2063 BLK_STOP_A_BIGGIE); 2041 write_header_block_to_stream((off_t)0, calc_checksum_of_file(bigfile_fname), BLK_STOP_A_BIGGIE); 2064 2042 } 2065 2043 retval += res; … … 2820 2798 */ 2821 2799 int 2822 slice_up_file_etc(char *biggie_filename, 2823 char *ntfsprog_fifo, long biggie_file_number, 2824 long noof_biggie_files, bool use_ntfsprog) 2825 { 2800 slice_up_file_etc(char *biggie_filename, char *ntfsprog_fifo, long biggie_file_number, long noof_biggie_files, bool use_ntfsprog) { 2826 2801 2827 2802 /*@ buffers ************************************************** */ 2828 2803 char *tmp = NULL; 2829 2804 char *checksum_line = NULL; 2830 char *command ;2805 char *command = NULL; 2831 2806 char *tempblock; 2832 2807 char *curr_slice_fname_uncompressed = NULL; 2833 2808 char *curr_slice_fname_compressed = NULL; 2834 2809 char *file_to_archive = NULL; 2835 char *file_to_openin ;2810 char *file_to_openin = NULL; 2836 2811 /*@ pointers ************************************************** */ 2837 char *pB; 2838 FILE *fin = NULL, *fout = NULL; 2812 char *pB = NULL; 2813 FILE *fin = NULL; 2814 FILE *fout = NULL; 2839 2815 2840 2816 /*@ bool ****************************************************** */ … … 2842 2818 2843 2819 /*@ long ****************************************************** */ 2844 size_t blksize = 0; 2845 long slice_num = 0; 2846 long i; 2847 long optimal_set_size; 2848 bool should_I_compress_slices; 2820 size_t blksize = (size_t)0; 2821 long slice_num = 0L; 2822 long i = 0L; 2823 bool should_I_compress_slices = TRUE; 2849 2824 char *suffix = NULL; // for compressed slices 2850 2825 … … 2852 2827 off_t totalread = (off_t)0; 2853 2828 off_t totallength = (off_t)0; 2854 off_t length;2855 2829 2856 2830 /*@ int ******************************************************** */ … … 2860 2834 /*@ structures ************************************************** */ 2861 2835 struct s_filename_and_lstat_info biggiestruct; 2862 // struct stat statbuf;2863 2836 2864 2837 assert(bkpinfo != NULL); … … 2867 2840 biggiestruct.for_backward_compatibility = '\n'; 2868 2841 biggiestruct.use_ntfsprog = use_ntfsprog; 2869 optimal_set_size = bkpinfo->optimal_set_size;2870 2842 if (is_this_file_compressed(biggie_filename) || bkpinfo->compression_level == 0) { 2871 2843 mr_asprintf(suffix, "%s", ""); … … 2876 2848 } 2877 2849 2878 if ( optimal_set_size < 999) {2850 if (bkpinfo->optimal_set_size < 999L) { 2879 2851 fatal_error("bkpinfo->optimal_set_size is insanely small"); 2880 2852 } 2853 2881 2854 if (ntfsprog_fifo) { 2882 2855 file_to_openin = ntfsprog_fifo; … … 2896 2869 log_it("res of it = %s", tmp); 2897 2870 totallength = (off_t)atoll(tmp); 2898 paranoid_free(tmp);2871 mr_free(tmp); 2899 2872 } else { 2900 2873 file_to_openin = biggie_filename; … … 2930 2903 if (fout == NULL) { 2931 2904 log_msg(1, "Unable to open and write to %s\n", tmp); 2932 paranoid_free(tmp);2905 mr_free(tmp); 2933 2906 mr_free(suffix); 2934 2907 return (1); 2935 2908 } 2936 paranoid_free(tmp);2909 mr_free(tmp); 2937 2910 2938 2911 (void) fwrite((void *) &biggiestruct, 1, sizeof(biggiestruct), fout); 2939 if (fout) { 2940 paranoid_fclose(fout); 2941 } 2942 length = totallength / optimal_set_size / 1024; 2943 log_msg(1, "Opening in %s; slicing it and writing to CD/tape", 2944 file_to_openin); 2912 fclose(fout); 2913 2914 log_msg(1, "Opening in %s; slicing it and writing to CD/tape", file_to_openin); 2945 2915 if (!(fin = fopen(file_to_openin, "r"))) { 2946 2916 log_OS_error("Unable to openin biggie_filename"); … … 2960 2930 } 2961 2931 i = bkpinfo->optimal_set_size / 256; 2962 if (!(tempblock = (char *) malloc(256 * 1024))) {2963 fatal_error("malloc error 256*1024");2964 }2965 2932 for (slice_num = 1; !finished; slice_num++) { 2966 2933 mr_asprintf(curr_slice_fname_uncompressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, "")); … … 2977 2944 return (1); 2978 2945 } 2979 if ((i == bkpinfo->optimal_set_size / 256) 2980 && (totalread < 1.1 * totallength)) {2981 for (i = 0 ; i < bkpinfo->optimal_set_size / 256; i++) {2946 if ((i == bkpinfo->optimal_set_size / 256) && (totalread < 1.1 * totallength)) { 2947 tempblock = mr_malloc(256 * 1024); 2948 for (i = 0L; i < bkpinfo->optimal_set_size / 256; i++) { 2982 2949 blksize = fread(tempblock, 1, 256 * 1024, fin); 2983 2950 if (blksize > 0) { … … 2988 2955 } 2989 2956 } 2957 mr_free(tempblock); 2990 2958 } else { 2991 i = 0 ;2992 } 2993 paranoid_fclose(fout);2994 if (i > 0 ) // length_of_file (curr_slice_fname_uncompressed)2959 i = 0L; 2960 } 2961 fclose(fout); 2962 if (i > 0L) // length_of_file (curr_slice_fname_uncompressed) 2995 2963 { 2996 2964 if (!does_file_exist(curr_slice_fname_uncompressed)) { 2997 log_msg(2, 2998 "Warning - '%s' doesn't exist. How can I compress slice?", 2999 curr_slice_fname_uncompressed); 2965 log_msg(2, "Warning - '%s' doesn't exist. How can I compress slice?", curr_slice_fname_uncompressed); 3000 2966 } 3001 2967 if (should_I_compress_slices && bkpinfo->compression_level > 0) { … … 3017 2983 log_msg(2, "Failed to compress the slice"); 3018 2984 } 3019 if (bkpinfo->use_lzo 3020 && strcmp(curr_slice_fname_compressed, 3021 curr_slice_fname_uncompressed)) { 2985 if (bkpinfo->use_lzo && strcmp(curr_slice_fname_compressed, curr_slice_fname_uncompressed)) { 3022 2986 unlink(curr_slice_fname_uncompressed); 3023 2987 } … … 3037 3001 log_msg(2, tmp); 3038 3002 #endif 3039 paranoid_free(tmp);3003 mr_free(tmp); 3040 3004 3041 3005 mr_asprintf(file_to_archive, "%s", curr_slice_fname_compressed); … … 3053 3017 3054 3018 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 3055 register_in_tape_catalog(biggieslice, biggie_file_number, 3056 slice_num, file_to_archive); 3019 register_in_tape_catalog(biggieslice, biggie_file_number, slice_num, file_to_archive); 3057 3020 maintain_collection_of_recent_archives(file_to_archive); 3058 3021 res = move_files_to_stream(file_to_archive, NULL); … … 3068 3031 } 3069 3032 } 3070 mr_free(tempblock);3071 3033 mr_free(suffix); 3072 3034 paranoid_fclose(fin); -
branches/2.2.10/mondo/src/common/libmondo-cli.c
r2334 r2338 100 100 bkpinfo->media_size[j] = 650; 101 101 } /* default */ 102 res = 103 retrieve_switches_from_command_line(argc, argv, flag_val, 104 flag_set); 102 res = retrieve_switches_from_command_line(argc, argv, flag_val, flag_set); 105 103 retval += res; 106 104 if (!retval) { … … 807 805 } 808 806 if (bkpinfo->include_paths != NULL) { 807 mr_strip_spaces(bkpinfo->include_paths); 809 808 log_msg(1, "include_paths is now '%s'", bkpinfo->include_paths); 810 809 } 811 810 if (bkpinfo->exclude_paths != NULL) { 811 mr_strip_spaces(bkpinfo->exclude_paths); 812 812 log_msg(1, "exclude_paths is now '%s'", bkpinfo->exclude_paths); 813 813 } … … 815 815 } 816 816 817 if (g_kernel_version >= 2.6 && !flag_set['d'] 818 && (flag_set['c'] || flag_set['w']) && (! bkpinfo->restore_data)) { 819 fatal_error 820 ("If you are using the 2.6.x kernel, please specify the CD-R(W) device."); 817 if (g_kernel_version >= 2.6 && !flag_set['d'] && (flag_set['c'] || flag_set['w']) && (! bkpinfo->restore_data)) { 818 fatal_error("If you are using the 2.6.x kernel, please specify the CD-R(W) device."); 821 819 } 822 820 … … 825 823 if (flag_set['I']) { 826 824 retval++; 827 log_to_screen 828 ("Please do not use -J in combination with -I. If you want to make a list of files to backup, that's fine, use -J <filename> but please don't muddy the waters by combining -J with -I. Thanks. :-)"); 825 log_to_screen("Please do not use -J in combination with -I. If you want to make a list of files to backup, that's fine, use -J <filename> but please don't muddy the waters by combining -J with -I. Thanks. :-)"); 829 826 } 830 827 bkpinfo->make_filelist = FALSE; … … 833 830 834 831 if ((flag_set['c'] || flag_set['w'] || flag_set['C'] || flag_set['r']) && (! bkpinfo->restore_data)) { 835 if (!flag_set['r'] && g_kernel_version <= 2.5 836 && strstr(flag_val['d'], "/dev/")) { 837 fatal_error 838 ("Please don't give a /dev entry. Give a SCSI node for the parameter of the -d flag."); 839 } 840 if (flag_set['r'] && g_kernel_version <= 2.5 841 && !strstr(flag_val['d'], "/dev/")) { 842 fatal_error 843 ("Please give a /dev entry, not a SCSI node, as the parameter of the -d flag."); 832 if (!flag_set['r'] && g_kernel_version <= 2.5 && strstr(flag_val['d'], "/dev/")) { 833 fatal_error("Please don't give a /dev entry. Give a SCSI node for the parameter of the -d flag."); 834 } 835 if (flag_set['r'] && g_kernel_version <= 2.5 && !strstr(flag_val['d'], "/dev/")) { 836 fatal_error("Please give a /dev entry, not a SCSI node, as the parameter of the -d flag."); 844 837 } 845 838 if (g_kernel_version >= 2.6 && !strstr(flag_val['d'], "/dev/")) { 846 log_to_screen 847 ("Linus says 2.6 has a broken ide-scsi module. Proceed at your own risk..."); 848 } 849 850 if (system("which cdrecord > /dev/null 2> /dev/null") 851 && system("which dvdrecord > /dev/null 2> /dev/null")) { 852 fatal_error 853 ("Please install dvdrecord/cdrecord and try again."); 839 log_to_screen("Linus says 2.6 has a broken ide-scsi module. Proceed at your own risk..."); 840 } 841 842 if (system("which cdrecord > /dev/null 2> /dev/null") && system("which dvdrecord > /dev/null 2> /dev/null")) { 843 fatal_error("Please install dvdrecord/cdrecord and try again."); 854 844 } 855 845 if (flag_set['C']) { 856 846 bkpinfo->cdrw_speed = atoi(flag_val['C']); 857 847 if (bkpinfo->cdrw_speed < 1) { 858 fatal_error 859 ("You specified a silly speed for a CD-R[W] drive"); 848 fatal_error("You specified a silly speed for a CD-R[W] drive"); 860 849 } 861 850 if (!flag_set['L']) { 862 log_to_screen 863 ("You must use -L with -C. Therefore I am setting it for you."); 851 log_to_screen("You must use -L with -C. Therefore I am setting it for you."); 864 852 flag_set['L'] = 1; 865 853 flag_val['L'][0] = '\0'; … … 868 856 log_msg(3, "flag_val['c'] = %s", flag_val['c']); 869 857 log_msg(3, "flag_val['w'] = %s", flag_val['w']); 870 // log_msg(3, "flag_set['r'] = %i", flag_set['r'] );871 858 if (flag_set['c']) { 872 859 bkpinfo->cdrw_speed = atoi(flag_val['c']); … … 878 865 879 866 if (bkpinfo->cdrw_speed < 1) { 880 fatal_error 881 ("You specified a silly speed for a CD-R[W] drive"); 867 fatal_error("You specified a silly speed for a CD-R[W] drive"); 882 868 } 883 869 } … … 901 887 { 902 888 if (! flag_set['d']) { 903 fatal_error 904 ("You need to specify a device file with -d for bootable USB device usage"); 889 fatal_error("You need to specify a device file with -d for bootable USB device usage"); 905 890 } 906 891 if ((!flag_set['s']) && (! bkpinfo->restore_data)) { … … 912 897 { 913 898 if (flag_set['m']) { 914 fatal_error 915 ("Manual CD tray (-m) not yet supported in conjunction w/ DVD drives. Drop -m."); 899 fatal_error("Manual CD tray (-m) not yet supported in conjunction w/ DVD drives. Drop -m."); 916 900 } 917 901 if (!flag_set['d']) { … … 957 941 if (flag_set['s']) { 958 942 if (flag_set['t']) { 959 fatal_error 960 ("For the moment, please don't specify a tape size. Mondo should handle end-of-tape gracefully anyway."); 943 fatal_error("For the moment, please don't specify a tape size. Mondo should handle end-of-tape gracefully anyway."); 961 944 } 962 945 if (process_the_s_switch(flag_val['s'])) { … … 1175 1158 log_msg(1, "Internal tape block size is now %ld bytes", itbs); 1176 1159 if (itbs % 512 != 0 || itbs < 256 || itbs > 1024L * 1024) { 1177 fatal_error 1178 ("Are you nuts? Silly, your internal tape block size is. Abort, I shall."); 1160 fatal_error("Are you nuts? Silly, your internal tape block size is. Abort, I shall."); 1179 1161 } 1180 1162 bkpinfo->internal_tape_block_size = itbs; … … 1185 1167 // bkpinfo->differential = atoi (flag_val['D']); 1186 1168 if ((bkpinfo->differential < 1) || (bkpinfo->differential > 9)) { 1187 fatal_error 1188 ("The D option should be between 1 and 9 inclusive"); 1169 fatal_error("The D option should be between 1 and 9 inclusive"); 1189 1170 } 1190 1171 } … … 1279 1260 retval++; 1280 1261 log_to_screen("Please specify the backup device/directory.\n"); 1281 fatal_error 1282 ("You didn't use -d to specify the backup device/directory."); 1262 fatal_error("You didn't use -d to specify the backup device/directory."); 1283 1263 } 1284 1264 … … 1365 1345 if (run_program_and_log_output("which lzop", 2)) { 1366 1346 retval++; 1367 log_to_screen 1368 ("Please install LZOP. You can't use '-L' until you do.\n"); 1347 log_to_screen("Please install LZOP. You can't use '-L' until you do.\n"); 1369 1348 } 1370 1349 } … … 1374 1353 if (run_program_and_log_output("which gzip", 2)) { 1375 1354 retval++; 1376 log_to_screen 1377 ("Please install gzip. You can't use '-G' until you do.\n"); 1355 log_to_screen("Please install gzip. You can't use '-G' until you do.\n"); 1356 } 1357 } 1358 1359 if ((flag_set['Y']) && (! bkpinfo->restore_data)) { 1360 bkpinfo->use_lzma = TRUE; 1361 if (run_program_and_log_output("which lzma", 2)) { 1362 retval++; 1363 log_to_screen("Please install lzma. You can't use '-Y' until you do.\n"); 1378 1364 } 1379 1365 } … … 1391 1377 if ((!is_this_a_valid_disk_format("vfat")) && (! bkpinfo->restore_data)) { 1392 1378 bkpinfo->make_cd_use_lilo = TRUE; 1393 log_to_screen 1394 ("Your kernel appears not to support vfat filesystems. I am therefore"); 1395 log_to_screen 1396 ("using LILO instead of SYSLINUX as the media boot loader."); 1379 log_to_screen("Your kernel appears not to support vfat filesystems. I am therefore"); 1380 log_to_screen("using LILO instead of SYSLINUX as the media boot loader."); 1397 1381 } 1398 1382 if ((run_program_and_log_output("which mkfs.vfat", 2)) && (! bkpinfo->restore_data)) { 1399 1383 bkpinfo->make_cd_use_lilo = TRUE; 1400 1384 #ifdef __IA32__ 1401 log_to_screen 1402 ("Your filesystem is missing 'mkfs.vfat', so I cannot use SYSLINUX as"); 1403 log_to_screen 1404 ("your boot loader. I shall therefore use LILO instead."); 1385 log_to_screen("Your filesystem is missing 'mkfs.vfat', so I cannot use SYSLINUX as"); 1386 log_to_screen("your boot loader. I shall therefore use LILO instead."); 1405 1387 #endif 1406 1388 #ifdef __IA64__ 1407 log_to_screen 1408 ("Your filesystem is missing 'mkfs.vfat', so I cannot prepare the EFI"); 1389 log_to_screen("Your filesystem is missing 'mkfs.vfat', so I cannot prepare the EFI"); 1409 1390 log_to_screen("environment correctly. Please install it."); 1410 1391 fatal_error("Aborting"); … … 1426 1407 1427 1408 if ((! bkpinfo->restore_data) && (flag_set['Z'])) { 1428 fatal_error 1429 ("The -Z switch is only valid in restore mode"); 1409 fatal_error("The -Z switch is only valid in restore mode"); 1430 1410 } 1431 1411 … … 1466 1446 * @return The number of problems with the command line (0 for success). 1467 1447 */ 1468 int 1469 retrieve_switches_from_command_line(int argc, char *argv[], 1470 char flag_val[128][MAX_STR_LEN], 1471 bool flag_set[128]) 1448 int retrieve_switches_from_command_line(int argc, char *argv[], char flag_val[128][MAX_STR_LEN], bool flag_set[128]) 1472 1449 { 1473 1450 /*@ ints ** */ … … 1486 1463 flag_set[i] = FALSE; 1487 1464 } 1488 while ((opt = 1489 getopt(argc, argv, MONDO_OPTIONS)) 1490 != -1) { 1465 while ((opt = getopt(argc, argv, MONDO_OPTIONS)) != -1) { 1491 1466 if (opt == '?') { 1492 1467 bad_switches = TRUE; -
branches/2.2.10/mondo/src/common/libmondo-files.c
r2334 r2338 422 422 char *command = NULL; 423 423 /*@ pointers **************************************************** */ 424 char *p ;424 char *p = NULL; 425 425 426 426 /*@ int's ******************************************************* */ 427 int i; 428 429 for (i = NOOF_ERR_LINES - 1; 430 i >= 0 && !strstr(err_log_lines[i], "% Done") 431 && !strstr(err_log_lines[i], "% done"); i--); 427 int i = 0; 428 429 for (i = NOOF_ERR_LINES - 1; i >= 0 && !strstr(err_log_lines[i], "% Done") && !strstr(err_log_lines[i], "% done"); i--); 432 430 if (i < 0) { 433 431 mr_asprintf(command, "tail -n3 %s | grep -Fi \"%c\" | tail -n1 | awk '{print $0;}'", filename, '%'); … … 445 443 if (p) { 446 444 *p = '\0'; 447 } 448 if (!p) { 445 } else { 449 446 mr_free(lastline); 450 447 return (0); 451 448 } 452 *p = '\0'; 453 for (p--; *p != ' '&& p != lastline; p--);449 450 for (p--; isdigit(p) && p != lastline; p--); 454 451 if (p != lastline) { 455 452 p++; 456 453 } 454 i = atoi(p); 457 455 mr_free(lastline); 458 459 i = atoi(p);460 456 return (i); 461 457 } … … 1214 1210 * @param bkpinfo The backup information structure. Fields used: 1215 1211 * - @c bkpinfo->backup_media_type 1216 * - @c bkpinfo->image_devs1217 1212 * - @c bkpinfo->media_size 1218 1213 * - @c bkpinfo->optimal_set_size … … 1245 1240 scratchLL = (scratchLL * 2) / 3; 1246 1241 } else if (bkpinfo->use_gzip) { 1242 scratchLL = (scratchLL * 2) / 3; 1243 } else if (bkpinfo->use_lzma) { 1247 1244 scratchLL = (scratchLL * 2) / 3; 1248 1245 } else { -
branches/2.2.10/mondo/src/common/libmondo-tools.c
r2334 r2338 469 469 mr_asprintf(bkpinfo->zip_exe, "gzip"); 470 470 mr_asprintf(bkpinfo->zip_suffix, "gz"); 471 } else if (bkpinfo->use_lzma) { 472 mr_asprintf(bkpinfo->zip_exe, "lzma"); 473 mr_asprintf(bkpinfo->zip_suffix, "lzma"); 471 474 } else if (bkpinfo->compression_level != 0) { 472 475 mr_asprintf(bkpinfo->zip_exe, "bzip2"); … … 723 726 if (bkpinfo->disaster_recovery) { 724 727 if (!does_nonMS_partition_exist()) { 725 fatal_error 726 ("I am in disaster recovery mode\nPlease don't run mondoarchive."); 728 fatal_error("I am in disaster recovery mode\nPlease don't run mondoarchive."); 727 729 } 728 730 } … … 733 735 paranoid_free(tmp); 734 736 if (find_and_store_mondoarchives_home(g_mondo_home)) { 735 fprintf(stderr, 736 "Cannot find Mondo's homedir. I think you have >1 'mondo' directory on your hard disk. Please delete the superfluous 'mondo' directories and try again\n"); 737 fprintf(stderr, "Cannot find Mondo's homedir. I think you have >1 'mondo' directory on your hard disk. Please delete the superfluous 'mondo' directories and try again\n"); 737 738 res++; 738 739 return (res); … … 783 784 void mr_free_bkpinfo() { 784 785 786 log_msg(1, "Freeing bkpinfo"); 785 787 mr_free(bkpinfo->media_device); 786 788 mr_free(bkpinfo->boot_device); … … 816 818 { 817 819 int i; 818 log_msg(1, "Hi"); 820 log_msg(1, "Initializing bkpinfo"); 821 bkpinfo = (struct s_bkpinfo *)mr_malloc(sizeof(struct s_bkpinfo)); 819 822 820 823 /* Initialized in same order as in the structure declaration to detect errors more easily */ … … 831 834 bkpinfo->use_lzo = FALSE; 832 835 bkpinfo->use_gzip = FALSE; 836 bkpinfo->use_lzma = FALSE; 833 837 bkpinfo->verify_data = FALSE; 834 838 bkpinfo->backup_data = FALSE; … … 937 941 if (system("which mkfs.vfat 2> /dev/null 1> /dev/null") 938 942 && !system("which mkfs.msdos 2> /dev/null 1> /dev/null")) { 939 log_it 940 ("OK, you've got mkfs.msdos but not mkfs.vfat; time for the fairy to wave her magic wand..."); 941 run_program_and_log_output 942 ("ln -sf `which mkfs.msdos` /sbin/mkfs.vfat", FALSE); 943 log_it("OK, you've got mkfs.msdos but not mkfs.vfat; time for the fairy to wave her magic wand..."); 944 run_program_and_log_output("ln -sf `which mkfs.msdos` /sbin/mkfs.vfat", FALSE); 943 945 } 944 946 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("free | grep Mem | head -n1 | tr -s ' ' '\t' | cut -f2")); … … 1346 1348 * information to the logfile. 1347 1349 */ 1348 void standard_log_debug_msg(int debug_level, const char *szFile, 1349 const char *szFunction, int nLine, 1350 const char *fmt, ...) 1351 { 1350 void standard_log_debug_msg(int debug_level, const char *szFile, const char *szFunction, int nLine, const char *fmt, ...) { 1351 1352 1352 va_list args; 1353 int i;1354 1353 static int depth = 0; 1355 1354 FILE *fout; … … 1368 1367 // add tabs to distinguish log levels 1369 1368 if (debug_level > 0) { 1370 for (i = 1; i < debug_level; i++) 1371 fprintf(fout, "\t"); 1369 fprintf(fout, "DBG%d: ", debug_level); 1372 1370 if (getpid() == g_main_pid) 1373 1371 fprintf(fout, "[Main] %s->%s#%d: ", szFile, szFunction, nLine); … … 1376 1374 else 1377 1375 fprintf(fout, "[TH=%d] %s->%s#%d: ", getpid(), szFile, szFunction, nLine); 1376 } else { 1377 fprintf(fout, "INFO: "); 1378 1378 } 1379 1379 va_start(args, fmt); -
branches/2.2.10/mondo/src/common/libmondo-verify.c
r2334 r2338 254 254 } else if (bkpinfo->use_gzip) { 255 255 mr_asprintf(sz_exe, "gzip"); 256 } else if (bkpinfo->use_lzma) { 257 mr_asprintf(sz_exe, "lzma"); 256 258 } else { 257 259 mr_asprintf(sz_exe, "bzip2"); … … 435 437 bkpinfo->use_lzo = TRUE; 436 438 bkpinfo->use_gzip = FALSE; 439 bkpinfo->use_lzma = FALSE; 437 440 } 438 441 if (strstr(tarball_fname, ".gz") && strcmp(bkpinfo->zip_suffix, "gz")) { … … 444 447 bkpinfo->use_lzo = FALSE; 445 448 bkpinfo->use_gzip = TRUE; 449 bkpinfo->use_lzma = FALSE; 446 450 } 447 451 if (strstr(tarball_fname, ".bz2") && strcmp(bkpinfo->zip_suffix, "bz2")) { … … 453 457 bkpinfo->use_lzo = FALSE; 454 458 bkpinfo->use_gzip = FALSE; 459 bkpinfo->use_lzma = FALSE; 460 } 461 if (strstr(tarball_fname, ".lzma") && strcmp(bkpinfo->zip_suffix, "lzma")) { 462 log_msg(2, "OK, I'm going to start using lzma."); 463 mr_free(bkpinfo->zip_exe); 464 mr_asprintf(bkpinfo->zip_exe, "lzma"); 465 mr_free(bkpinfo->zip_suffix); 466 mr_asprintf(bkpinfo->zip_suffix, "lzma"); 467 bkpinfo->use_lzo = FALSE; 468 bkpinfo->use_gzip = FALSE; 469 bkpinfo->use_lzma = TRUE; 455 470 } 456 471 if (bkpinfo->zip_exe == NULL) { -
branches/2.2.10/mondo/src/common/mondostructures.h
r2328 r2338 380 380 /** 381 381 * The extension your compression program uses. lzop uses lzo, bzip uses 382 * bz2, gzip uses gz, etc. Do not include the dot.382 * bz2, gzip uses gz, lzma uses lzma etc. Do not include the dot. 383 383 */ 384 384 char *zip_suffix; … … 419 419 */ 420 420 bool use_gzip; 421 422 /** 423 * If TRUE, then use @c lzma to compress data. 424 * This is used mainly in estimates. The backup/restore may or may 425 * not work if you do not set this. You should also set @p zip_exe 426 * and @p zip_suffix. 427 */ 428 bool use_lzma; 421 429 422 430 /** -
branches/2.2.10/mondo/src/do-not-compress-these
r30 r2338 68 68 .LZh 69 69 .LZH 70 .lzma 70 71 .lzo 71 72 .lzop -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-compare.c
r2334 r2338 253 253 if (strstr(tarball_fname, ".bz2")) { 254 254 mr_asprintf(compressor_exe, "bzip2"); 255 } else if (strstr(tarball_fname, ".lzma")) { 256 mr_asprintf(compressor_exe, "lzma"); 255 257 } else if (strstr(tarball_fname, ".gz")) { 256 258 mr_asprintf(compressor_exe, "gzip"); … … 384 386 mr_free(tarball_fname); 385 387 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.lzo", current_tarball_number); 388 } 389 if (!does_file_exist(tarball_fname)) { 390 mr_free(tarball_fname); 391 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.lzma", current_tarball_number); 386 392 } 387 393 if (!does_file_exist(tarball_fname)) { -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c
r2334 r2338 897 897 mr_free(value); 898 898 899 value = read_cfg_var(cfg_file, "use-lzma"); 900 if (value && strstr(value, "yes")) { 901 bkpinfo->use_lzma = TRUE; 902 bkpinfo->use_lzo = FALSE; 903 bkpinfo->use_gzip = FALSE; 904 mr_free(bkpinfo->zip_exe); 905 mr_asprintf(bkpinfo->zip_exe, "lzma"); 906 mr_free(bkpinfo->zip_suffix); 907 mr_asprintf(bkpinfo->zip_suffix, "lzma"); 908 } 909 mr_free(value); 910 899 911 value = read_cfg_var(cfg_file, "use-lzo"); 900 912 if (value && strstr(value, "yes")) { 913 bkpinfo->use_lzma = FALSE; 901 914 bkpinfo->use_lzo = TRUE; 902 915 bkpinfo->use_gzip = FALSE; … … 910 923 value = read_cfg_var(cfg_file, "use-gzip"); 911 924 if (value && strstr(value, "yes")) { 925 bkpinfo->use_lzma = FALSE; 912 926 bkpinfo->use_lzo = FALSE; 913 927 bkpinfo->use_gzip = TRUE; … … 921 935 value = read_cfg_var(cfg_file, "use-comp"); 922 936 if (value && strstr(value, "yes")) { 937 bkpinfo->use_lzma = FALSE; 923 938 bkpinfo->use_lzo = FALSE; 924 939 bkpinfo->use_gzip = FALSE; -
branches/2.2.10/mondo/src/mondorestore/mondorestore.c
r2334 r2338 1156 1156 !does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "lzo")) && 1157 1157 !does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "gz")) && 1158 !does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "lzma")) && 1158 1159 !does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "bz2"))) { 1159 1160 log_msg(3, "Cannot find a data slice or terminator slice on CD %d", g_current_media_number); … … 1183 1184 mr_asprintf(suffix, "gz"); 1184 1185 } else 1186 if (does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "lzma"))) { 1187 mr_asprintf(bzip2_command, "lzma"); 1188 mr_asprintf(suffix, "lzma"); 1189 } else 1185 1190 if (does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "bz2"))) { 1186 1191 mr_asprintf(bzip2_command, "bzip2"); … … 1598 1603 if (strstr(tarball_fname, ".bz2")) { 1599 1604 mr_asprintf(executable, "bzip2"); 1605 } else if (strstr(tarball_fname, ".lzma")) { 1606 mr_asprintf(executable, "lzma"); 1600 1607 } else if (strstr(tarball_fname, ".gz")) { 1601 1608 mr_asprintf(executable, "gzip"); … … 2099 2106 if (!does_file_exist(tarball_fname)) { 2100 2107 mr_free(tarball_fname); 2108 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.lzma", current_tarball_number); 2109 } 2110 if (!does_file_exist(tarball_fname)) { 2111 mr_free(tarball_fname); 2101 2112 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.lzo", current_tarball_number); 2102 2113 }
Note:
See TracChangeset
for help on using the changeset viewer.