Changeset 956 in MondoRescue for trunk/mondo/src
- Timestamp:
- Nov 21, 2006, 1:42:46 AM (17 years ago)
- Location:
- trunk/mondo/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mondo/src/common/libmondo-archive.c
r914 r956 75 75 extern bool g_cd_recovery; 76 76 extern char *g_serial_string; 77 78 extern char *g_getfacl; 79 extern char *g_getfattr; 80 81 77 82 78 83 /** … … 538 543 /*@ buffer ************************************************************ */ 539 544 char *tmp = NULL; 545 char *tmp1 = NULL; 540 546 char *command = NULL; 541 547 char *use_lzo_sz = NULL; … … 552 558 char *value = NULL; 553 559 char *bootdev = NULL; 554 555 560 556 561 … … 802 807 } 803 808 mr_free(tmp); 809 810 if (g_getfattr) { 811 asprintf(&tmp1, "%s/XATTR", bkpinfo->tmpdir); 812 if (write_one_liner_data_file(tmp1, "TRUE")) { 813 log_msg(1, "%ld: Unable to write one-liner XATTR", 814 __LINE__); 815 } 816 paranoid_free(tmp1); 817 } 818 if (g_getfacl) { 819 asprintf(&tmp1, "%s/ACL", bkpinfo->tmpdir); 820 if (write_one_liner_data_file(tmp1, "TRUE")) { 821 log_msg(1, "%ld: Unable to write one-liner ACL", 822 __LINE__); 823 } 824 paranoid_free(tmp1); 825 } 804 826 805 827 estimated_total_noof_slices = … … 975 997 char *archiving_filelist_fname; 976 998 char *archiving_afioball_fname; 977 char *curr_xattr_list_fname ;999 char *curr_xattr_list_fname = NULL; 978 1000 char *curr_acl_list_fname; 979 1001 … … 1046 1068 log_msg(4, "%s[%d:%d] - EXATing %d...", FORTY_SPACES, getpid(), 1047 1069 this_thread_no, archiving_set_no); 1048 mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, 1049 bkpinfo->tmpdir, archiving_set_no); 1050 mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, 1051 bkpinfo->tmpdir, archiving_set_no); 1052 get_fattr_list(archiving_filelist_fname, curr_xattr_list_fname); 1053 mr_free(curr_xattr_list_fname); 1054 get_acl_list(archiving_filelist_fname, curr_acl_list_fname); 1055 mr_free(curr_acl_list_fname); 1070 if (g_getfattr) { 1071 mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, 1072 bkpinfo->tmpdir, archiving_set_no); 1073 get_fattr_list(archiving_filelist_fname, curr_xattr_list_fname); 1074 mr_free(curr_xattr_list_fname); 1075 } 1076 if (g_getfacl) { 1077 mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, 1078 bkpinfo->tmpdir, archiving_set_no); 1079 get_acl_list(archiving_filelist_fname, curr_acl_list_fname); 1080 mr_free(curr_acl_list_fname); 1081 } 1056 1082 1057 1083 log_msg(4, "%s[%d:%d] - archiving %d...", FORTY_SPACES, getpid(), … … 1432 1458 int noof_threads; 1433 1459 int i; 1434 char *curr_xattr_list_fname ;1460 char *curr_xattr_list_fname = NULL; 1435 1461 char *curr_acl_list_fname; 1436 1462 int misc_counter_that_is_not_important = 0; … … 1515 1541 // store set N 1516 1542 mr_asprintf(&storing_filelist_fname, FILELIST_FNAME_RAW_SZ, 1517 1543 bkpinfo->tmpdir, storing_set_no); 1518 1544 mr_asprintf(&storing_afioball_fname, AFIOBALL_FNAME_RAW_SZ, 1519 bkpinfo->tmpdir, storing_set_no, bkpinfo->zip_suffix); 1520 mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, 1521 bkpinfo->tmpdir, storing_set_no); 1522 mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, 1523 bkpinfo->tmpdir, storing_set_no); 1545 bkpinfo->tmpdir, storing_set_no, bkpinfo->zip_suffix); 1546 if (g_getfattr) { 1547 mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, 1548 bkpinfo->tmpdir, storing_set_no); 1549 } 1550 if (g_getfacl) { 1551 mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, 1552 bkpinfo->tmpdir, storing_set_no); 1553 } 1524 1554 1525 1555 log_msg(2, "Storing set %d", storing_set_no); … … 1549 1579 NULL); 1550 1580 } else { 1551 res = 1552 move_files_to_cd(bkpinfo, storing_filelist_fname, 1581 if (g_getfacl) { 1582 if (g_getfattr) { 1583 res = move_files_to_cd(bkpinfo, storing_filelist_fname, 1553 1584 curr_xattr_list_fname, 1554 1585 curr_acl_list_fname, 1555 1586 storing_afioball_fname, NULL); 1587 } else { 1588 res = move_files_to_cd(bkpinfo, storing_filelist_fname, 1589 curr_acl_list_fname, 1590 storing_afioball_fname, NULL); 1591 } 1592 } else { 1593 if (g_getfattr) { 1594 res = move_files_to_cd(bkpinfo, storing_filelist_fname, 1595 curr_xattr_list_fname, 1596 storing_afioball_fname, NULL); 1597 } else { 1598 res = move_files_to_cd(bkpinfo, storing_filelist_fname, 1599 storing_afioball_fname, NULL); 1600 } 1601 } 1556 1602 } 1557 1603 mr_free(storing_filelist_fname); … … 2165 2211 2166 2212 log_msg(1, "EXAT'g set %ld", curr_set_no); 2167 mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, 2168 bkpinfo->tmpdir, curr_set_no); 2169 mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, 2170 bkpinfo->tmpdir, curr_set_no); 2171 get_fattr_list(curr_filelist_fname, curr_xattr_list_fname); 2172 get_acl_list(curr_filelist_fname, curr_acl_list_fname); 2213 if (g_getfattr) { 2214 mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, 2215 bkpinfo->tmpdir, curr_set_no); 2216 get_fattr_list(curr_filelist_fname, curr_xattr_list_fname); 2217 } 2218 if (g_getfacl) { 2219 mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, 2220 bkpinfo->tmpdir, curr_set_no); 2221 get_acl_list(curr_filelist_fname, curr_acl_list_fname); 2222 } 2173 2223 2174 2224 log_msg(1, "Archiving set %ld", curr_set_no); … … 2200 2250 res = move_files_to_stream(bkpinfo, curr_afioball_fname, NULL); 2201 2251 } else { 2202 res = 2203 move_files_to_cd(bkpinfo, curr_filelist_fname, 2204 curr_xattr_list_fname, 2205 curr_acl_list_fname, curr_afioball_fname, 2206 NULL); 2252 if (g_getfacl) { 2253 if (g_getfattr) { 2254 res = move_files_to_cd(bkpinfo, curr_filelist_fname, 2255 curr_xattr_list_fname, 2256 curr_acl_list_fname, 2257 curr_afioball_fname, NULL); 2258 } else { 2259 res = move_files_to_cd(bkpinfo, curr_filelist_fname, 2260 curr_acl_list_fname, 2261 curr_afioball_fname, NULL); 2262 } 2263 } else { 2264 if (g_getfattr) { 2265 res = move_files_to_cd(bkpinfo, curr_filelist_fname, 2266 curr_xattr_list_fname, 2267 curr_afioball_fname, NULL); 2268 } else { 2269 res = move_files_to_cd(bkpinfo, curr_filelist_fname, 2270 curr_afioball_fname, NULL); 2271 } 2272 } 2207 2273 } 2208 2274 retval += res; … … 2315 2381 mr_asprintf(&biggielist, "%s/archives/biggielist.txt", 2316 2382 bkpinfo->scratchdir); 2317 mr_asprintf(&xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2318 mr_asprintf(&acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2383 if (g_getfattr) { 2384 mr_asprintf(&xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2385 } 2386 if (g_getfacl) { 2387 mr_asprintf(&acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2388 } 2319 2389 2320 2390 mr_asprintf(&command, "cp %s/biggielist.txt %s", bkpinfo->tmpdir, … … 2331 2401 } 2332 2402 2333 get_fattr_list(biggielist, xattr_fname); 2334 get_acl_list(biggielist, acl_fname); 2335 mr_asprintf(&command, "cp %s %s/archives/", xattr_fname, 2403 if (g_getfattr) { 2404 get_fattr_list(biggielist, xattr_fname); 2405 mr_asprintf(&command, "cp %s %s/archives/", xattr_fname, 2406 bkpinfo->scratchdir); 2407 paranoid_system(command); 2408 mr_free(command); 2409 } 2410 if (g_getfacl) { 2411 get_acl_list(biggielist, acl_fname); 2412 mr_asprintf(&command, "cp %s %s/archives/", acl_fname, 2336 2413 bkpinfo->scratchdir); 2337 paranoid_system(command); 2338 mr_free(command); 2339 2340 mr_asprintf(&command, "cp %s %s/archives/", acl_fname, 2341 bkpinfo->scratchdir); 2342 paranoid_system(command); 2343 mr_free(command); 2414 paranoid_system(command); 2415 mr_free(command); 2416 } 2344 2417 2345 2418 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { … … 2349 2422 mr_free(blah); 2350 2423 } 2351 mr_free(xattr_fname); 2352 mr_free(acl_fname); 2424 if (g_getfattr) { 2425 mr_free(xattr_fname); 2426 } 2427 if (g_getfacl) { 2428 mr_free(acl_fname); 2429 } 2353 2430 2354 2431 res = make_slices_and_images(bkpinfo, biggielist); -
trunk/mondo/src/common/libmondo-fifo.c
r932 r956 160 160 161 161 sync(); 162 if (g_sz_call_to_buffer == NULL) { 163 return; 164 } 165 if (strcmp(g_sz_call_to_buffer,"") == 0) { 166 return; 167 } 162 168 mr_asprintf(&command, 163 "ps %s | grep -F \"%s\" | grep -Fv grep | awk '{print $2;}' | grep -v PID | head -1", ps_options, 164 g_sz_call_to_buffer); 169 "ps %s | grep -F \"%s\" | grep -Fv grep | awk '{print $2;}' | grep -v PID | head -1", ps_options, g_sz_call_to_buffer); 165 170 mr_free(g_sz_call_to_buffer); 166 171 log_msg(2, "kill_buffer() --- command = %s", command); -
trunk/mondo/src/common/libmondo-filelist.c
r914 r956 62 62 extern int g_noof_rows; 63 63 64 extern char *g_getfacl; 65 extern char *g_getfattr; 64 66 65 67 /** … … 95 97 log_to_screen(_("Dividing filelist into sets. Please wait.")); 96 98 i = 0; 97 /*98 if (find_home_of_exe("getfattr"))99 { i++; log_to_screen ("NEW! Recording extended attributes."); }100 if (find_home_of_exe("getfacl"))101 { i++; log_to_screen ("NEW! Recording ACL information."); }102 if (i)103 { i=0; log_to_screen ("This will take more time. Please be patient."); }104 */105 99 mr_asprintf(&filelist, "%s/archives/filelist.full", bkpinfo->scratchdir); 106 100 if (!does_file_exist(filelist)) { … … 475 469 int retval = 0; 476 470 477 mr_asprintf(&command, "touch %s", facl_fname); 478 run_program_and_log_output(command, 8); 479 mr_free(command); 480 481 tmp = find_home_of_exe("getfacl"); 482 if (tmp) { 483 // sort_file(filelist); // FIXME - filelist chopper sorts, so this isn't necessary 471 if (g_getfacl != NULL) { 472 mr_asprintf(&command, "touch %s", facl_fname); 473 run_program_and_log_output(command, 8); 474 mr_free(command); 475 484 476 mr_asprintf(&command, 485 477 "getfacl --all-effective -P %s 2>> %s | gzip -c1 > %s 2>> %s", … … 489 481 mr_free(command); 490 482 } 491 mr_free(tmp);492 483 return (retval); 493 484 } … … 500 491 int retval = 0; 501 492 502 mr_asprintf(&command, "touch %s", fattr_fname); 503 run_program_and_log_output(command, 8); 504 mr_free(command); 505 506 tmp = find_home_of_exe("getfattr"); 507 if (tmp) { 508 // sort_file(filelist); // FIXME - filelist chopper sorts, so this isn't necessary 493 if (g_getfattr != NULL) { 494 mr_asprintf(&command, "touch %s", fattr_fname); 495 run_program_and_log_output(command, 8); 496 mr_free(command); 497 509 498 retval = 510 499 gen_aux_list(filelist, "getfattr --en=hex -P -d \"%s\"", 511 500 fattr_fname); 512 501 } 513 mr_free(tmp);514 502 return (retval); 515 503 } -
trunk/mondo/src/common/libmondo-stream.c
r900 r956 29 29 extern int g_tape_buffer_size_MB; 30 30 31 extern char *g_getfacl; 32 extern char *g_getfattr; 33 31 34 /** 32 35 * @addtogroup globalGroup … … 346 349 347 350 // xattr 348 res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr); 349 if (*pctrl_chr != BLK_START_EXAT_FILE) { 350 wrong_marker(BLK_START_EXAT_FILE, *pctrl_chr); 351 } 352 if (!strstr(fname, "xattr")) { 353 fatal_error("Wrong order, sunshine."); 351 if (g_getfattr) { 352 res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr); 353 if (*pctrl_chr != BLK_START_EXAT_FILE) { 354 wrong_marker(BLK_START_EXAT_FILE, *pctrl_chr); 355 } 356 if (!strstr(fname, "xattr")) { 357 fatal_error("Wrong order, sunshine."); 358 } 359 read_file_from_stream_to_file(bkpinfo, xattr_fname, *ptmp_size); 360 res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr); 361 if (*pctrl_chr != BLK_STOP_EXAT_FILE) { 362 wrong_marker(BLK_STOP_EXAT_FILE, *pctrl_chr); 363 } 364 log_msg(1, "Got xattr"); 354 365 } 355 366 mr_free(fname); … … 361 372 } 362 373 // acl 363 res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr); 364 if (!strstr(fname, "acl")) { 365 fatal_error("Wrong order, sunshine."); 374 if (g_getfacl) { 375 res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr); 376 if (!strstr(fname, "acl")) { 377 fatal_error("Wrong order, sunshine."); 378 } 379 if (*pctrl_chr != BLK_START_EXAT_FILE) { 380 wrong_marker(BLK_START_EXAT_FILE, *pctrl_chr); 381 } 382 read_file_from_stream_to_file(bkpinfo, acl_fname, *ptmp_size); 383 res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr); 384 if (*pctrl_chr != BLK_STOP_EXAT_FILE) { 385 wrong_marker(BLK_STOP_EXAT_FILE, *pctrl_chr); 386 } 387 res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr); 388 if (*pctrl_chr != BLK_STOP_EXTENDED_ATTRIBUTES) { 389 wrong_marker(BLK_STOP_EXTENDED_ATTRIBUTES, *pctrl_chr); 390 } 391 log_msg(1, "Got acl"); 366 392 } 367 393 mr_free(fname); … … 380 406 } 381 407 // tarball itself 382 res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr); 383 log_msg(1, "Got xattr and acl; now looking for afioball"); 384 tmp_fname = fname; 408 res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr); 409 log_msg(1, "now looking for afioball"); 385 410 return (retval); 386 411 } … … 391 416 { 392 417 int res = 0; 393 // EXATs 394 write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname, 395 BLK_START_EXTENDED_ATTRIBUTES); 418 if (g_getfattr) { 396 419 // xattr 397 write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname, 398 BLK_START_EXAT_FILE); 399 write_file_to_stream_from_file(bkpinfo, xattr_fname); 400 write_header_block_to_stream((off_t)-1, xattr_fname, BLK_STOP_EXAT_FILE); 401 // acl 402 write_header_block_to_stream(length_of_file(acl_fname), acl_fname, 403 BLK_START_EXAT_FILE); 404 write_file_to_stream_from_file(bkpinfo, acl_fname); 405 write_header_block_to_stream((off_t)-1, acl_fname, BLK_STOP_EXAT_FILE); 406 write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname, 407 BLK_STOP_EXTENDED_ATTRIBUTES); 420 write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname, 421 BLK_START_EXTENDED_ATTRIBUTES); 422 write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname, 423 BLK_START_EXAT_FILE); 424 write_file_to_stream_from_file(bkpinfo, xattr_fname); 425 write_header_block_to_stream((off_t)-1, xattr_fname, BLK_STOP_EXAT_FILE); 426 } 427 if (g_getfacl) { 428 // acl 429 write_header_block_to_stream(length_of_file(acl_fname), acl_fname, 430 BLK_START_EXAT_FILE); 431 write_file_to_stream_from_file(bkpinfo, acl_fname); 432 write_header_block_to_stream((off_t)-1, acl_fname, BLK_STOP_EXAT_FILE); 433 write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname, 434 BLK_STOP_EXTENDED_ATTRIBUTES); 435 } 408 436 return (res); 409 437 } -
trunk/mondo/src/common/libmondo-verify.c
r914 r956 32 32 int g_last_afioball_number = -1; 33 33 34 extern char *g_getfacl; 35 extern char *g_getfattr; 34 36 35 37 /** … … 703 705 assert(bkpinfo != NULL); 704 706 705 mr_asprintf(&curr_xattr_list_fname, XATTR_BIGGLST_FNAME_RAW_SZ, 706 bkpinfo->tmpdir); 707 mr_asprintf(&curr_acl_list_fname, ACL_BIGGLST_FNAME_RAW_SZ, 708 bkpinfo->tmpdir); 707 if (g_getfattr) { 708 mr_asprintf(&curr_xattr_list_fname, XATTR_BIGGLST_FNAME_RAW_SZ, 709 bkpinfo->tmpdir); 710 } 711 if (g_getfacl) { 712 mr_asprintf(&curr_acl_list_fname, ACL_BIGGLST_FNAME_RAW_SZ, 713 bkpinfo->tmpdir); 714 } 709 715 log_to_screen(_("Verifying regular archives on tape")); 710 716 total_afioballs = get_last_filelist_number(bkpinfo) + 1; … … 733 739 ctrl_chr != BLK_STOP_AFIOBALLS; 734 740 res = read_header_block_from_stream(&size, fname, &ctrl_chr)) { 735 mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, 736 bkpinfo->tmpdir, current_afioball_number); 737 mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, 738 bkpinfo->tmpdir, current_afioball_number); 741 if (g_getfattr) { 742 mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, 743 bkpinfo->tmpdir, current_afioball_number); 744 } 745 if (g_getfacl) { 746 mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, 747 bkpinfo->tmpdir, current_afioball_number); 748 } 739 749 if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) { 740 750 iamhere("Reading EXAT files from tape"); … … 817 827 assert(bkpinfo != NULL); 818 828 819 mr_asprintf(&curr_xattr_list_fname, XATTR_BIGGLST_FNAME_RAW_SZ, 820 bkpinfo->tmpdir); 821 mr_asprintf(&curr_acl_list_fname, ACL_BIGGLST_FNAME_RAW_SZ, 822 bkpinfo->tmpdir); 829 if (g_getfattr) { 830 mr_asprintf(&curr_xattr_list_fname, XATTR_BIGGLST_FNAME_RAW_SZ, 831 bkpinfo->tmpdir); 832 } 833 if (g_getfacl) { 834 mr_asprintf(&curr_acl_list_fname, ACL_BIGGLST_FNAME_RAW_SZ, 835 bkpinfo->tmpdir); 836 } 823 837 mr_asprintf(&comment, "Verifying all bigfiles."); 824 838 log_to_screen(comment); -
trunk/mondo/src/mondoarchive/mondo-cli.c
r914 r956 32 32 bool g_ISO_restore_mode = FALSE; 33 33 34 extern double g_kernel_version; 35 extern int g_current_media_number; 36 extern pid_t g_main_pid; 37 extern char *resolve_softlinks_to_get_to_actual_device_file(char *); 38 39 /* Do we use extended attributes and acl ? 40 * By default no, use --acl & --attr options to force their usage */ 41 char *g_getfacl = NULL; 42 char *g_getfattr = NULL; 34 43 35 44 /** … … 194 203 char *q = NULL; 195 204 196 long itbs ;205 long itbs = 0L; 197 206 198 207 struct stat buf; … … 496 505 if (flag_set['w']) { 497 506 bkpinfo->backup_media_type = cdrw; 507 } 508 if (flag_set['z']) { 509 if (find_home_of_exe("getfattr")) { 510 asprintf(&g_getfattr,"getfattr"); 511 } 512 if (find_home_of_exe("getfacl")) { 513 asprintf(&g_getfacl,"getfacl"); 514 } 498 515 } 499 516 … … 876 893 while ((opt = 877 894 getopt(argc, argv, 878 "0123456789A:B:C:DE:FHI:J:K:LNOP:QRS:T:VWb:c:d:ef:gik:l:mn:op:rs:tuw:x: "))895 "0123456789A:B:C:DE:FHI:J:K:LNOP:QRS:T:VWb:c:d:ef:gik:l:mn:op:rs:tuw:x:z")) 879 896 != -1) { 880 897 if (opt == '?') { -
trunk/mondo/src/mondorestore/mondo-restore.c
r932 r956 127 127 char *ps_options = ""; 128 128 char *ps_proc_id = "$1"; 129 130 extern char *g_getfacl; 131 extern char *g_getfattr; 129 132 130 133 /* @} - end of "Restore-Time Globals" in globalGroup */ … … 1609 1612 1610 1613 if (filelist == NULL || matches > 0) { 1611 mr_asprintf(&xattr_fname, XATTR_LIST_FNAME_RAW_SZ, 1614 if (g_getfattr) { 1615 mr_asprintf(&xattr_fname, XATTR_LIST_FNAME_RAW_SZ, 1612 1616 MNT_CDROM "/archives", current_tarball_number); 1613 mr_asprintf(&acl_fname, ACL_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", 1617 } 1618 if (g_getfacl) { 1619 mr_asprintf(&acl_fname, ACL_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", 1614 1620 current_tarball_number); 1621 } 1615 1622 if (strstr(tarball_fname, ".bz2")) { 1616 1623 mr_asprintf(&executable, "bzip2"); … … 1689 1696 } 1690 1697 1691 log_msg(1, "Setting fattr list %s", xattr_fname); 1692 if (length_of_file(xattr_fname) > 0) { 1693 res = set_fattr_list(filelist_subset_fname, xattr_fname); 1694 if (res) { 1695 log_to_screen 1696 (_ 1697 ("Errors occurred while setting extended attributes")); 1698 } else { 1699 log_msg(1, "I set xattr OK"); 1700 } 1701 retval += res; 1702 } 1703 if (length_of_file(acl_fname) > 0) { 1698 if (g_getfattr) { 1699 log_msg(1, "Setting fattr list %s", xattr_fname); 1700 if (length_of_file(xattr_fname) > 0) { 1701 res = set_fattr_list(filelist_subset_fname, xattr_fname); 1702 if (res) { 1703 log_to_screen 1704 ("Errors occurred while setting extended attributes"); 1705 } else { 1706 log_msg(1, "I set xattr OK"); 1707 } 1708 retval += res; 1709 } 1710 } 1711 if (g_getfacl) { 1704 1712 log_msg(1, "Setting acl list %s", acl_fname); 1705 res = set_acl_list(filelist_subset_fname, acl_fname); 1706 if (res) { 1707 log_to_screen 1708 (_ 1709 ("Errors occurred while setting access control lists")); 1710 } else { 1711 log_msg(1, "I set ACL OK"); 1712 } 1713 retval += res; 1713 if (length_of_file(acl_fname) > 0) { 1714 res = set_acl_list(filelist_subset_fname, acl_fname); 1715 if (res) { 1716 log_to_screen 1717 ("Errors occurred while setting access control lists"); 1718 } else { 1719 log_msg(1, "I set ACL OK"); 1720 } 1721 retval += res; 1722 } 1714 1723 } 1715 1724 if (retval) { … … 1888 1897 paranoid_system(command); 1889 1898 1890 iamhere("Restoring xattr, acl stuff"); 1891 res = set_fattr_list(filelist_subset_fname, xattr_fname); 1892 if (res) { 1893 log_msg(1, "Errors occurred while setting xattr"); 1894 } else { 1895 log_msg(1, "I set xattr OK"); 1896 } 1897 retval += res; 1898 1899 res = set_acl_list(filelist_subset_fname, acl_fname); 1900 if (res) { 1901 log_msg(1, "Errors occurred while setting ACL"); 1902 } else { 1903 log_msg(1, "I set ACL OK"); 1904 } 1905 retval += res; 1899 if (g_getfattr) { 1900 iamhere("Restoring xattr stuff"); 1901 res = set_fattr_list(filelist_subset_fname, xattr_fname); 1902 if (res) { 1903 log_msg(1, "Errors occurred while setting xattr"); 1904 } else { 1905 log_msg(1, "I set xattr OK"); 1906 } 1907 retval += res; 1908 } 1909 1910 if (g_getfacl) { 1911 iamhere("Restoring acl stuff"); 1912 res = set_acl_list(filelist_subset_fname, acl_fname); 1913 if (res) { 1914 log_msg(1, "Errors occurred while setting ACL"); 1915 } else { 1916 log_msg(1, "I set ACL OK"); 1917 } 1918 retval += res; 1919 } 1906 1920 1907 1921 } else { … … 2046 2060 if (fbw) { 2047 2061 fclose(fbw); 2048 mr_asprintf(&acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH); 2049 mr_asprintf(&xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH); 2050 if (length_of_file(acl_fname) > 0) { 2051 set_acl_list(biggies_whose_EXATs_we_should_set, acl_fname); 2052 } 2053 if (length_of_file(xattr_fname) > 0) { 2054 set_fattr_list(biggies_whose_EXATs_we_should_set, xattr_fname); 2062 if (g_getfattr) { 2063 mr_asprintf(&xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH); 2064 if (length_of_file(xattr_fname) > 0) { 2065 set_fattr_list(biggies_whose_EXATs_we_should_set, xattr_fname); 2066 } 2067 } 2068 if (g_getfacl) { 2069 mr_asprintf(&acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH); 2070 if (length_of_file(acl_fname) > 0) { 2071 set_acl_list(biggies_whose_EXATs_we_should_set, acl_fname); 2072 } 2055 2073 } 2056 2074 mr_free(acl_fname); … … 2266 2284 2267 2285 mr_asprintf(&tmp, "Reassembling large files "); 2268 mr_asprintf(&xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2269 mr_asprintf(&acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2286 if (g_getfattr) { 2287 mr_asprintf(&xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2288 } 2289 if (g_getfacl) { 2290 mr_asprintf(&acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2291 } 2270 2292 mvaddstr_and_log_it(g_currentY, 0, tmp); 2271 2293 mr_free(tmp); … … 2352 2374 if (length_of_file(biggies_whose_EXATs_we_should_set) > 2) { 2353 2375 iamhere("Setting biggie-EXATs"); 2354 if (length_of_file(acl_fname) > 0) { 2355 log_msg(1, "set_acl_list(%s,%s)", 2356 biggies_whose_EXATs_we_should_set, acl_fname); 2357 set_acl_list(biggies_whose_EXATs_we_should_set, acl_fname); 2358 } 2359 if (length_of_file(xattr_fname) > 0) { 2360 log_msg(1, "set_fattr_List(%s,%s)", 2376 if (g_getfattr) { 2377 if (length_of_file(xattr_fname) > 0) { 2378 log_msg(1, "set_fattr_List(%s,%s)", 2361 2379 biggies_whose_EXATs_we_should_set, xattr_fname); 2362 set_fattr_list(biggies_whose_EXATs_we_should_set,2380 set_fattr_list(biggies_whose_EXATs_we_should_set, 2363 2381 xattr_fname); 2382 } 2383 } 2384 if (g_getfacl) { 2385 if (length_of_file(acl_fname) > 0) { 2386 log_msg(1, "set_acl_list(%s,%s)", 2387 biggies_whose_EXATs_we_should_set, acl_fname); 2388 set_acl_list(biggies_whose_EXATs_we_should_set, acl_fname); 2389 } 2364 2390 } 2365 2391 } else { … … 2454 2480 while (ctrl_chr != BLK_STOP_AFIOBALLS) { 2455 2481 update_progress_form(progress_str); 2456 mr_asprintf(&xattr_fname, "%s/xattr-subset-%ld.tmp", bkpinfo->tmpdir, 2482 if (g_getfattr) { 2483 mr_asprintf(&xattr_fname, "%s/xattr-subset-%ld.tmp", bkpinfo->tmpdir, 2457 2484 current_afioball_number); 2458 mr_asprintf(&acl_fname, "%s/acl-subset-%ld.tmp", bkpinfo->tmpdir, 2485 unlink(xattr_fname); 2486 } 2487 if (g_getfacl) { 2488 mr_asprintf(&acl_fname, "%s/acl-subset-%ld.tmp", bkpinfo->tmpdir, 2459 2489 current_afioball_number); 2460 unlink(xattr_fname);2461 unlink(acl_fname);2490 unlink(acl_fname); 2491 } 2462 2492 if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) { 2463 2493 iamhere("Reading EXAT files from tape"); … … 2503 2533 res = 2504 2534 read_header_block_from_stream(&tmp_size, tmp_fname, &ctrl_chr); 2505 unlink(xattr_fname); 2506 unlink(acl_fname); 2535 if (g_getfattr) { 2536 unlink(xattr_fname); 2537 } 2538 if (g_getfacl) { 2539 unlink(acl_fname); 2540 } 2507 2541 mr_free(xattr_fname); 2508 2542 mr_free(acl_fname); -
trunk/mondo/src/mondorestore/mondo-rstr-tools.c
r914 r956 43 43 44 44 extern int g_partition_table_locked_up; 45 46 /* Should we use or not extended attributes and acl when restoring */ 47 char *g_getfattr = NULL; 48 char *g_getfacl = NULL; 45 49 46 50 /** … … 913 917 } 914 918 mr_free(value); 919 920 read_cfg_var(cfg_file, "acl", value); 921 if (strstr(value, "TRUE")) { 922 asprintf(&g_getfacl,"setfacl"); 923 log_msg(1, "We will restore ACLs"); 924 if (! find_home_of_exe("setfacl")) { 925 log_msg(1, "Unable to restore ACLs as no setfacl found"); 926 } 927 } 928 read_cfg_var(cfg_file, "xattr", value); 929 if (strstr(value, "TRUE")) { 930 asprintf(&g_getfattr,"setfattr"); 931 log_msg(1, "We will restore XATTRs"); 932 if (! find_home_of_exe("setfattr")) { 933 log_msg(1, "Unable to restore XATTRs as no setfattr found"); 934 } 935 } 915 936 916 937 if (0 == read_cfg_var(cfg_file, "internal-tape-block-size", value)) {
Note:
See TracChangeset
for help on using the changeset viewer.