Changeset 2323 in MondoRescue for branches/2.2.10/mondo/src/mondorestore/mondorestore.c
- Timestamp:
- Aug 18, 2009, 3:05:43 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/mondorestore/mondorestore.c
r2321 r2323 280 280 } 281 281 if (g_ISO_restore_mode) { 282 mr_asprintf( &tmp, "umount %s", bkpinfo->isodir);282 mr_asprintf(tmp, "umount %s", bkpinfo->isodir); 283 283 run_program_and_log_output(tmp, FALSE); 284 284 mr_free(tmp); … … 361 361 362 362 /* Clean up blkid cache file if they exist */ 363 mr_asprintf( &tmp1,"%s/etc/blkid.tab",bkpinfo->restore_path);363 mr_asprintf(tmp1,"%s/etc/blkid.tab",bkpinfo->restore_path); 364 364 (void)unlink(tmp1); 365 365 paranoid_free(tmp1); 366 mr_asprintf( &tmp1,"%s/etc/blkid.tab.old",bkpinfo->restore_path);366 mr_asprintf(tmp1,"%s/etc/blkid.tab.old",bkpinfo->restore_path); 367 367 (void)unlink(tmp1); 368 368 paranoid_free(tmp1); … … 376 376 377 377 /* Clean up multiconf cache file if they exist */ 378 mr_asprintf( &tmp1,"%s/var/lib/multipath/bindings",bkpinfo->restore_path);378 mr_asprintf(tmp1,"%s/var/lib/multipath/bindings",bkpinfo->restore_path); 379 379 (void)unlink(tmp1); 380 380 paranoid_free(tmp1); 381 381 382 382 /* Edit multipath.conf if needed to adapt wwid */ 383 mr_asprintf( &tmp1,"%s/etc/multipath.conf", MNT_RESTORING);383 mr_asprintf(tmp1,"%s/etc/multipath.conf", MNT_RESTORING); 384 384 if (does_file_exist(tmp1)) { 385 385 log_msg(2, "We may need to clean /etc/multipath.conf"); … … 391 391 392 392 if (bkpinfo->restore_mode != nuke) { 393 mr_asprintf( &editor, "%s", find_my_editor());394 mr_asprintf( &tmp1,"chroot %s %s /etc/multipath.conf", MNT_RESTORING, editor);393 mr_asprintf(editor, "%s", find_my_editor()); 394 mr_asprintf(tmp1,"chroot %s %s /etc/multipath.conf", MNT_RESTORING, editor); 395 395 popup_and_OK("You will now edit multipath.conf"); 396 396 if (!g_text_mode) { … … 490 490 if (g_text_mode) { 491 491 save_mountlist_to_disk(mountlist, g_mountlist_fname); 492 mr_asprintf( &tmp1, "%s %s", find_my_editor(), g_mountlist_fname);492 mr_asprintf(tmp1, "%s %s", find_my_editor(), g_mountlist_fname); 493 493 res = system(tmp1); 494 494 mr_free(tmp1); … … 663 663 strcpy(fstab_fname, "/tmp/fstab"); 664 664 } 665 mr_asprintf( &tmp1, "label-partitions-as-necessary %s < %s >> %s 2>> %s", g_mountlist_fname, fstab_fname, MONDO_LOGFILE, MONDO_LOGFILE);665 mr_asprintf(tmp1, "label-partitions-as-necessary %s < %s >> %s 2>> %s", g_mountlist_fname, fstab_fname, MONDO_LOGFILE, MONDO_LOGFILE); 666 666 res = system(tmp1); 667 667 mr_free(tmp1); … … 780 780 assert(raidlist != NULL); 781 781 782 mr_asprintf( &tmpA, "%s", " ");783 mr_asprintf( &tmpB, "%s", " ");784 mr_asprintf( &tmpC, "%s", " ");782 mr_asprintf(tmpA, "%s", " "); 783 mr_asprintf(tmpB, "%s", " "); 784 mr_asprintf(tmpC, "%s", " "); 785 785 786 786 log_msg(2, "nuke_mode --- starting"); … … 803 803 } 804 804 if (!evaluate_mountlist(mountlist, tmpA, tmpB, tmpC)) { 805 mr_asprintf( &tmp, "Mountlist analyzed. Result: \"%s %s %s\" Switch to Interactive Mode?", tmpA, tmpB, tmpC);805 mr_asprintf(tmp, "Mountlist analyzed. Result: \"%s %s %s\" Switch to Interactive Mode?", tmpA, tmpB, tmpC); 806 806 res = ask_me_yes_or_no(tmp); 807 807 mr_free(tmp); … … 895 895 "Using tune2fs to identify your ext2,3 partitions"); 896 896 897 mr_asprintf( &tmp, "label-partitions-as-necessary %s < /tmp/fstab", g_mountlist_fname);897 mr_asprintf(tmp, "label-partitions-as-necessary %s < /tmp/fstab", g_mountlist_fname); 898 898 res = run_program_and_log_output(tmp, TRUE); 899 899 mr_free(tmp); … … 915 915 ("Please visit our website at http://www.mondorescue.org for more information."); 916 916 } else { 917 mr_asprintf( &tmp,"%s","Mondo has restored your system.\n\nPlease wait for the command prompt. Then remove the backup media and reboot.\n\nPlease visit our website at http://www.mondorescue.org for more information.");917 mr_asprintf(tmp,"%s","Mondo has restored your system.\n\nPlease wait for the command prompt. Then remove the backup media and reboot.\n\nPlease visit our website at http://www.mondorescue.org for more information."); 918 918 popup_and_OK(tmp); 919 919 mr_free(tmp); … … 1121 1121 if (!strncmp(biggiestruct.filename, "/dev/", 5)) // Whether NTFS or not :) 1122 1122 { 1123 mr_asprintf( &outfile_fname, "%s", biggiestruct.filename);1123 mr_asprintf(outfile_fname, "%s", biggiestruct.filename); 1124 1124 } else { 1125 mr_asprintf( &outfile_fname, "%s/%s", bkpinfo->restore_path, biggiestruct.filename);1125 mr_asprintf(outfile_fname, "%s/%s", bkpinfo->restore_path, biggiestruct.filename); 1126 1126 } 1127 1127 … … 1159 1159 use_ntfsprog_hack = TRUE; 1160 1160 log_msg(2, "Calling ntfsclone in background because %s is an NTFS /dev entry", outfile_fname); 1161 mr_asprintf( &sz_devfile, "/tmp/%d.%d.000", (int) (random() % 32768),1161 mr_asprintf(sz_devfile, "/tmp/%d.%d.000", (int) (random() % 32768), 1162 1162 (int) (random() % 32768)); 1163 1163 mkfifo(sz_devfile, 0x770); … … 1232 1232 mr_free(mds); 1233 1233 1234 mr_asprintf( &tmp, "Restoring from %s #%d", mds, g_current_media_number);1234 mr_asprintf(tmp, "Restoring from %s #%d", mds, g_current_media_number); 1235 1235 log_to_screen(tmp); 1236 1236 mr_free(tmp); … … 1239 1239 log_to_screen("Continuing to restore."); 1240 1240 } else { 1241 mr_asprintf( &tmp, "%s", slice_fname(bigfileno, sliceno, ARCHIVES_PATH, ""));1241 mr_asprintf(tmp, "%s", slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "")); 1242 1242 if (does_file_exist(tmp) && length_of_file(tmp) == 0) { 1243 1243 log_msg(2, … … 1251 1251 (slice_fname 1252 1252 (bigfileno, sliceno, ARCHIVES_PATH, "lzo"))) { 1253 mr_asprintf( &bzip2_command, "lzop");1253 mr_asprintf(bzip2_command, "lzop"); 1254 1254 strcpy(suffix, "lzo"); 1255 1255 } else … … 1257 1257 (slice_fname 1258 1258 (bigfileno, sliceno, ARCHIVES_PATH, "gz"))) { 1259 mr_asprintf( &bzip2_command, "gzip");1259 mr_asprintf(bzip2_command, "gzip"); 1260 1260 strcpy(suffix, "gz"); 1261 1261 } else … … 1263 1263 (slice_fname 1264 1264 (bigfileno, sliceno, ARCHIVES_PATH, "bz2"))) { 1265 mr_asprintf( &bzip2_command, "bzip2");1265 mr_asprintf(bzip2_command, "bzip2"); 1266 1266 strcpy(suffix, "bz2"); 1267 1267 } else … … 1269 1269 (slice_fname 1270 1270 (bigfileno, sliceno, ARCHIVES_PATH, ""))) { 1271 mr_asprintf( &bzip2_command, "");1271 mr_asprintf(bzip2_command, ""); 1272 1272 strcpy(suffix, ""); 1273 1273 } else { … … 1282 1282 slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE); 1283 1283 } else { 1284 mr_asprintf( &bzip2_command, "cat %s 2>> %s",1284 mr_asprintf(bzip2_command, "cat %s 2>> %s", 1285 1285 slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE); 1286 1286 } 1287 1287 mds = media_descriptor_string(bkpinfo->backup_media_type); 1288 mr_asprintf( &tmp, "Working on %s #%d, file #%ld, slice #%ld ", mds, g_current_media_number, bigfileno + 1, sliceno);1288 mr_asprintf(tmp, "Working on %s #%d, file #%ld, slice #%ld ", mds, g_current_media_number, bigfileno + 1, sliceno); 1289 1289 mr_free(mds); 1290 1290 log_msg(2, tmp); … … 1321 1321 if (use_ntfsprog_hack) { 1322 1322 log_msg(3, "Waiting for ntfsclone to finish"); 1323 mr_asprintf( &tmp, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null");1323 mr_asprintf(tmp, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null"); 1324 1324 while (system(tmp) == 0) { 1325 1325 sleep(1); … … 1452 1452 if (use_ntfsprog) { 1453 1453 g_loglevel = 4; 1454 mr_asprintf( &outfile_fname, "%s", orig_bf_fname);1454 mr_asprintf(outfile_fname, "%s", orig_bf_fname); 1455 1455 use_ntfsprog_hack = TRUE; 1456 1456 log_msg(2, "Calling ntfsclone in background because %s is a /dev entry", outfile_fname); 1457 mr_asprintf( &sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, (int) (random() % 32768), (int) (random() % 32768));1457 mr_asprintf(sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, (int) (random() % 32768), (int) (random() % 32768)); 1458 1458 mkfifo(sz_devfile, 0x770); 1459 1459 strcpy(ntfsprog_fifo, sz_devfile); … … 1475 1475 if (!strncmp(orig_bf_fname, "/dev/", 5)) { 1476 1476 // non-NTFS partition 1477 mr_asprintf( &outfile_fname, "%s", orig_bf_fname);1477 mr_asprintf(outfile_fname, "%s", orig_bf_fname); 1478 1478 } else { 1479 1479 // biggiefile 1480 mr_asprintf( &outfile_fname, "%s/%s", bkpinfo->restore_path, orig_bf_fname);1480 mr_asprintf(outfile_fname, "%s/%s", bkpinfo->restore_path, orig_bf_fname); 1481 1481 } 1482 1482 use_ntfsprog_hack = FALSE; … … 1492 1492 if (dummy_restore) { 1493 1493 mr_free(outfile_fname); 1494 mr_asprintf( &outfile_fname, "/dev/null");1494 mr_asprintf(outfile_fname, "/dev/null"); 1495 1495 } 1496 1496 1497 1497 if (!bkpinfo->zip_exe[0]) { 1498 mr_asprintf( &command, "cat > \"%s\"", file_to_openout);1498 mr_asprintf(command, "cat > \"%s\"", file_to_openout); 1499 1499 } else { 1500 mr_asprintf( &command, "%s -dc > \"%s\" 2>> %s", bkpinfo->zip_exe, file_to_openout, MONDO_LOGFILE);1500 mr_asprintf(command, "%s -dc > \"%s\" 2>> %s", bkpinfo->zip_exe, file_to_openout, MONDO_LOGFILE); 1501 1501 if (strcmp(bkpinfo->zip_exe, "gzip") == 0) { 1502 1502 /* Ignore SIGPIPE for gzip as it causes errors on big files … … 1568 1568 if (use_ntfsprog_hack) { 1569 1569 log_msg(3, "Waiting for ntfsclone to finish"); 1570 mr_asprintf( &tmp1, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null");1570 mr_asprintf(tmp1, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null"); 1571 1571 while (system(tmp1) == 0) { 1572 1572 sleep(1); … … 1637 1637 log_msg(5, "Entering"); 1638 1638 use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE; 1639 mr_asprintf( &command, "mkdir -p %s/tmp", MNT_RESTORING);1639 mr_asprintf(command, "mkdir -p %s/tmp", MNT_RESTORING); 1640 1640 run_program_and_log_output(command, 9); 1641 1641 paranoid_free(command); 1642 1642 1643 mr_asprintf( &filelist_name, MNT_CDROM "/archives/filelist.%ld", current_tarball_number);1643 mr_asprintf(filelist_name, MNT_CDROM "/archives/filelist.%ld", current_tarball_number); 1644 1644 if (length_of_file(filelist_name) <= 2) { 1645 1645 log_msg(2, "There are _zero_ files in filelist '%s'", filelist_name); … … 1654 1654 log_msg(3, "length_of_file(%s) = %llu", tarball_fname, length_of_file(tarball_fname)); 1655 1655 log_msg(3, "count_lines_in_file(%s) = %llu", tarball_fname, count_lines_in_file(tarball_fname)); 1656 mr_asprintf( &tmp, "Unable to restore fileset #%ld (CD I/O error)", current_tarball_number);1656 mr_asprintf(tmp, "Unable to restore fileset #%ld (CD I/O error)", current_tarball_number); 1657 1657 log_to_screen(tmp); 1658 1658 mr_free(tmp); … … 1663 1663 1664 1664 if (filelist) { 1665 mr_asprintf( &filelist_subset_fname, "/tmp/filelist-subset-%ld.tmp", current_tarball_number);1665 mr_asprintf(filelist_subset_fname, "/tmp/filelist-subset-%ld.tmp", current_tarball_number); 1666 1666 if ((matches = 1667 1667 save_filelist_entries_in_common(filelist_name, filelist, … … 1672 1672 log_msg(3, "Saved fileset %ld's subset to %s", current_tarball_number, filelist_subset_fname); 1673 1673 } 1674 mr_asprintf( &screen_message, "Tarball #%ld --- %ld matches", current_tarball_number, matches);1674 mr_asprintf(screen_message, "Tarball #%ld --- %ld matches", current_tarball_number, matches); 1675 1675 log_to_screen(screen_message); 1676 1676 mr_free(screen_message); … … 1680 1680 if (filelist == NULL || matches > 0) { 1681 1681 if (g_getfattr) { 1682 mr_asprintf( &xattr_fname, XATTR_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number);1682 mr_asprintf(xattr_fname, XATTR_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number); 1683 1683 } 1684 1684 if (g_getfacl) { 1685 mr_asprintf( &acl_fname, ACL_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number);1685 mr_asprintf(acl_fname, ACL_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number); 1686 1686 } 1687 1687 if (strstr(tarball_fname, ".bz2")) { 1688 mr_asprintf( &executable, "bzip2");1688 mr_asprintf(executable, "bzip2"); 1689 1689 } else if (strstr(tarball_fname, ".gz")) { 1690 mr_asprintf( &executable, "gzip");1690 mr_asprintf(executable, "gzip"); 1691 1691 } else if (strstr(tarball_fname, ".lzo")) { 1692 mr_asprintf( &executable, "lzop");1692 mr_asprintf(executable, "lzop"); 1693 1693 } 1694 1694 if (executable) { 1695 mr_asprintf( &tmp, "which %s > /dev/null 2> /dev/null", executable);1695 mr_asprintf(tmp, "which %s > /dev/null 2> /dev/null", executable); 1696 1696 res = run_program_and_log_output(tmp, FALSE); 1697 1697 mr_free(tmp); … … 1702 1702 } 1703 1703 tmp = executable; 1704 mr_asprintf( &executable, "-P %s -Z", tmp);1704 mr_asprintf(executable, "-P %s -Z", tmp); 1705 1705 mr_free(tmp); 1706 1706 } … … 1712 1712 1713 1713 if (use_star) { 1714 mr_asprintf( &command, "star -x -force-remove -U " STAR_ACL_SZ " errctl= file=%s", tarball_fname);1714 mr_asprintf(command, "star -x -force-remove -U " STAR_ACL_SZ " errctl= file=%s", tarball_fname); 1715 1715 if (strstr(tarball_fname, ".bz2")) { 1716 1716 mr_strcat(command, " -bz"); … … 1721 1721 } else { 1722 1722 if (filelist_subset_fname != NULL) { 1723 mr_asprintf( &command, "afio -i -M 8m -b %ld -c %ld %s -w '%s' %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, filelist_subset_fname, tarball_fname);1723 mr_asprintf(command, "afio -i -M 8m -b %ld -c %ld %s -w '%s' %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, filelist_subset_fname, tarball_fname); 1724 1724 } else { 1725 mr_asprintf( &command, "afio -i -b %ld -c %ld -M 8m %s %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, tarball_fname);1725 mr_asprintf(command, "afio -i -b %ld -c %ld -M 8m %s %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, tarball_fname); 1726 1726 } 1727 1727 } … … 1730 1730 1731 1731 #undef BUFSIZE 1732 mr_asprintf( &temp_log, "/tmp/%d.%d", (int) (random() % 32768), (int) (random() % 32768));1732 mr_asprintf(temp_log, "/tmp/%d.%d", (int) (random() % 32768), (int) (random() % 32768)); 1733 1733 1734 1734 mr_strcat(command, " 2>> %s >> %s", temp_log, temp_log); … … 1776 1776 } 1777 1777 if (retval) { 1778 mr_asprintf( &command, "cat %s >> %s", temp_log, MONDO_LOGFILE);1778 mr_asprintf(command, "cat %s >> %s", temp_log, MONDO_LOGFILE); 1779 1779 system(command); 1780 1780 paranoid_free(command); … … 1865 1865 * in afio or someting; oh darn.. OK, use tmpfs :-) * 1866 1866 ****************************************************************************/ 1867 mr_asprintf( &afio_fname, "/tmp/tmpfs/archive.tmp.%ld", current_tarball_number);1868 mr_asprintf( &filelist_fname, "%s/filelist.%ld", bkpinfo->tmpdir, current_tarball_number);1869 mr_asprintf( &filelist_subset_fname, "%s/filelist-subset-%ld.tmp", bkpinfo->tmpdir, current_tarball_number);1867 mr_asprintf(afio_fname, "/tmp/tmpfs/archive.tmp.%ld", current_tarball_number); 1868 mr_asprintf(filelist_fname, "%s/filelist.%ld", bkpinfo->tmpdir, current_tarball_number); 1869 mr_asprintf(filelist_subset_fname, "%s/filelist-subset-%ld.tmp", bkpinfo->tmpdir, current_tarball_number); 1870 1870 1871 1871 res = read_file_from_stream_to_file(afio_fname, size); … … 1877 1877 } 1878 1878 if (bkpinfo->compression_level == 0) { 1879 mr_asprintf( &executable, "%s", "");1879 mr_asprintf(executable, "%s", ""); 1880 1880 } else { 1881 1881 if (bkpinfo->use_star) { 1882 mr_asprintf( &executable, "%s", " -bz");1882 mr_asprintf(executable, "%s", " -bz"); 1883 1883 } else { 1884 mr_asprintf( &executable, "-P %s -Z", bkpinfo->zip_exe);1884 mr_asprintf(executable, "-P %s -Z", bkpinfo->zip_exe); 1885 1885 } 1886 1886 } … … 1893 1893 if (strstr(tarball_fname, ".star.")) { 1894 1894 use_star = TRUE; 1895 mr_asprintf( &command, "star -t file=%s %s", afio_fname, executable);1895 mr_asprintf(command, "star -t file=%s %s", afio_fname, executable); 1896 1896 } else { 1897 1897 use_star = FALSE; 1898 mr_asprintf( &command, "afio -t -M 8m -b %ld %s %s", TAPE_BLOCK_SIZE, executable, afio_fname);1898 mr_asprintf(command, "afio -t -M 8m -b %ld %s %s", TAPE_BLOCK_SIZE, executable, afio_fname); 1899 1899 } 1900 1900 mr_strcat(command, " > %s 2>> %s", filelist_fname, MONDO_LOGFILE); … … 1927 1927 if (strstr(tarball_fname, ".star.")) { 1928 1928 // star 1929 mr_asprintf( &command, "star -x file=%s %s", afio_fname, executable);1929 mr_asprintf(command, "star -x file=%s %s", afio_fname, executable); 1930 1930 if (filelist) { 1931 1931 mr_strcat(command, " list=%s", filelist_subset_fname); … … 1933 1933 } else { 1934 1934 // afio 1935 mr_asprintf( &command, "afio -i -M 8m -b %ld %s", TAPE_BLOCK_SIZE, executable);1935 mr_asprintf(command, "afio -i -M 8m -b %ld %s", TAPE_BLOCK_SIZE, executable); 1936 1936 if (filelist) { 1937 1937 mr_strcat(command, " -w %s", filelist_subset_fname); … … 2026 2026 assert(bkpinfo != NULL); 2027 2027 2028 mr_asprintf( &biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir);2028 mr_asprintf(biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir); 2029 2029 if (!(fbw = fopen(biggies_whose_EXATs_we_should_set, "w"))) { 2030 2030 log_msg(1, "Warning - cannot openout %s", biggies_whose_EXATs_we_should_set); … … 2033 2033 read_cfg_var(g_mondo_cfg_file, "total-slices", tmp); 2034 2034 total_slices = atol(tmp); 2035 mr_asprintf( &tmp1, "Reassembling large files ");2035 mr_asprintf(tmp1, "Reassembling large files "); 2036 2036 mvaddstr_and_log_it(g_currentY, 0, tmp1); 2037 2037 mr_free(tmp1); … … 2066 2066 } else if (does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST")) { 2067 2067 insist_on_this_cd_number(++g_current_media_number); 2068 mr_asprintf( &tmp1, "Restoring from %s #%d", mds, g_current_media_number);2068 mr_asprintf(tmp1, "Restoring from %s #%d", mds, g_current_media_number); 2069 2069 log_to_screen(tmp1); 2070 2070 mr_free(tmp1); … … 2081 2081 } else { 2082 2082 just_changed_cds = FALSE; 2083 mr_asprintf( &tmp1, "Restoring big file %ld", bigfileno + 1);2083 mr_asprintf(tmp1, "Restoring big file %ld", bigfileno + 1); 2084 2084 update_progress_form(tmp1); 2085 2085 mr_free(tmp1); … … 2098 2098 fclose(fbw); 2099 2099 if (g_getfattr) { 2100 mr_asprintf( &xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);2100 mr_asprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH); 2101 2101 if (length_of_file(xattr_fname) > 0) { 2102 2102 set_fattr_list(biggies_whose_EXATs_we_should_set, xattr_fname); … … 2105 2105 } 2106 2106 if (g_getfacl) { 2107 mr_asprintf( &acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);2107 mr_asprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH); 2108 2108 if (length_of_file(acl_fname) > 0) { 2109 2109 set_acl_list(biggies_whose_EXATs_we_should_set, acl_fname); … … 2177 2177 2178 2178 mds = media_descriptor_string(bkpinfo->backup_media_type); 2179 mr_asprintf( &progress_str, "Restoring from %s #%d", mds, g_current_media_number);2179 mr_asprintf(progress_str, "Restoring from %s #%d", mds, g_current_media_number); 2180 2180 2181 2181 log_to_screen(progress_str); … … 2189 2189 mr_free(progress_str); 2190 2190 2191 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%ld.afio.bz2", current_tarball_number);2191 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.bz2", current_tarball_number); 2192 2192 if (!does_file_exist(tarball_fname)) { 2193 2193 mr_free(tarball_fname); 2194 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%ld.afio.gz", current_tarball_number);2194 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.gz", current_tarball_number); 2195 2195 } 2196 2196 if (!does_file_exist(tarball_fname)) { 2197 2197 mr_free(tarball_fname); 2198 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%ld.afio.lzo", current_tarball_number);2198 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.lzo", current_tarball_number); 2199 2199 } 2200 2200 if (!does_file_exist(tarball_fname)) { 2201 2201 mr_free(tarball_fname); 2202 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%ld.afio.", current_tarball_number);2202 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.", current_tarball_number); 2203 2203 } 2204 2204 if (!does_file_exist(tarball_fname)) { 2205 2205 mr_free(tarball_fname); 2206 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%ld.star.bz2", current_tarball_number);2206 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.star.bz2", current_tarball_number); 2207 2207 } 2208 2208 if (!does_file_exist(tarball_fname)) { 2209 2209 mr_free(tarball_fname); 2210 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%ld.star.", current_tarball_number);2210 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.star.", current_tarball_number); 2211 2211 } 2212 2212 if (!does_file_exist(tarball_fname)) { … … 2224 2224 } 2225 2225 g_current_media_number++; 2226 mr_asprintf( &progress_str, "Restoring from %s #%d", media_descriptor_string(bkpinfo->backup_media_type), g_current_media_number);2226 mr_asprintf(progress_str, "Restoring from %s #%d", media_descriptor_string(bkpinfo->backup_media_type), g_current_media_number); 2227 2227 log_to_screen(progress_str); 2228 2228 } else { 2229 mr_asprintf( &progress_str, "Restoring from fileset #%ld on %s #%d", current_tarball_number, mds, g_current_media_number);2229 mr_asprintf(progress_str, "Restoring from fileset #%ld on %s #%d", current_tarball_number, mds, g_current_media_number); 2230 2230 for (res = 999, attempts = 0; attempts < 3 && res != 0; 2231 2231 attempts++) { … … 2235 2235 filelist); 2236 2236 } 2237 mr_asprintf( &tmp1, "%s #%d, fileset #%ld - restore ", mds, g_current_media_number, current_tarball_number);2237 mr_asprintf(tmp1, "%s #%d, fileset #%ld - restore ", mds, g_current_media_number, current_tarball_number); 2238 2238 if (res) { 2239 2239 mr_strcat(tmp1, "reported errors"); … … 2319 2319 total_slices = atol(tmp); 2320 2320 if (g_getfattr) { 2321 mr_asprintf( &xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);2321 mr_asprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2322 2322 } 2323 2323 if (g_getfacl) { 2324 mr_asprintf( &acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);2325 } 2326 mr_asprintf( &tmp1, "Reassembling large files ");2324 mr_asprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2325 } 2326 mr_asprintf(tmp1, "Reassembling large files "); 2327 2327 mvaddstr_and_log_it(g_currentY, 0, tmp1); 2328 2328 mr_free(tmp1); 2329 2329 2330 mr_asprintf( &biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir);2330 mr_asprintf(biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir); 2331 2331 if (!(fbw = fopen(biggies_whose_EXATs_we_should_set, "w"))) { 2332 2332 log_msg(1, "Warning - cannot openout %s", biggies_whose_EXATs_we_should_set); … … 2364 2364 p++; 2365 2365 } 2366 mr_asprintf( &tmp1, "Restoring big file %ld (%lld K)", current_bigfile_number + 1, biggie_size / 1024);2366 mr_asprintf(tmp1, "Restoring big file %ld (%lld K)", current_bigfile_number + 1, biggie_size / 1024); 2367 2367 update_progress_form(tmp1); 2368 2368 mr_free(tmp1); … … 2479 2479 run_program_and_log_output("pwd", 5); 2480 2480 2481 mr_asprintf( &progress_str, "Restoring from media #%d", g_current_media_number);2481 mr_asprintf(progress_str, "Restoring from media #%d", g_current_media_number); 2482 2482 log_to_screen(progress_str); 2483 2483 open_progress_form("Restoring from archives", … … 2501 2501 update_progress_form(progress_str); 2502 2502 if (g_getfattr) { 2503 mr_asprintf( &xattr_fname, "%s/xattr-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number);2503 mr_asprintf(xattr_fname, "%s/xattr-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number); 2504 2504 unlink(xattr_fname); 2505 2505 } 2506 2506 if (g_getfacl) { 2507 mr_asprintf( &acl_fname, "%s/acl-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number);2507 mr_asprintf(acl_fname, "%s/acl-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number); 2508 2508 unlink(acl_fname); 2509 2509 } … … 2519 2519 retval += res; 2520 2520 if (res) { 2521 mr_asprintf( &tmp, "Fileset %ld - errors occurred", current_afioball_number);2521 mr_asprintf(tmp, "Fileset %ld - errors occurred", current_afioball_number); 2522 2522 log_to_screen(tmp); 2523 2523 mr_free(tmp); … … 2534 2534 2535 2535 mr_free(progress_str); 2536 mr_asprintf( &progress_str, "Restoring from fileset #%ld on %s #%d", current_afioball_number, mds, g_current_media_number);2536 mr_asprintf(progress_str, "Restoring from fileset #%ld on %s #%d", current_afioball_number, mds, g_current_media_number); 2537 2537 mr_free(mds); 2538 2538 res = read_header_block_from_stream(&tmp_size, tmp_fname, &ctrl_chr); … … 2594 2594 g_current_media_number = 1; 2595 2595 getcwd(cwd, MAX_STR_LEN - 1); 2596 mr_asprintf( &tmp, "mkdir -p %s", bkpinfo->restore_path);2596 mr_asprintf(tmp, "mkdir -p %s", bkpinfo->restore_path); 2597 2597 run_program_and_log_output(tmp, FALSE); 2598 2598 mr_free(tmp); … … 2666 2666 { 2667 2667 log_msg(0, "-------------- Mondo Restore v%s -------------", PACKAGE_VERSION); 2668 log_msg(0, 2669 "DON'T PANIC! Mondorestore logs almost everything, so please "); 2670 log_msg(0, 2671 "don't break out in a cold sweat just because you see a few "); 2672 log_msg(0, 2673 "error messages in the log. Read them; analyze them; see if "); 2674 log_msg(0, 2675 "they are significant; above all, verify your backups! Please"); 2676 log_msg(0, 2677 "attach a compressed copy of this log to any e-mail you send "); 2678 log_msg(0, 2679 "to the Mondo mailing list when you are seeking technical "); 2680 log_msg(0, 2681 "support. Without it, we can't help you. - DevTeam"); 2682 log_msg(0, 2683 "------------------------------------------------------------"); 2684 log_msg(0, 2685 "BTW, despite (or perhaps because of) the wealth of messages,"); 2686 log_msg(0, 2687 "some users are inclined to stop reading this log. If Mondo "); 2688 log_msg(0, 2689 "stopped for some reason, chances are it's detailed here. "); 2690 log_msg(0, 2691 "More than likely there's a message at the very end of this "); 2692 log_msg(0, 2693 "log that will tell you what is wrong. Please read it! "); 2694 log_msg(0, 2695 "------------------------------------------------------------"); 2668 log_msg(0, "DON'T PANIC! Mondorestore logs almost everything, so please "); 2669 log_msg(0, "don't break out in a cold sweat just because you see a few "); 2670 log_msg(0, "error messages in the log. Read them; analyze them; see if "); 2671 log_msg(0, "they are significant; above all, verify your backups! Please"); 2672 log_msg(0, "attach a compressed copy of this log to any e-mail you send "); 2673 log_msg(0, "to the Mondo mailing list when you are seeking technical "); 2674 log_msg(0, "support. Without it, we can't help you. - DevTeam"); 2675 log_msg(0, "------------------------------------------------------------"); 2676 log_msg(0, "BTW, despite (or perhaps because of) the wealth of messages,"); 2677 log_msg(0, "some users are inclined to stop reading this log. If Mondo "); 2678 log_msg(0, "stopped for some reason, chances are it's detailed here. "); 2679 log_msg(0, "More than likely there's a message at the very end of this "); 2680 log_msg(0, "log that will tell you what is wrong. Please read it! "); 2681 log_msg(0, "------------------------------------------------------------"); 2696 2682 } 2697 2683 … … 2768 2754 2769 2755 /* Backup original mountlist.txt */ 2770 mr_asprintf( &tmp, "%s.orig", g_mountlist_fname);2756 mr_asprintf(tmp, "%s.orig", g_mountlist_fname); 2771 2757 if (!does_file_exist(g_mountlist_fname)) { 2772 2758 log_msg(2, "%ld: Warning - g_mountlist_fname (%s) does not exist yet", __LINE__, g_mountlist_fname); 2773 2759 } else if (!does_file_exist(tmp)) { 2774 2760 mr_free(tmp); 2775 mr_asprintf( &tmp, "cp -f %s %s.orig", g_mountlist_fname, g_mountlist_fname);2761 mr_asprintf(tmp, "cp -f %s %s.orig", g_mountlist_fname, g_mountlist_fname); 2776 2762 run_program_and_log_output(tmp, FALSE); 2777 2763 } … … 2948 2934 log_msg(2, "Still here. Yay."); 2949 2935 if ((strlen(bkpinfo->tmpdir) > 0) && (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL)) { 2950 mr_asprintf( &tmp, "rm -Rf %s/*", bkpinfo->tmpdir);2936 mr_asprintf(tmp, "rm -Rf %s/*", bkpinfo->tmpdir); 2951 2937 run_program_and_log_output(tmp, FALSE); 2952 2938 mr_free(tmp); … … 2971 2957 && !is_this_device_mounted(bkpinfo->nfs_mount)) { 2972 2958 log_msg(1, "Mounting nfs dir"); 2973 sprintf(bkpinfo->isodir, "/tmp/isodir"); 2959 mr_free(bkpinfo->isodir); 2960 mr_asprintf(tmp, "/tmp/isodir"); 2961 bkpinfo->isodir = tmp; 2974 2962 run_program_and_log_output("mkdir -p /tmp/isodir", 5); 2975 mr_asprintf( &tmp, "mount %s -t nfs -o nolock,ro /tmp/isodir", bkpinfo->nfs_mount);2963 mr_asprintf(tmp, "mount %s -t nfs -o nolock,ro /tmp/isodir", bkpinfo->nfs_mount); 2976 2964 run_program_and_log_output(tmp, 1); 2977 2965 mr_free(tmp); … … 3070 3058 } else { 3071 3059 log_msg(1, "Re-mounted partitions for post-nuke stuff"); 3072 mr_asprintf( &tmp, "post-nuke %s %d", bkpinfo->restore_path, retval);3060 mr_asprintf(tmp, "post-nuke %s %d", bkpinfo->restore_path, retval); 3073 3061 log_msg(2, "Calling '%s'", tmp); 3074 3062 if ((res = run_program_and_log_output(tmp, 0))) { … … 3091 3079 set_signals(FALSE); 3092 3080 log_to_screen("Restore log (%s) copied to /var/log on your hard disk", MONDO_LOGFILE); 3093 mr_asprintf( &tmp, "Mondo-restore is exiting (retval=%d) ", retval);3081 mr_asprintf(tmp, "Mondo-restore is exiting (retval=%d) ", retval); 3094 3082 log_to_screen(tmp); 3095 3083 mr_free(tmp); 3096 3084 3097 mr_asprintf( &tmp, "umount %s", bkpinfo->isodir);3085 mr_asprintf(tmp, "umount %s", bkpinfo->isodir); 3098 3086 run_program_and_log_output(tmp, 5); 3099 3087 mr_free(tmp); … … 3105 3093 } // for b0rken distros 3106 3094 if (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL) { 3107 mr_asprintf( &tmp, "rm -Rf %s", bkpinfo->tmpdir);3095 mr_asprintf(tmp, "rm -Rf %s", bkpinfo->tmpdir); 3108 3096 system(tmp); 3109 3097 mr_free(tmp);
Note:
See TracChangeset
for help on using the changeset viewer.