Changeset 1107 in MondoRescue for branches/stable/mondo/src/common/libmondo-archive.c
- Timestamp:
- Feb 8, 2007, 12:09:34 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/common/libmondo-archive.c
r1093 r1107 10 10 * This is the main file (at least the longest one) in libmondo. 11 11 */ 12 #include <sys/sem.h> 13 #include <sys/types.h> 14 #include <sys/ipc.h> 15 #include <stdarg.h> 16 #include <unistd.h> 12 17 13 18 #include "my-stuff.h" 14 19 #include "../common/mondostructures.h" 20 #include "mr_conf.h" 21 #include "mr_mem.h" 22 #include "mr_err.h" 23 #include "mr_str.h" 24 #include "mr_file.h" 25 15 26 #include "libmondo-string-EXT.h" 16 27 #include "libmondo-stream-EXT.h" … … 26 37 #include "lib-common-externs.h" 27 38 28 #include "mr_mem.h"29 #include "mr_str.h"30 #include "mr_file.h"31 32 #include <sys/sem.h>33 #include <sys/types.h>34 #include <sys/ipc.h>35 #include <stdarg.h>36 39 #define DVDRWFORMAT 1 37 40 … … 91 94 */ 92 95 t_bkptype g_backup_media_type = none; 96 char *g_backup_media_string = NULL; 93 97 94 98 /** … … 142 146 143 147 if (semctl(g_sem_id, 0, IPC_RMID, sem_union) == -1) { 144 log_msg(3, "Failed to delete semaphore");148 mr_msg(3, "Failed to delete semaphore"); 145 149 } 146 150 } … … 159 163 sem_b.sem_flg = SEM_UNDO; 160 164 if (semop(g_sem_id, &sem_b, 1) == -1) { 161 log_msg(3, "semaphore_p failed");165 mr_msg(3, "semaphore_p failed"); 162 166 return (0); 163 167 } … … 177 181 sem_b.sem_flg = SEM_UNDO; 178 182 if (semop(g_sem_id, &sem_b, 1) == -1) { 179 log_msg(3, "semaphore_v failed");183 mr_msg(3, "semaphore_v failed"); 180 184 return (0); 181 185 } … … 235 239 } 236 240 sprintf(command + strlen(command), " 2>> %s", MONDO_LOGFILE); 237 log_msg(4, "command = '%s'", command);241 mr_msg(4, "command = '%s'", command); 238 242 239 243 for (res = 99, tries = 0; tries < 3 && res != 0; tries++) { 240 log_msg(5, "command='%s'", command);244 mr_msg(5, "command='%s'", command); 241 245 res = system(command); 242 246 strcpy(tmp, last_line_of_file(MONDO_LOGFILE)); 243 log_msg(1, "res=%d; tmp='%s'", res, tmp);247 mr_msg(1, "res=%d; tmp='%s'", res, tmp); 244 248 if (bkpinfo->use_star && (res == 254 || res == 65024) 245 249 && strstr(tmp, "star: Processed all possible files") 246 250 && tries > 0) { 247 log_msg(1, "Star returned nonfatal error");251 mr_msg(1, "Star returned nonfatal error"); 248 252 res = 0; 249 253 } … … 253 257 if (p) { 254 258 p[0] = p[1] = p[2] = p[3] = ' '; 255 log_msg(1, "new command = '%s'", command);259 mr_msg(1, "new command = '%s'", command); 256 260 } else { 257 log_msg(3,261 mr_msg(3, 258 262 "Attempt #%d failed. Pausing 3 seconds and retrying...", 259 263 tries + 1); … … 264 268 retval += res; 265 269 if (retval) { 266 log_msg(3, "Failed to write set %d", setno);270 mr_msg(3, "Failed to write set %d", setno); 267 271 } else if (tries > 1) { 268 log_msg(3, "Succeeded in writing set %d, on try #%d", setno,272 mr_msg(3, "Succeeded in writing set %d, on try #%d", setno, 269 273 tries); 270 274 } … … 344 348 strcat(zipparams, tmp); 345 349 } else { 346 log_msg(3, "%s not found. Cannot exclude zipfiles, etc.", tmp);350 mr_msg(3, "%s not found. Cannot exclude zipfiles, etc.", tmp); 347 351 } 348 352 } else { … … 373 377 374 378 for (res = 99, tries = 0; tries < 3 && res != 0; tries++) { 375 log_msg(5, "command='%s'", command);379 mr_msg(5, "command='%s'", command); 376 380 res = system(command); 377 381 if (res) { 378 382 log_OS_error(command); 379 log_msg(3,383 mr_msg(3, 380 384 "Attempt #%d failed. Pausing 3 seconds and retrying...", 381 385 tries + 1); … … 385 389 retval += res; 386 390 if (retval) { 387 log_msg(3, "Failed to write set %d", setno);391 mr_msg(3, "Failed to write set %d", setno); 388 392 } else if (tries > 1) { 389 log_msg(3, "Succeeded in writing set %d, on try #%d", setno,393 mr_msg(3, "Succeeded in writing set %d, on try #%d", setno, 390 394 tries); 391 395 } … … 397 401 if (free_ramdisk_space > i) { 398 402 free_ramdisk_space = i; 399 log_msg(2, "min(free_ramdisk_space) is now %d",403 mr_msg(2, "min(free_ramdisk_space) is now %d", 400 404 free_ramdisk_space); 401 405 if (free_ramdisk_space < 10) { … … 495 499 retval += make_those_slices_phase(bkpinfo); // backup BIG files 496 500 retval += do_that_final_phase(bkpinfo); // clean up 497 log_msg(1, "Creation of archives... complete.");501 mr_msg(1, "Creation of archives... complete."); 498 502 if (bkpinfo->verify_data) { 499 503 sleep(2); … … 574 578 bkpinfo->exclude_paths); 575 579 strcpy(devs_to_exclude, call_program_and_get_last_line_of_output(tmp)); 576 log_msg(2, tmp);580 mr_msg(2, tmp); 577 581 mvaddstr_and_log_it(g_currentY, 0, 578 582 "Calling MINDI to create boot+data disks"); … … 622 626 sprintf(tmp, "User specified boot loader. It is '%c'.", 623 627 bkpinfo->boot_loader); 624 log_msg(2, tmp);628 mr_msg(2, tmp); 625 629 } else { 626 630 bkpinfo->boot_loader = ch; … … 629 633 sprintf(tmp, "User specified boot device. It is '%s'.", 630 634 bkpinfo->boot_device); 631 log_msg(2, tmp);635 mr_msg(2, tmp); 632 636 } else { 633 637 strcpy(bkpinfo->boot_device, bootdev); … … 857 861 //use_gzip_sz); // parameter #20 (STRING) 858 862 859 log_msg(2, command);863 mr_msg(2, command); 860 864 861 865 res = run_program_and_log_to_screen(command, "Generating boot+data disks"); … … 866 870 log_to_screen("Boot+data disks were created OK"); 867 871 sprintf(command, "mkdir -p /var/cache/mindi/"); 868 log_msg(2, command);872 mr_msg(2, command); 869 873 run_program_and_log_output(command, FALSE); 870 874 sprintf(command, 871 875 "cp -f %s/images/mindi.iso /var/cache/mindi/mondorescue.iso", 872 876 bkpinfo->scratchdir); 873 log_msg(2, command);877 mr_msg(2, command); 874 878 run_program_and_log_output(command, FALSE); 875 879 if (bkpinfo->nonbootable_backup) { … … 991 995 } 992 996 if (!semaphore_p()) { 993 log_msg(3, "P sem failed (pid=%d)", (int) getpid());997 mr_msg(3, "P sem failed (pid=%d)", (int) getpid()); 994 998 fatal_error("Cannot get semaphore P"); 995 999 } … … 1008 1012 bkpinfo->tmpdir, archiving_set_no); 1009 1013 if (!does_file_exist(archiving_filelist_fname)) { 1010 log_msg(3,1014 mr_msg(3, 1011 1015 "%s[%d:%d] - well, I would archive %d, except that it doesn't exist. I'll stop now.", 1012 1016 FORTY_SPACES, getpid(), this_thread_no, … … 1018 1022 archiving_set_no - ARCH_BUFFER_NUM, bkpinfo->zip_suffix); 1019 1023 if (does_file_exist(tmp)) { 1020 log_msg(4, "%s[%d:%d] - waiting for storer", FORTY_SPACES,1024 mr_msg(4, "%s[%d:%d] - waiting for storer", FORTY_SPACES, 1021 1025 getpid(), this_thread_no); 1022 1026 while (does_file_exist(tmp)) { 1023 1027 sleep(1); 1024 1028 } 1025 log_msg(4, "[%d] - continuing", getpid());1026 } 1027 1028 log_msg(4, "%s[%d:%d] - EXATing %d...", FORTY_SPACES, getpid(),1029 mr_msg(4, "[%d] - continuing", getpid()); 1030 } 1031 1032 mr_msg(4, "%s[%d:%d] - EXATing %d...", FORTY_SPACES, getpid(), 1029 1033 this_thread_no, archiving_set_no); 1030 1034 if (g_getfattr) { … … 1039 1043 } 1040 1044 1041 log_msg(4, "%s[%d:%d] - archiving %d...", FORTY_SPACES, getpid(),1045 mr_msg(4, "%s[%d:%d] - archiving %d...", FORTY_SPACES, getpid(), 1042 1046 this_thread_no, archiving_set_no); 1043 1047 res = … … 1066 1070 fatal_error("Cannot get semaphore V"); 1067 1071 } 1068 log_msg(4, "%s[%d:%d] - archived %d OK", FORTY_SPACES, getpid(),1072 mr_msg(4, "%s[%d:%d] - archived %d OK", FORTY_SPACES, getpid(), 1069 1073 this_thread_no, archiving_set_no); 1070 1074 archiving_set_no++; … … 1077 1081 fatal_error("Cannot get semaphore V"); 1078 1082 } 1079 log_msg(3, "%s[%d:%d] - exiting", FORTY_SPACES, getpid(),1083 mr_msg(3, "%s[%d:%d] - exiting", FORTY_SPACES, getpid(), 1080 1084 this_thread_no); 1081 1085 mr_free(archiving_filelist_fname); … … 1113 1117 "Writing any remaining data to media "); 1114 1118 1115 log_msg(1, "Closing tape/CD ... ");1119 mr_msg(1, "Closing tape/CD ... "); 1116 1120 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) 1117 1121 /* write tape/cdstream */ … … 1124 1128 retval += res; 1125 1129 if (res) { 1126 log_msg(1, "write_final_iso_if_necessary returned an error");1127 } 1128 } 1129 log_msg(2, "Fork is exiting ... ");1130 mr_msg(1, "write_final_iso_if_necessary returned an error"); 1131 } 1132 } 1133 mr_msg(2, "Fork is exiting ... "); 1130 1134 1131 1135 mvaddstr_and_log_it(g_currentY++, 74, "Done."); … … 1181 1185 strip_spaces(g_serial_string); 1182 1186 strcat(g_serial_string, "...word."); 1183 log_msg(2, "g_serial_string = '%s'", g_serial_string);1187 mr_msg(2, "g_serial_string = '%s'", g_serial_string); 1184 1188 assert(strlen(g_serial_string) < MAX_STR_LEN); 1185 1189 1186 1190 sprintf(tmpfile, "%s/archives/SERIAL-STRING", bkpinfo->scratchdir); 1187 1191 if (write_one_liner_data_file(tmpfile, g_serial_string)) { 1188 log_msg(1, "%ld: Failed to write serial string", __LINE__);1192 mr_msg(1, "%ld: Failed to write serial string", __LINE__); 1189 1193 } 1190 1194 … … 1199 1203 fatal_error("Cannot open backup (streaming) device"); 1200 1204 } 1201 log_msg(1, "Backup (stream) opened OK");1205 mr_msg(1, "Backup (stream) opened OK"); 1202 1206 write_data_disks_to_stream(data_disks_file); 1203 1207 } else { 1204 log_msg(1, "Backing up to CD's");1208 mr_msg(1, "Backing up to CD's"); 1205 1209 } 1206 1210 … … 1275 1279 sprintf(command, "%s >> %s 2>> %s; rm -f %s", cmd, tempfile, tempfile, 1276 1280 tempfile); 1277 log_msg(3, command);1281 mr_msg(3, command); 1278 1282 open_evalcall_form(title); 1279 1283 if (!(pin = popen(command, "r"))) { … … 1289 1293 trackno = get_trackno_from_logfile(tempfile); 1290 1294 if (trackno < 0 || trackno > 80) { 1291 log_msg(1, "Weird track#");1295 mr_msg(1, "Weird track#"); 1292 1296 continue; 1293 1297 } … … 1440 1444 int misc_counter_that_is_not_important = 0; 1441 1445 1442 log_msg(8, "here");1446 mr_msg(8, "here"); 1443 1447 assert(bkpinfo != NULL); 1444 1448 tmp = mr_malloc(MAX_STR_LEN * 2); … … 1466 1470 sprintf(tmp, "%s/archives/filelist.full", bkpinfo->scratchdir); 1467 1471 log_to_screen("Archiving regular files"); 1468 log_msg(5, "Go, Shorty. It's your birthday.");1472 mr_msg(5, "Go, Shorty. It's your birthday."); 1469 1473 open_progress_form("Backing up filesystem", 1470 1474 "I am backing up your live filesystem now.", … … 1473 1477 get_last_filelist_number(bkpinfo) + 1); 1474 1478 1475 log_msg(5, "We're gonna party like it's your birthday.");1479 mr_msg(5, "We're gonna party like it's your birthday."); 1476 1480 1477 1481 srand((unsigned int) getpid()); … … 1486 1490 } // initialize semaphore 1487 1491 for (noof_threads = 0; noof_threads < ARCH_THREADS; noof_threads++) { 1488 log_msg(8, "Creating thread #%d", noof_threads);1492 mr_msg(8, "Creating thread #%d", noof_threads); 1489 1493 (*p_archival_threads_running)++; 1490 1494 if ((res = … … 1496 1500 } 1497 1501 1498 log_msg(8, "About to enter while() loop");1502 mr_msg(8, "About to enter while() loop"); 1499 1503 while (!done_storing) { 1500 1504 if (g_exiting) { … … 1503 1507 if (*p_archival_threads_running == 0 1504 1508 && *p_last_set_archived == storing_set_no - 1) { 1505 log_msg(2,1509 mr_msg(2, 1506 1510 "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... :-)", 1507 1511 *p_last_set_archived, storing_set_no); … … 1532 1536 } 1533 1537 1534 log_msg(2, "Storing set %d", storing_set_no);1538 mr_msg(2, "Storing set %d", storing_set_no); 1535 1539 while (!does_file_exist(storing_filelist_fname) 1536 1540 || !does_file_exist(storing_afioball_fname)) { 1537 log_msg(2,1541 mr_msg(2, 1538 1542 "Warning - either %s or %s doesn't exist yet. I'll pause 5 secs.", 1539 1543 storing_filelist_fname, storing_afioball_fname); … … 1598 1602 1599 1603 sprintf(tmp, "Your regular files have been archived "); 1600 log_msg(2, "Joining background threads to foreground thread");1604 mr_msg(2, "Joining background threads to foreground thread"); 1601 1605 for (i = 0; i < noof_threads; i++) { 1602 1606 pthread_join(archival_thread[i], pvp); 1603 log_msg(3, "Thread %d of %d: closed OK", i + 1, noof_threads);1607 mr_msg(3, "Thread %d of %d: closed OK", i + 1, noof_threads); 1604 1608 } 1605 1609 del_semvalue(); 1606 log_msg(2, "Done.");1610 mr_msg(2, "Done."); 1607 1611 if (retval) { 1608 1612 strcat(tmp, "(with errors)."); … … 1694 1698 if (!does_file_exist(tmp)) 1695 1699 { 1696 log_msg (2, "Silly bug in Mindi.pl; workaround in progress...");1700 mr_msg (2, "Silly bug in Mindi.pl; workaround in progress..."); 1697 1701 strcpy(fnam, call_program_and_get_last_line_of_output("locate isolinux.bin | tail -n1")); 1698 1702 if (strlen(fnam)>0 && does_file_exist(fnam)) … … 1707 1711 if (res) 1708 1712 { 1709 log_msg (2, "Could not work around silly bug in Mindi.pl - sorry! Isolinux.bin missing");1713 mr_msg (2, "Could not work around silly bug in Mindi.pl - sorry! Isolinux.bin missing"); 1710 1714 } 1711 1715 } … … 1717 1721 } 1718 1722 1719 log_msg(2, "make_iso_fs --- scratchdir=%s --- destfile=%s",1723 mr_msg(2, "make_iso_fs --- scratchdir=%s --- destfile=%s", 1720 1724 bkpinfo->scratchdir, destfile); 1721 1725 (void) getcwd(old_pwd, MAX_STR_LEN - 1); … … 1741 1745 1742 1746 if (bkpinfo->call_make_iso[0] != '\0') { 1743 log_msg(2, "bkpinfo->call_make_iso = %s", bkpinfo->call_make_iso);1747 mr_msg(2, "bkpinfo->call_make_iso = %s", bkpinfo->call_make_iso); 1744 1748 sprintf(tmp, "%s/archives/NOT-THE-LAST", bkpinfo->scratchdir); 1745 1749 sprintf(message_to_screen, "Making an ISO (%s #%d)", … … 1790 1794 sprintf(sz_blank_disk, "dvd+rw-format -force %s", 1791 1795 bkpinfo->media_device); 1792 log_msg(3, "sz_blank_disk = '%s'", sz_blank_disk);1796 mr_msg(3, "sz_blank_disk = '%s'", sz_blank_disk); 1793 1797 res = 1794 1798 run_external_binary_with_percentage_indicator_NEW … … 1843 1847 media_descriptor_string(bkpinfo->backup_media_type), 1844 1848 g_current_media_number); 1845 log_msg(1, message_to_screen);1849 mr_msg(1, message_to_screen); 1846 1850 sprintf(result_sz, "Call to mkisofs to make ISO (%s #%d) ", 1847 1851 media_descriptor_string(bkpinfo->backup_media_type), 1848 1852 g_current_media_number); 1849 1853 if (bkpinfo->nonbootable_backup) { 1850 log_msg(1, "Making nonbootable backup");1854 mr_msg(1, "Making nonbootable backup"); 1851 1855 res = 1852 1856 eval_call_to_make_ISO(bkpinfo, … … 1855 1859 MONDO_LOGFILE, message_to_screen); 1856 1860 } else { 1857 log_msg(1, "Making bootable backup");1861 mr_msg(1, "Making bootable backup"); 1858 1862 1859 1863 #ifdef __FreeBSD__ … … 1862 1866 1863 1867 1864 log_msg(1, "make_cd_use_lilo is actually %d",1868 mr_msg(1, "make_cd_use_lilo is actually %d", 1865 1869 bkpinfo->make_cd_use_lilo); 1866 1870 if (bkpinfo->make_cd_use_lilo) { 1867 log_msg(1, "make_cd_use_lilo = TRUE");1871 mr_msg(1, "make_cd_use_lilo = TRUE"); 1868 1872 // FIXME --- change mkisofs string to MONDO_MKISOFS_REGULAR_SYSLINUX/LILO depending on bkpinfo->make_cd_usE_lilo 1869 1873 // and add ' .' at end 1870 1874 #ifdef __IA64__ 1871 log_msg(1, "IA64 --> elilo");1875 mr_msg(1, "IA64 --> elilo"); 1872 1876 res = eval_call_to_make_ISO(bkpinfo, 1873 1877 //-b images/mindi-boot.2880.img … … 1882 1886 // FIXME --- change mkisofs string to MONDO_MKISOFS_REGULAR_SYSLINUX/LILO depending on bkpinfo->make_cd_usE_lilo 1883 1887 // and add ' .' at end 1884 log_msg(1, "Non-ia64 --> lilo");1888 mr_msg(1, "Non-ia64 --> lilo"); 1885 1889 res = 1886 1890 eval_call_to_make_ISO(bkpinfo, … … 1891 1895 #endif 1892 1896 } else { 1893 log_msg(1, "make_cd_use_lilo = FALSE");1894 log_msg(1, "Isolinux");1897 mr_msg(1, "make_cd_use_lilo = FALSE"); 1898 mr_msg(1, "Isolinux"); 1895 1899 res = 1896 1900 eval_call_to_make_ISO(bkpinfo, … … 1913 1917 || bkpinfo->backup_media_type == cdrw) { 1914 1918 if (is_this_device_mounted(bkpinfo->media_device)) { 1915 log_msg(2,1919 mr_msg(2, 1916 1920 "Warning - %s mounted. I'm unmounting it before I burn to it.", 1917 1921 bkpinfo->media_device); … … 1922 1926 1923 1927 if (bkpinfo->call_burn_iso[0] != '\0') { 1924 log_msg(2, "bkpinfo->call_burn_iso = %s", bkpinfo->call_burn_iso);1928 mr_msg(2, "bkpinfo->call_burn_iso = %s", bkpinfo->call_burn_iso); 1925 1929 sprintf(message_to_screen, "Burning %s #%d", 1926 1930 media_descriptor_string(bkpinfo->backup_media_type), … … 1959 1963 chdir(old_pwd); 1960 1964 if (retval) { 1961 log_msg(1, "WARNING - make_iso_fs returned an error");1965 mr_msg(1, "WARNING - make_iso_fs returned an error"); 1962 1966 } 1963 1967 mr_free(old_pwd); … … 1987 1991 "dd if=%s bs=512 count=1 2> /dev/null | strings | head -n1", 1988 1992 bigfile_fname); 1989 log_msg(1, "command = '%s'", command);1993 mr_msg(1, "command = '%s'", command); 1990 1994 strcpy(tmp, call_program_and_get_last_line_of_output(command)); 1991 log_msg(1, "--> tmp = '%s'", tmp);1995 mr_msg(1, "--> tmp = '%s'", tmp); 1992 1996 if (strstr(tmp, "NTFS")) { 1993 1997 iamhere("TRUE"); … … 2050 2054 size_of_all_biggiefiles_K(bkpinfo) / bkpinfo->optimal_set_size + 1; 2051 2055 2052 log_msg(1, "size of all biggiefiles = %ld",2056 mr_msg(1, "size of all biggiefiles = %ld", 2053 2057 size_of_all_biggiefiles_K(bkpinfo)); 2054 log_msg(1, "estimated_total_noof_slices = %ld KB / %ld KB = %ld",2058 mr_msg(1, "estimated_total_noof_slices = %ld KB / %ld KB = %ld", 2055 2059 size_of_all_biggiefiles_K(bkpinfo), bkpinfo->optimal_set_size, 2056 2060 estimated_total_noof_slices); 2057 2061 2058 2062 if (length_of_file(biggielist_fname) < 6) { 2059 log_msg(1, "No biggiefiles; fair enough...");2063 mr_msg(1, "No biggiefiles; fair enough..."); 2060 2064 return (0); 2061 2065 } … … 2088 2092 // Call ntfsclone (formerly partimagehack) if it's a /dev entry 2089 2093 // (i.e. a partition to be imaged) 2090 log_msg(2, "bigfile_fname = %s", bigfile_fname);2094 mr_msg(2, "bigfile_fname = %s", bigfile_fname); 2091 2095 use_ntfsprog = FALSE; 2092 2096 if (!strncmp(bigfile_fname, "/dev/", 5) 2093 2097 && is_dev_an_NTFS_dev(bigfile_fname)) { 2094 2098 use_ntfsprog = TRUE; 2095 log_msg(2,2099 mr_msg(2, 2096 2100 "Calling ntfsclone in background because %s is an NTFS partition", 2097 2101 bigfile_fname); … … 2106 2110 fatal_error("Fork failure"); 2107 2111 case 0: 2108 log_msg(2,2112 mr_msg(2, 2109 2113 "CHILD - fip - calling feed_into_ntfsprog(%s, %s)", 2110 2114 bigfile_fname, sz_devfile); … … 2113 2117 break; 2114 2118 default: 2115 log_msg(2,2119 mr_msg(2, 2116 2120 "feed_into_ntfsprog() called in background --- pid=%ld", 2117 2121 (long int) (pid)); … … 2169 2173 #endif 2170 2174 } 2171 log_msg(1, "Finished backing up bigfiles");2172 log_msg(1, "estimated slices = %ld; actual slices = %ld",2175 mr_msg(1, "Finished backing up bigfiles"); 2176 mr_msg(1, "estimated slices = %ld; actual slices = %ld", 2173 2177 estimated_total_noof_slices, g_current_progress); 2174 2178 close_progress_form(); … … 2233 2237 bkpinfo->tmpdir, curr_set_no, bkpinfo->zip_suffix); 2234 2238 2235 log_msg(1, "EXAT'g set %ld", curr_set_no);2239 mr_msg(1, "EXAT'g set %ld", curr_set_no); 2236 2240 if (g_getfattr) { 2237 2241 sprintf(curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, … … 2245 2249 } 2246 2250 2247 log_msg(1, "Archiving set %ld", curr_set_no);2251 mr_msg(1, "Archiving set %ld", curr_set_no); 2248 2252 res = 2249 2253 archive_this_fileset(bkpinfo, curr_filelist_fname, … … 2349 2353 BLK_START_AFIOBALLS); 2350 2354 #if __FreeBSD__ == 5 2351 log_msg(1,2355 mr_msg(1, 2352 2356 "Using single-threaded make_afioballs_and_images() to suit b0rken FreeBSD 5.0"); 2353 2357 res = make_afioballs_and_images_OLD(bkpinfo); … … 2364 2368 if (res) { 2365 2369 mvaddstr_and_log_it(g_currentY++, 74, "Errors."); 2366 log_msg(1, "make_afioballs_and_images returned an error");2370 mr_msg(1, "make_afioballs_and_images returned an error"); 2367 2371 } else { 2368 2372 mvaddstr_and_log_it(g_currentY++, 74, "Done."); … … 2415 2419 paranoid_system(command); 2416 2420 sprintf(blah, "biggielist = %s", biggielist); 2417 log_msg(2, blah);2421 mr_msg(2, blah); 2418 2422 2419 2423 if (!does_file_exist(biggielist)) { 2420 log_msg(1, "BTW, the biggielist does not exist");2424 mr_msg(1, "BTW, the biggielist does not exist"); 2421 2425 } 2422 2426 … … 2445 2449 retval += res; 2446 2450 if (res) { 2447 log_msg(1, "make_slices_and_images returned an error");2451 mr_msg(1, "make_slices_and_images returned an error"); 2448 2452 mvaddstr_and_log_it(g_currentY++, 74, "Errors."); 2449 2453 } else { … … 2515 2519 strcpy(curr_file, cf); 2516 2520 if (!does_file_exist(curr_file)) { 2517 log_msg(1,2521 mr_msg(1, 2518 2522 "Warning - you're trying to add a non-existent file - '%s' to the CD", 2519 2523 curr_file); 2520 2524 } else { 2521 log_msg(8, "Trying to add file %s to CD", curr_file);2525 mr_msg(8, "Trying to add file %s to CD", curr_file); 2522 2526 would_occupy += length_of_file(curr_file) / 1024; 2523 2527 } … … 2532 2536 retval += res; 2533 2537 if (res) { 2534 log_msg(1, "WARNING - write_iso_and_go_on returned an error");2538 mr_msg(1, "WARNING - write_iso_and_go_on returned an error"); 2535 2539 } 2536 2540 } … … 2548 2552 retval += res; 2549 2553 if (res) { 2550 log_msg(1, "(move_files_to_cd) '%s' failed", tmp);2554 mr_msg(1, "(move_files_to_cd) '%s' failed", tmp); 2551 2555 } else { 2552 log_msg(8, "Moved %s to CD OK", tmp);2556 mr_msg(8, "Moved %s to CD OK", tmp); 2553 2557 } 2554 2558 // unlink (curr_file); … … 2557 2561 2558 2562 if (retval) { 2559 log_msg(1,2563 mr_msg(1, 2560 2564 "Warning - errors occurred while I was adding files to CD dir"); 2561 2565 } … … 2627 2631 sprintf(bootdisk_dev, "/dev/fd0H1722"); 2628 2632 } else { 2629 log_msg(1, "Warning - can't find a 1.72MB floppy device *sigh*");2633 mr_msg(1, "Warning - can't find a 1.72MB floppy device *sigh*"); 2630 2634 strcpy(bootdisk_dev, DEFAULT_1722MB_DISK); 2631 2635 // return (1); … … 2633 2637 strcpy(datadisk_dev, "/dev/fd0"); 2634 2638 if (!does_device_exist(datadisk_dev)) { 2635 log_msg(1, "Warning - can't find a 1.44MB floppy device *sigh*");2639 mr_msg(1, "Warning - can't find a 1.44MB floppy device *sigh*"); 2636 2640 strcpy(datadisk_dev, "/dev/fd0"); 2637 2641 // return (1); … … 2691 2695 } 2692 2696 sprintf(tmp, "cat %s > %s", rootdisk_file, datadisk_dev); 2693 log_msg(1, "tmp = '%s'", tmp);2697 mr_msg(1, "tmp = '%s'", tmp); 2694 2698 res += 2695 2699 run_external_binary_with_percentage_indicator_NEW … … 2707 2711 for (i = 1; i < 99; i++) { 2708 2712 sprintf(tmp, "%s/mindi-data-%d.img", imagesdir, i); 2709 log_msg(3, tmp);2713 mr_msg(3, tmp); 2710 2714 if (!does_file_exist(tmp)) { 2711 log_msg(3, "...not found");2715 mr_msg(3, "...not found"); 2712 2716 break; 2713 2717 } … … 2837 2841 strcpy(curr_file, cf); 2838 2842 if (!does_file_exist(curr_file)) { 2839 log_msg(1,2843 mr_msg(1, 2840 2844 "Warning - you're trying to add a non-existent file - '%s' to the tape", 2841 2845 curr_file); … … 2864 2868 2865 2869 if (retval) { 2866 log_msg(1,2870 mr_msg(1, 2867 2871 "Warning - errors occurred while I was adding file to tape"); 2868 2872 } … … 2907 2911 } else { 2908 2912 cdrecord[0] = '\0'; 2909 log_msg(2, "Oh well. I guess I'll just pray then.");2913 mr_msg(2, "Oh well. I guess I'll just pray then."); 2910 2914 } 2911 2915 if (cdrecord[0]) { … … 2919 2923 ("Unable to examine CD. Are you sure this is a valid CD-R(W) CD?")) 2920 2924 { 2921 log_msg(1, "Well, he insisted...");2925 mr_msg(1, "Well, he insisted..."); 2922 2926 break; 2923 2927 } … … 2990 2994 if (!find_cdrom_device(cdrom_dev, FALSE)) { 2991 2995 /* When enabled, it made CD eject-and-retract when wrong CD inserted.. Weird 2992 log_msg(2, "paafcd: Retracting CD-ROM drive if possible" );2996 mr_msg(2, "paafcd: Retracting CD-ROM drive if possible" ); 2993 2997 retract_CD_tray_and_defeat_autorun(); 2994 2998 */ … … 3003 3007 if ((attempt_to_mount_returned_this = 3004 3008 run_program_and_log_output(tmp, 1))) { 3005 log_msg(4, "Failed to mount %s at %s", cdrom_dev, mtpt);3009 mr_msg(4, "Failed to mount %s at %s", cdrom_dev, mtpt); 3006 3010 log_to_screen("If there's a CD/DVD in the drive, it's blank."); 3007 3011 /* … … 3031 3035 } 3032 3036 run_program_and_log_output(szunmount, 1); 3033 log_msg(2, "paafcd: cd_number = %d", cd_number);3034 log_msg(2, "our serial str = %s; g_serial_string = %s",3037 mr_msg(2, "paafcd: cd_number = %d", cd_number); 3038 mr_msg(2, "our serial str = %s; g_serial_string = %s", 3035 3039 our_serial_str, g_serial_string); 3036 3040 if (cd_number > 0 && !strcmp(our_serial_str, g_serial_string)) { 3037 log_msg(2, "This %s is part of this backup set!",3041 mr_msg(2, "This %s is part of this backup set!", 3038 3042 media_descriptor_string(g_backup_media_type)); 3039 3043 ok_go_ahead_burn_it = FALSE; … … 3051 3055 } 3052 3056 } else { 3053 log_msg(2,3057 mr_msg(2, 3054 3058 "paafcd: Can't find CD-ROM drive. Perhaps it has a blank %s in it?", 3055 3059 media_descriptor_string(g_backup_media_type)); … … 3079 3083 goto gotos_make_me_puke; 3080 3084 } else { 3081 log_msg(2, "paafcd: OK, going ahead and burning it.");3082 } 3083 3084 log_msg(2,3085 mr_msg(2, "paafcd: OK, going ahead and burning it."); 3086 } 3087 3088 mr_msg(2, 3085 3089 "paafcd: OK, I assume I have a blank/reusable %s in the drive...", 3086 3090 media_descriptor_string(g_backup_media_type)); … … 3241 3245 file_to_openin = ntfsprog_fifo; 3242 3246 strcpy(checksum_line, "IGNORE"); 3243 log_msg(2,3247 mr_msg(2, 3244 3248 "Not calculating checksum for %s: it would take too long", 3245 3249 biggie_filename); … … 3283 3287 paranoid_fclose(fout); 3284 3288 length = totallength / optimal_set_size / 1024; 3285 log_msg(1, "Opening in %s; slicing it and writing to CD/tape",3289 mr_msg(1, "Opening in %s; slicing it and writing to CD/tape", 3286 3290 file_to_openin); 3287 3291 if (!(fin = fopen(file_to_openin, "r"))) { … … 3340 3344 { 3341 3345 if (!does_file_exist(curr_slice_fname_uncompressed)) { 3342 log_msg(2,3346 mr_msg(2, 3343 3347 "Warning - '%s' doesn't exist. How can I compress slice?", 3344 3348 curr_slice_fname_uncompressed); … … 3348 3352 bkpinfo->compression_level, 3349 3353 curr_slice_fname_uncompressed); 3350 log_msg(2, command);3354 mr_msg(2, command); 3351 3355 if ((res = system(command))) { 3352 3356 log_OS_error(command); … … 3362 3366 retval += res; 3363 3367 if (res) { 3364 log_msg(2, "Failed to compress the slice");3368 mr_msg(2, "Failed to compress the slice"); 3365 3369 } 3366 3370 if (bkpinfo->use_lzo … … 3382 3386 newtRefresh(); 3383 3387 } else { 3384 log_msg(2, tmp);3388 mr_msg(2, tmp); 3385 3389 } 3386 3390 #else 3387 log_msg(2, tmp);3391 mr_msg(2, tmp); 3388 3392 #endif 3389 3393 strcpy(file_to_archive, curr_slice_fname_compressed); … … 3424 3428 strcat(tmp, "...OK!"); 3425 3429 } 3426 log_msg(1, tmp);3430 mr_msg(1, tmp); 3427 3431 mr_free(tempblock); 3428 3432 mr_free(tmp); … … 3474 3478 sprintf(tmp, "rm -f %s/zero", dir); 3475 3479 run_program_and_log_output(tmp, FALSE); 3476 log_msg(1, "Wiped %s's archives", dir);3480 mr_msg(1, "Wiped %s's archives", dir); 3477 3481 sprintf(tmp, "ls -l %s", dir); 3478 3482 run_program_and_log_output(tmp, FALSE); … … 3511 3515 3512 3516 sprintf(tmp, "Writing the final ISO"); 3513 log_msg(2, tmp);3517 mr_msg(2, tmp); 3514 3518 center_string(tmp, 80); 3515 3519 #ifndef _XWIN … … 3524 3528 } 3525 3529 #endif 3526 log_msg(2, "Returning from writing final ISO (res=%d)", res);3530 mr_msg(2, "Returning from writing final ISO (res=%d)", res); 3527 3531 mr_free(tmp); 3528 3532 return (res); … … 3582 3586 using_nfs = FALSE; 3583 3587 } 3584 log_msg(1, "OK, time to make %s #%d",3588 mr_msg(1, "OK, time to make %s #%d", 3585 3589 media_descriptor_string(bkpinfo->backup_media_type), 3586 3590 g_current_media_number); … … 3596 3600 bkpinfo->scratchdir); 3597 3601 if (run_program_and_log_output(tmp, FALSE)) { 3598 log_msg(2, "Warning - unable to copy autorun to scratchdir");3602 mr_msg(2, "Warning - unable to copy autorun to scratchdir"); 3599 3603 } 3600 3604 … … 3603 3607 if (last_cd) { 3604 3608 unlink(lastcd_fname); 3605 log_msg(2,3609 mr_msg(2, 3606 3610 "OK, you're telling me this is the last CD. Fair enough."); 3607 3611 } else { … … 3636 3640 if (find_cdrom_device(tmp, FALSE)) // make sure find_cdrom_device() finds, records CD-R's loc 3637 3641 { 3638 log_msg(3, "*Sigh* Mike, I hate your computer.");3642 mr_msg(3, "*Sigh* Mike, I hate your computer."); 3639 3643 bkpinfo->manual_cd_tray = TRUE; 3640 3644 } // if it can't be found then force pausing 3641 3645 else { 3642 log_msg(3, "Great. Found Mike's CD-ROM drive.");3646 mr_msg(3, "Great. Found Mike's CD-ROM drive."); 3643 3647 } 3644 3648 } … … 3666 3670 } 3667 3671 } else { 3668 log_msg(2, "Retrying, at user's request...");3672 mr_msg(2, "Retrying, at user's request..."); 3669 3673 res = 0; 3670 3674 } … … 3687 3691 bkpinfo->scratchdir, bkpinfo->scratchdir); 3688 3692 if (system(tmp)) { 3689 log_msg3693 mr_msg 3690 3694 (2, 3691 3695 "Error occurred when I tried to delete the redundant IMGs and GZs"); … … 3693 3697 3694 3698 if (last_cd) { 3695 log_msg(2, "This was your last CD.");3699 mr_msg(2, "This was your last CD."); 3696 3700 } else { 3697 log_msg(2, "Continuing to backup your data...");3701 mr_msg(2, "Continuing to backup your data..."); 3698 3702 } 3699 3703 … … 3742 3746 //bkpinfo->backup_media_type == cdrw || bkpinfo->backup_media_type == cdr)) 3743 3747 { 3744 log_msg(2,3748 mr_msg(2, 3745 3749 "Not verifying again. Per-CD/ISO verification already carried out."); 3746 3750 paranoid_system … … 3754 3758 for (cdno = 1; cdno < 99 && bkpinfo->verify_data; cdno++) { 3755 3759 if (cdno != g_current_media_number) { 3756 log_msg(2,3760 mr_msg(2, 3757 3761 "Warning - had to change g_current_media_number from %d to %d", 3758 3762 g_current_media_number, cdno); … … 3857 3861 } 3858 3862 sprintf(tmp, "maxblocks = %d; p=%s", maxblocks, p); 3859 log_msg(2, tmp);3863 mr_msg(2, tmp); 3860 3864 /* copy data from image to floppy */ 3861 3865 if (!(fin = fopen(datafile, "r"))) { … … 3871 3875 if (fread(blk, 1, 1024, fin) != 1024) { 3872 3876 if (feof(fin)) { 3873 log_msg(1,3877 mr_msg(1, 3874 3878 "img read err - img ended prematurely - non-fatal error"); 3875 3879 sleep(3);
Note:
See TracChangeset
for help on using the changeset viewer.