Changeset 3205 in MondoRescue for branches/3.2/mondo/src/common/libmondo-archive.c
- Timestamp:
- Dec 6, 2013, 3:40:47 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mondo/src/common/libmondo-archive.c
r3197 r3205 526 526 527 527 /*@ long ********************************************************** */ 528 long lines_in_filelist = 0 ;528 long lines_in_filelist = 0L; 529 529 530 530 /*@ int ************************************************************* */ 531 531 int res = 0; 532 long estimated_total_noof_slices = 0 ;532 long estimated_total_noof_slices = 0L; 533 533 534 534 assert(bkpinfo != NULL); … … 608 608 609 609 update_evalcall_form(2); 610 if (!bkpinfo->nonbootable_backup 611 && (bkpinfo->boot_loader == '\0' 612 || bkpinfo->boot_device[0] == '\0')) { 610 if (!bkpinfo->nonbootable_backup && (bkpinfo->boot_loader == '\0' || bkpinfo->boot_device[0] == '\0')) { 613 611 614 612 #ifdef __FreeBSD__ 615 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 616 ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'")); 613 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'")); 617 614 if (!bootdev[0]) { 618 615 mr_free(bootdev); 619 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 620 ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'")); 616 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'")); 621 617 } 622 618 #else 623 619 /* Linux */ 624 620 #ifdef __IA64__ 625 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 626 ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 621 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 627 622 #else 628 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 629 ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 623 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 630 624 #endif 631 625 if (strstr(bootdev, "/dev/cciss/")) { 632 626 mr_free(bootdev); 633 627 #ifdef __IA64__ 634 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 635 ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 628 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 636 629 #else 637 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 638 ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 630 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 639 631 #endif 640 632 } 641 633 if (!bootdev[0]) { 642 634 mr_free(bootdev); 643 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 644 ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 635 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 645 636 if (strstr(bootdev, "/dev/cciss/")) { 646 637 mr_free(bootdev); 647 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 648 ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 638 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 649 639 } 650 640 } … … 675 665 bkpinfo->boot_loader != 'E' && 676 666 #endif 677 bkpinfo->boot_loader != 'L' && bkpinfo->boot_loader != 'G' 678 && bkpinfo->boot_loader != 'R' 679 && !bkpinfo->nonbootable_backup) { 680 fatal_error 681 ("Please specify your boot loader and device, e.g. -l GRUB -f /dev/hda. Type 'man mondoarchive' to read the manual."); 667 bkpinfo->boot_loader != 'L' && bkpinfo->boot_loader != 'G' && bkpinfo->boot_loader != 'R' && !bkpinfo->nonbootable_backup) { 668 fatal_error("Please specify your boot loader and device, e.g. -l GRUB -f /dev/hda. Type 'man mondoarchive' to read the manual."); 682 669 } 683 670 if (bkpinfo->boot_loader == 'L') { 684 671 mr_asprintf(bootldr_str, "LILO"); 685 672 if (!does_file_exist("/etc/lilo.conf")) { 673 mr_free(bootldr_str); 686 674 fatal_error("The de facto standard location for your boot loader's config file is /etc/lilo.conf but I cannot find it there. What is wrong with your Linux distribution?"); 687 675 } … … 692 680 } 693 681 if ((!does_file_exist("/boot/grub/menu.lst")) && (!does_file_exist("/boot/grub/grub.cfg")) && (!does_file_exist("/boot/grub2/grub.cfg"))) { 682 mr_free(bootldr_str); 694 683 fatal_error("The de facto standard location for your boot loader's config file is /boot/grub/menu.lst, /boot/grub/grub.cfg, or /boot/grub2/grub.cfg but I cannot find it there. What is wrong with your Linux distribution?"); 695 684 } … … 697 686 } else if (bkpinfo->boot_loader == 'E') { 698 687 mr_asprintf(bootldr_str, "ELILO"); 699 /* BCO: fix it for Debian, Ma ndrake, ... */688 /* BCO: fix it for Debian, Mageia, ... */ 700 689 if (!does_file_exist("/etc/elilo.conf") && does_file_exist("/boot/efi/efi/redhat/elilo.conf")) { 701 690 run_program_and_log_output("ln -sf /boot/efi/efi/redhat/elilo.conf /etc/elilo.conf", 5); … … 711 700 } 712 701 if (!does_file_exist("/etc/elilo.conf")) { 702 mr_free(bootldr_str); 713 703 fatal_error("The de facto mondo standard location for your boot loader's config file is /etc/elilo.conf but I cannot find it there. What is wrong with your Linux distribution? Try finding it under /boot/efi and do 'ln -s /boot/efi/..../elilo.conf /etc/elilo.conf'"); 714 704 } … … 783 773 log_msg(1, "%ld: Unable to write one-liner backup-media-type", __LINE__); 784 774 } 785 mr_free(value);786 775 mr_free(tmp); 787 776 … … 791 780 log_msg(1, "%ld: Unable to write one-liner bootloader.name", __LINE__); 792 781 } 793 mr_free(bootldr_str);782 r_free(bootldr_str); 794 783 mr_free(tmp); 795 784 … … 814 803 mr_asprintf(tmp1, "%s/XATTR", bkpinfo->tmpdir); 815 804 if (write_one_liner_data_file(tmp1, "TRUE")) { 816 log_msg(1, "%ld: Unable to write one-liner XATTR", 817 __LINE__); 818 } 819 paranoid_free(tmp1); 805 log_msg(1, "%ld: Unable to write one-liner XATTR", __LINE__); 806 } 807 mr_free(tmp1); 820 808 } 821 809 if (g_getfacl) { 822 810 mr_asprintf(tmp1, "%s/ACL", bkpinfo->tmpdir); 823 811 if (write_one_liner_data_file(tmp1, "TRUE")) { 824 log_msg(1, "%ld: Unable to write one-liner ACL", 825 __LINE__); 826 } 827 paranoid_free(tmp1); 812 log_msg(1, "%ld: Unable to write one-liner ACL", __LINE__); 813 } 814 mr_free(tmp1); 828 815 } 829 816 if (bkpinfo->use_obdr) { 830 817 mr_asprintf(tmp1, "%s/OBDR", bkpinfo->tmpdir); 831 818 if (write_one_liner_data_file(tmp1, "TRUE")) { 832 log_msg(1, "%ld: Unable to write one-liner OBDR", 833 __LINE__); 834 } 835 paranoid_free(tmp1); 819 log_msg(1, "%ld: Unable to write one-liner OBDR", __LINE__); 820 } 821 mr_free(tmp1); 836 822 } 837 823 … … 876 862 MONDO_LOGFILE); 877 863 864 mr_free(tmp2); 865 mr_free(tape_device); 866 mr_free(tape_size_sz); 867 mr_free(use_lzo_sz); 868 mr_free(cd_recovery_sz); 869 mr_free(broken_bios_sz); 878 870 mr_free(last_filelist_number); 879 mr_free(tape_device); 880 mr_free(use_lzo_sz); 871 mr_free(use_comp_sz); 872 mr_free(use_lilo_sz); 873 mr_free(use_star_sz); 881 874 mr_free(use_gzip_sz); 882 875 mr_free(use_lzma_sz); 883 mr_free(use_star_sz); 884 mr_free(use_comp_sz); 885 mr_free(broken_bios_sz); 886 mr_free(cd_recovery_sz); 887 mr_free(use_lilo_sz); 888 mr_free(tape_size_sz); 876 mr_free(value); 889 877 890 878 /* This parameter is always the last one and optional */ … … 1183 1171 * @ingroup MLarchiveGroup 1184 1172 */ 1185 int do_that_initial_phase() 1186 { 1173 int do_that_initial_phase() { 1187 1174 /*@ int *************************************** */ 1188 1175 int retval = 0; … … 1229 1216 mr_free(data_disks_file); 1230 1217 1231 mr_asprintf(command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->netfs_remote_dir, bkpinfo->prefix); 1218 if (bkpinfo->netfs_remote_dir != NULL) { 1219 mr_asprintf(command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->netfs_remote_dir, bkpinfo->prefix); 1220 } else { 1221 mr_asprintf(command, "rm -f %s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->prefix); 1222 } 1232 1223 paranoid_system(command); 1233 1224 mr_free(command); … … 1236 1227 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 1237 1228 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 1238 write_header_block_to_stream((off_t)0, "start-of-tape", 1239 BLK_START_OF_TAPE); 1240 write_header_block_to_stream((off_t)0, "start-of-backup", 1241 BLK_START_OF_BACKUP); 1229 write_header_block_to_stream((off_t)0, "start-of-tape", BLK_START_OF_TAPE); 1230 write_header_block_to_stream((off_t)0, "start-of-backup", BLK_START_OF_BACKUP); 1242 1231 } 1243 1232 return (retval); … … 1355 1344 srand((unsigned int) getpid()); 1356 1345 g_sem_key = 1234 + random() % 30000; 1357 if ((g_sem_id = 1358 semget((key_t) g_sem_key, 1, 1359 IPC_CREAT | S_IREAD | S_IWRITE)) == -1) { 1346 if ((g_sem_id = semget((key_t) g_sem_key, 1, IPC_CREAT | S_IREAD | S_IWRITE)) == -1) { 1360 1347 fatal_error("MABAI - unable to semget"); 1361 1348 } … … 1366 1353 log_msg(8, "Creating thread #%d", noof_threads); 1367 1354 (*p_archival_threads_running)++; 1368 if ((res = 1369 pthread_create(&archival_thread[noof_threads], NULL, 1370 create_afio_files_in_background, 1371 (void *) transfer_block))) { 1355 if ((res = pthread_create(&archival_thread[noof_threads], NULL, create_afio_files_in_background, (void *) transfer_block))) { 1372 1356 fatal_error("Unable to create an archival thread"); 1373 1357 } … … 1381 1365 if (*p_archival_threads_running == 0 1382 1366 && *p_last_set_archived == storing_set_no - 1) { 1383 log_msg(2, 1384 "No archival threads are running. The last stored set was %d and I'm looking for %d. Take off your make-up; the party's over... :-)", 1385 *p_last_set_archived, storing_set_no); 1367 log_msg(2, "No archival threads are running. The last stored set was %d and I'm looking for %d. Take off your make-up; the party's over... :-)", *p_last_set_archived, storing_set_no); 1386 1368 done_storing = TRUE; 1387 1369 } else 1388 if (!get_bit_N_of_array 1389 (p_list_of_fileset_flags, storing_set_no)) { 1390 misc_counter_that_is_not_important = (misc_counter_that_is_not_important + 1) % 5; 1391 /* BCO the media_usage_comment is not really initialized there ! 1392 if (!misc_counter_that_is_not_important) { 1393 update_progress_form(media_usage_comment); 1394 } 1395 */ 1396 sleep(1); 1370 if (!get_bit_N_of_array(p_list_of_fileset_flags, storing_set_no)) { 1371 misc_counter_that_is_not_important = (misc_counter_that_is_not_important + 1) % 5; 1372 sleep(1); 1397 1373 } else { 1398 1374 // store set N … … 1407 1383 1408 1384 log_msg(2, "Storing set %d", storing_set_no); 1409 while (!does_file_exist(storing_filelist_fname) 1410 || !does_file_exist(storing_afioball_fname)) { 1411 log_msg(2, 1412 "Warning - either %s or %s doesn't exist yet. I'll pause 5 secs.", 1413 storing_filelist_fname, storing_afioball_fname); 1385 while (!does_file_exist(storing_filelist_fname) || !does_file_exist(storing_afioball_fname)) { 1386 log_msg(2, "Warning - either %s or %s doesn't exist yet. I'll pause 5 secs.", storing_filelist_fname, storing_afioball_fname); 1414 1387 sleep(5); 1415 1388 } 1416 1389 /* copy to CD (scratchdir) ... and an actual CD-R if necessary */ 1417 1390 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 1418 register_in_tape_catalog(fileset, storing_set_no, -1, 1419 storing_afioball_fname); 1391 register_in_tape_catalog(fileset, storing_set_no, -1, storing_afioball_fname); 1420 1392 maintain_collection_of_recent_archives(bkpinfo->tmpdir, storing_afioball_fname); 1421 1393 log_it("Writing EXAT files"); 1422 res += 1423 write_EXAT_files_to_tape(curr_xattr_list_fname, 1424 curr_acl_list_fname); 1394 res += write_EXAT_files_to_tape(curr_xattr_list_fname, curr_acl_list_fname); 1425 1395 // archives themselves 1426 res += 1427 move_files_to_stream(storing_afioball_fname, 1428 NULL); 1396 res += move_files_to_stream(storing_afioball_fname, NULL); 1429 1397 } else { 1430 1398 if (g_getfacl) { 1431 1399 if (g_getfattr) { 1432 res = move_files_to_cd(storing_filelist_fname, 1433 curr_xattr_list_fname, 1434 curr_acl_list_fname, 1435 storing_afioball_fname, NULL); 1400 res = move_files_to_cd(storing_filelist_fname, curr_xattr_list_fname, curr_acl_list_fname, storing_afioball_fname, NULL); 1436 1401 } else { 1437 res = move_files_to_cd(storing_filelist_fname, 1438 curr_acl_list_fname, 1439 storing_afioball_fname, NULL); 1402 res = move_files_to_cd(storing_filelist_fname, curr_acl_list_fname, storing_afioball_fname, NULL); 1440 1403 } 1441 1404 } else { 1442 1405 if (g_getfattr) { 1443 res = move_files_to_cd(storing_filelist_fname, 1444 curr_xattr_list_fname, 1445 storing_afioball_fname, NULL); 1406 res = move_files_to_cd(storing_filelist_fname, curr_xattr_list_fname, storing_afioball_fname, NULL); 1446 1407 } else { 1447 res = move_files_to_cd(storing_filelist_fname, 1448 storing_afioball_fname, NULL); 1408 res = move_files_to_cd(storing_filelist_fname, storing_afioball_fname, NULL); 1449 1409 } 1450 1410 } … … 1967 1927 char *ntfsprog_fifo = NULL; 1968 1928 /*@ long *********************************************** */ 1969 long biggie_file_number = 0 ;1970 long noof_biggie_files = 0 ;1971 long estimated_total_noof_slices = 0 ;1929 long biggie_file_number = 0L; 1930 long noof_biggie_files = 0L; 1931 long estimated_total_noof_slices = 0L; 1972 1932 1973 1933 /*@ int ************************************************ */ … … 1983 1943 assert_string_is_neither_NULL_nor_zerolength(biggielist_fname); 1984 1944 1985 estimated_total_noof_slices = 1986 size_of_all_biggiefiles_K() / bkpinfo->optimal_set_size + 1; 1987 1988 log_msg(1, "size of all biggiefiles = %ld", 1989 size_of_all_biggiefiles_K()); 1990 log_msg(1, "estimated_total_noof_slices = %ld KB / %ld KB = %ld", 1991 size_of_all_biggiefiles_K(), bkpinfo->optimal_set_size, 1992 estimated_total_noof_slices); 1945 estimated_total_noof_slices = size_of_all_biggiefiles_K() / bkpinfo->optimal_set_size + 1L; 1946 1947 log_msg(1, "size of all biggiefiles = %ld", size_of_all_biggiefiles_K()); 1948 log_msg(1, "estimated_total_noof_slices = %ld KB / %ld KB = %ld", size_of_all_biggiefiles_K(), bkpinfo->optimal_set_size, estimated_total_noof_slices); 1993 1949 1994 1950 if (length_of_file(biggielist_fname) < 6) { … … 2102 2058 2103 2059 log_msg(1, "Finished backing up bigfiles"); 2104 log_msg(1, "estimated slices = %ld; actual slices = %ld", 2105 estimated_total_noof_slices, g_current_progress); 2060 log_msg(1, "estimated slices = %ld; actual slices = %ld", estimated_total_noof_slices, g_current_progress); 2106 2061 close_progress_form(); 2107 2062 paranoid_fclose(fin); … … 2254 2209 assert(bkpinfo != NULL); 2255 2210 2256 mvaddstr_and_log_it(g_currentY, 0, 2257 "Archiving regular files to media "); 2211 mvaddstr_and_log_it(g_currentY, 0, "Archiving regular files to media "); 2258 2212 2259 2213 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 2260 write_header_block_to_stream((off_t)0, "start-of-afioballs", 2261 BLK_START_AFIOBALLS); 2214 write_header_block_to_stream((off_t)0, "start-of-afioballs", BLK_START_AFIOBALLS); 2262 2215 #if __FreeBSD__ == 5 2263 log_msg(1, 2264 "Using single-threaded make_afioballs_and_images() to suit b0rken FreeBSD 5.0"); 2216 log_msg(1, "Using single-threaded make_afioballs_and_images() to suit b0rken FreeBSD 5.0"); 2265 2217 res = make_afioballs_and_images_OLD(); 2266 2218 #else
Note:
See TracChangeset
for help on using the changeset viewer.