Changeset 1948 in MondoRescue for branches/2.2.6/mondo
- Timestamp:
- May 26, 2008, 5:35:44 PM (17 years ago)
- Location:
- branches/2.2.6/mondo/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.6/mondo/src/common/libmondo-archive.c
r1946 r1948 847 847 if (write_one_liner_data_file(tmp1, "TRUE")) { 848 848 log_msg(1, "%ld: Unable to write one-liner ACL", 849 __LINE__); 850 } 851 paranoid_free(tmp1); 852 } 853 if (bkpinfo->use_obdr) { 854 asprintf(&tmp1, "%s/OBDR", bkpinfo->tmpdir); 855 if (write_one_liner_data_file(tmp1, "TRUE")) { 856 log_msg(1, "%ld: Unable to write one-liner OBDR", 849 857 __LINE__); 850 858 } -
branches/2.2.6/mondo/src/common/libmondo-cli.c
r1945 r1948 934 934 } 935 935 936 if (!flag_set['o'] 937 && 938 !run_program_and_log_output 939 ("grep -Ei suse /etc/issue.net | grep -E '9.0' | grep 64", 2)) { 936 bkpinfo->use_obdr = FALSE; 937 if (flag_set['o']) { 938 if (!flag_set['t']) { 939 log_to_screen("OBDR support is only available for tapes. Use the -t option"); 940 fatal_error("Aborting"); 941 } 942 bkpinfo->use_obdr = TRUE; 943 } 944 #ifndef __FreeBSD__ 945 if (!is_this_a_valid_disk_format("vfat")) { 940 946 bkpinfo->make_cd_use_lilo = TRUE; 941 947 log_to_screen 942 ("Forcing you to use LILO. SuSE 9.0 (64-bit) has a broken mkfs.vfat binary."); 943 } 944 if (flag_set['o']) { 948 ("Your kernel appears not to support vfat filesystems. I am therefore"); 949 log_to_screen 950 ("using LILO instead of SYSLINUX as the media boot loader."); 951 } 952 if (run_program_and_log_output("which mkfs.vfat", 2)) { 945 953 bkpinfo->make_cd_use_lilo = TRUE; 946 }947 #ifndef __FreeBSD__948 else {949 if (!is_this_a_valid_disk_format("vfat")) {950 bkpinfo->make_cd_use_lilo = TRUE;951 log_to_screen952 ("Your kernel appears not to support vfat filesystems. I am therefore");953 log_to_screen954 ("using LILO instead of SYSLINUX as the media boot loader.");955 }956 if (run_program_and_log_output("which mkfs.vfat", 2)) {957 bkpinfo->make_cd_use_lilo = TRUE;958 954 #ifdef __IA32__ 959 960 961 962 955 log_to_screen 956 ("Your filesystem is missing 'mkfs.vfat', so I cannot use SYSLINUX as"); 957 log_to_screen 958 ("your boot loader. I shall therefore use LILO instead."); 963 959 #endif 964 960 #ifdef __IA64__ 965 966 967 968 961 log_to_screen 962 ("Your filesystem is missing 'mkfs.vfat', so I cannot prepare the EFI"); 963 log_to_screen("environment correctly. Please install it."); 964 fatal_error("Aborting"); 969 965 #endif 970 966 } 971 967 #ifdef __IA64__ 972 973 968 /* We force ELILO usage on IA64 */ 969 bkpinfo->make_cd_use_lilo = TRUE; 974 970 #endif 975 }976 971 #endif 977 972 -
branches/2.2.6/mondo/src/common/libmondo-stream.c
r1943 r1948 4 4 ...tools for talking to tapes, Monitas streams, etc. 5 5 6 7 07/108 - added ACL and XATTR support9 10 04/1711 - added bkpinfo->internal_tape_block_size12 - fixed bug in set_tape_block_size_with_mt()13 14 03/2515 - call 'mt' when opening tape in/out, to set block size to 32K16 17 02/06/200418 - only eject_device() at end of closein_tape() --- not closeout_tape()19 20 10/26/200321 - call eject_device() at end of closein_tape() and closeout_tape()22 23 09/2524 - added docu-header to each subroutine25 26 09/2027 - working on multi-tape code28 - friendlier message in insist_on_this_tape_number()29 - delay is now 5s30 31 09/1032 - adding multi-tape support33 - adding 'back catalog' of previous archives, so that we may resume34 from point of end-of-tape (approx.)35 36 09/0837 - cleaned up insist_on_this_tape_number() --- 10s delay for same tape now38 39 08/2740 - improved find_tape_device_and_size() --- tries /dev/osst*41 42 05/0543 - added Joshua Oreman's FreeBSD patches44 45 04/2446 - added lots of assert()'s and log_OS_error()'s47 48 04/06/200349 - use find_home_of_exe() instead of which50 51 12/13/200252 - cdrecord -scanbus call was missing 2> /dev/null53 54 11/2455 - disabled fatal_error("Bad marker")56 57 10/2958 - replaced convoluted grep wih wc (KP)59 60 09/0761 - removed g_end_of_tape_reached62 - lots of multitape-related fixes63 64 08/01 - 08/3165 - write 16MB of zeroes to end of tape when closing(out)66 - compensate for 'buffer' and its distortion of speed of writing/reading67 when writing/reading data disks at start of tape68 - rewrote lots of multitape stuff69 - wrote workaround to allow >2GB of archives w/buffering70 - do not close/reopen tape when starting to read/write from71 new tape: no need! 'buffer' handles all that; we're writing72 to/reading from a FIFO, so no need to close/reopen when new tape73 - write 8MB of zeroes at end of tape, just in case74 - re-enable various calls to *_evalcall_form75 - added g_end_of_tape_reached76 - fixed bugs in start_to_[read|write]_[to|from]_next_tape77 - added internal buffering, replacing the external 'buffer' exe78 - wait 10 seconds (after user inserts new tape), to79 let tape stabilize in drive80 - added insist_on_this_tape_number()81 - worked on find_tape_device_and_size()82 - cleaned up some log_it() calls83 - added find_tape_device_and_size()84 - replaced using_cdstream with backup_media_type85 - replace *_from_tape with *_from_stream86 - replace *_to_stream with *_to_stream87 88 07/01 - 07/3189 - leave 32MB at end of tape, to avoid overrunning90 - started [07/24/2002]91 6 */ 92 7 … … 753 668 return (0); 754 669 } 670 if (bkpinfo->use_obdr) { 671 skip_obdr(tapedev); 672 } 673 755 674 insist_on_this_tape_number(1); 756 675 sprintf(outfname, "%s/tmp/all.tar.gz", bkpinfo->tmpdir); … … 864 783 865 784 /** 866 * Start writing to a tape device for the backup. 785 * Return the non-rewinding device when passed the normal one 786 * @param tapedev The tape device to open for writing. 787 * @note the caller needs to free the string returned 788 */ 789 char *get_non_rewind_dev(char *tapedev) 790 { 791 792 char *ntapedev = NULL; 793 char *p = NULL; 794 char *q = NULL; 795 796 ntapedev = (char *)malloc(strlen(tapedev)+sizeof(char)); 797 p = strrchr(tapedev,'/'); 798 if (p == NULL) { 799 return(NULL); 800 } 801 802 /* Copy tapedev content up to the last / */ 803 q = tapedev; 804 while (q != p) { 805 *ntapedev = *q; 806 ntapedev++; 807 q++; 808 } 809 /* Copy the '/' */ 810 *ntapedev = *q; 811 ntapedev++; 812 q++; 813 /* Adds a 'n' - non-rewinding */ 814 *ntapedev = 'n'; 815 ntapedev++; 816 /* Copy the rest of tapedev */ 817 while (*q != '\0') { 818 *ntapedev = *q; 819 ntapedev++; 820 q++; 821 } 822 *ntapedev = '\0'; 823 if (mt_says_tape_exists(ntapedev)) { 824 log_it("Non-rewinding tape device is %s",ntapedev); 825 } else { 826 log_it("Unable to find non-rewinding tape device."); 827 ntapedev = NULL; 828 } 829 return(ntapedev); 830 } 831 832 833 /** 834 * Handle OBDR if we were asked to do so 867 835 * @param tapedev The tape device to open for writing. 868 836 * @return 0 for success, nonzero for failure. … … 870 838 * EXISTING DATA on the tape! 871 839 */ 840 void skip_obdr(char *tapedev) 841 { 842 char *command = NULL; 843 844 ntapedev = get_non_rewind_dev(tapedev); 845 if (ntapedev == NULL) { 846 log_it("Not skipping OBDR"); 847 } 848 849 asprintf(&command, "mt -f %s fsf 2", ntapedev); 850 run_program_and_log_output(command, 1); 851 paranoid_free(command); 852 } 853 854 int create_obdr(char *tapedev) 855 { 856 857 char *ntapedev = NULL; 858 char *command = NULL; 859 int res = 0; 860 861 ntapedev = get_non_rewind_dev(tapedev); 862 if (ntapedev == NULL) { 863 log_it("Skipping OBDR"); 864 return(1); 865 } 866 867 /* OBDR: First block 10 kB of zero bs = 512 */ 868 asprintf(&command, "mt -f %s compression off", tapedev); 869 res = run_program_and_log_output(command, 1); 870 paranoid_free(command); 871 872 asprintf(&command, "mt -f %s rewind", tapedev); 873 res = run_program_and_log_output(command, 1); 874 paranoid_free(command); 875 876 asprintf(&command, "mt -f %s setblk 512", ntapedev); 877 res = run_program_and_log_output(command, 1); 878 paranoid_free(command); 879 880 asprintf(&command, "dd if=/dev/zero of=%s bs=512 count=20", ntapedev); 881 res = run_program_and_log_output(command, 1); 882 paranoid_free(command); 883 884 /* OBDR: then ISO boot image bs = 2048 */ 885 asprintf(&command, "mt -f %s setblk 2048", ntapedev); 886 res = run_program_and_log_output(command, 1); 887 paranoid_free(command); 888 889 asprintf(&command, "dd if=%s of=%s bs=2048", ntapedev); 890 res = run_program_and_log_output(command, 1); 891 paranoid_free(command); 892 893 } 894 895 /** 896 * Start writing to a tape device for the backup. 897 * Handle OBDR if we were asked to do so 898 * @param tapedev The tape device to open for writing. 899 * @return 0 for success, nonzero for failure. 900 * @note This should be called ONLY from backup processes. It will OVERWRITE ANY 901 * EXISTING DATA on the tape! 902 */ 872 903 int openout_tape(char *tapedev, long internal_tape_block_size) 873 904 { 874 // char sz_call_to_buffer[MAX_STR_LEN];875 905 876 906 g_current_media_number = 1; … … 884 914 g_tapecatalog->entries = 0; 885 915 g_tape_posK = 0; 916 917 if (bkpindo->use_obdr) { 918 create_obdr(tapedev); 919 } 886 920 887 921 set_tape_block_size_with_mt(tapedev, internal_tape_block_size); -
branches/2.2.6/mondo/src/common/mondostructures.h
r1899 r1948 606 606 */ 607 607 bool make_cd_use_lilo; 608 609 /** 610 * If TRUE, make the the tape bootable. If FALSE, normal tape, the default 611 */ 612 bool use_obdr; 608 613 }; 609 614 -
branches/2.2.6/mondo/src/mondorestore/mondo-rstr-tools.c
r1937 r1948 1041 1041 read_cfg_var(cfg_file, "use-star", value); 1042 1042 if (strstr(value, "yes")) { 1043 bkpinfo->use_star = TRUE; 1044 log_msg(1, "Goody! ... bkpinfo->use_star is now true."); 1043 bkpinfo->use_star = TRUE; 1044 log_msg(1, "Goody! ... bkpinfo->use_star is now true."); 1045 } 1046 1047 read_cfg_var(cfg_file, "obdr", value); 1048 if (strstr(value, "TRUE")) { 1049 bkpinfo->use_obdr = TRUE; 1050 log_msg(1, "OBDR mode activated"); 1045 1051 } 1046 1052 1047 1053 read_cfg_var(cfg_file, "acl", value); 1048 1054 if (strstr(value, "TRUE")) { 1049 asprintf(&g_getfacl,"setfacl");1050 log_msg(1, "We will restore ACLs");1051 if (! find_home_of_exe("setfacl")) {1052 log_msg(1, "Unable to restore ACLs as no setfacl found");1053 }1055 asprintf(&g_getfacl,"setfacl"); 1056 log_msg(1, "We will restore ACLs"); 1057 if (! find_home_of_exe("setfacl")) { 1058 log_msg(1, "Unable to restore ACLs as no setfacl found"); 1059 } 1054 1060 } 1055 1061 read_cfg_var(cfg_file, "xattr", value); 1056 1062 if (strstr(value, "TRUE")) { 1057 asprintf(&g_getfattr,"setfattr");1058 log_msg(1, "We will restore XATTRs");1059 if (! find_home_of_exe("setfattr")) {1060 log_msg(1, "Unable to restore XATTRs as no setfattr found");1061 }1063 asprintf(&g_getfattr,"setfattr"); 1064 log_msg(1, "We will restore XATTRs"); 1065 if (! find_home_of_exe("setfattr")) { 1066 log_msg(1, "Unable to restore XATTRs as no setfattr found"); 1067 } 1062 1068 } 1063 1069
Note:
See TracChangeset
for help on using the changeset viewer.