Changeset 2462 in MondoRescue for branches/2.2.10/mondo
- Timestamp:
- Oct 20, 2009, 4:07:00 PM (15 years ago)
- Location:
- branches/2.2.10/mondo
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-archive.c
r2460 r2462 513 513 char *bootldr_str = NULL; 514 514 char *tape_device = NULL; 515 char *last_filelist_number = NULL;516 515 char *broken_bios_sz = NULL; 517 516 char *cd_recovery_sz = NULL; … … 546 545 } 547 546 lines_in_filelist = count_lines_in_file(tmp); 548 mr_free(tmp);549 550 mr_asprintf(tmp, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir);551 last_filelist_number = last_line_of_file(tmp);552 547 mr_free(tmp); 553 548 … … 805 800 (bkpinfo->image_devs == NULL) ? "\"\"" : bkpinfo->image_devs, // parameter #10 806 801 broken_bios_sz, // parameter #11 807 last_filelist_number, // parameter #12 (STRING) 808 estimated_total_noof_slices, // parameter #13 (INT) 809 (bkpinfo->exclude_devs == NULL) ? "\"\"" : bkpinfo->exclude_devs, // parameter #14 810 use_comp_sz, // parameter #15 811 use_lilo_sz, // parameter #16 812 use_star_sz, // parameter #17 813 bkpinfo->internal_tape_block_size, // parameter #18 (LONG) 814 bkpinfo->differential, // parameter #19 (INT) 815 use_gzip_sz, // parameter #20 (STRING) 816 use_lzma_sz, // parameter #21 (STRING) 802 estimated_total_noof_slices, // parameter #12 (INT) 803 (bkpinfo->exclude_devs == NULL) ? "\"\"" : bkpinfo->exclude_devs, // parameter #13 804 use_comp_sz, // parameter #14 805 use_lilo_sz, // parameter #15 806 use_star_sz, // parameter #16 807 bkpinfo->internal_tape_block_size, // parameter #17 (LONG) 808 bkpinfo->differential, // parameter #18 (INT) 809 use_gzip_sz, // parameter #19 (STRING) 810 use_lzma_sz, // parameter #20 (STRING) 817 811 MONDO_LOGFILE); 818 812 819 813 mr_free(tmp2); 820 mr_free(last_filelist_number);821 814 mr_free(tape_device); 822 815 mr_free(use_lzo_sz); -
branches/2.2.10/mondo/src/common/libmondo-cli.c
r2444 r2462 671 671 mr_free(bkpinfo->kernel_path); 672 672 mr_asprintf(bkpinfo->kernel_path, "%s", flag_val['k']); 673 if (!strcmp(bkpinfo->kernel_path, "failsafe")) { 674 mr_free(bkpinfo->kernel_path); 675 mr_asprintf(bkpinfo->kernel_path, "FAILSAFE"); 676 } 677 if (strcmp(bkpinfo->kernel_path, "FAILSAFE") && !does_file_exist(bkpinfo->kernel_path)) { 673 if (!does_file_exist(bkpinfo->kernel_path)) { 678 674 retval++; 679 675 log_to_screen("You specified kernel '%s', which does not exist\n", bkpinfo->kernel_path); -
branches/2.2.10/mondo/src/common/libmondo-devices.c
r2460 r2462 2731 2731 paranoid_fclose(fin); 2732 2732 } else { 2733 if (does_file_exist( "/tmp/mondo-restore.cfg")) {2733 if (does_file_exist(MINDI_CACHE"/mondorestore.cfg")) { 2734 2734 mr_free(bkpinfo->media_device); 2735 bkpinfo->media_device = read_cfg_var( "/tmp/mondo-restore.cfg", "media-dev");2735 bkpinfo->media_device = read_cfg_var(MINDI_CACHE"/mondorestore.cfg", "media-dev"); 2736 2736 } 2737 2737 } … … 3075 3075 ("Will you want to verify your backups after Mondo has created them?"); 3076 3076 3077 #ifndef __FreeBSD__3078 if (!ask_me_yes_or_no3079 ("Are you confident that your kernel is a sane, sensible, standard Linux kernel? Say 'no' if you are using a Gentoo <1.4 or Debian <3.0, please."))3080 #endif3081 {3082 mr_free(bkpinfo->kernel_path);3083 mr_asprintf(bkpinfo->kernel_path, "FAILSAFE");3084 }3085 3086 3077 if (!ask_me_yes_or_no 3087 3078 ("Are you sure you want to proceed? Hit 'no' to abort.")) { -
branches/2.2.10/mondo/src/common/libmondo-filelist.c
r2444 r2462 322 322 mr_free(biggie_fname); 323 323 324 mr_asprintf(outfname, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir); 325 mr_asprintf(tmp, "%ld", curr_set_no); 326 if (write_one_liner_data_file(outfname, tmp)) { 327 log_OS_error 328 ("Unable to echo write one-liner to LAST-FILELIST-NUMBER"); 329 err = 1; 330 } 324 mr_asprintf(tmp, "echo 'last-filelist-number %ld' >> "MINDI_CACHE"/mondorestore.cfg", curr_set_no); 325 paranoid_system(tmp); 331 326 mr_free(tmp); 332 mr_free(outfname);333 327 334 328 if (curr_set_no == 0) { … … 708 702 assert(bkpinfo != NULL); 709 703 710 mr_asprintf(cfg_fname, "%s/mondo -restore.cfg", bkpinfo->tmpdir);704 mr_asprintf(cfg_fname, "%s/mondorestore.cfg", MINDI_CACHE); 711 705 val_sz = read_cfg_var(cfg_fname, "last-filelist-number"); 712 706 mr_free(cfg_fname); -
branches/2.2.10/mondo/src/common/libmondo-files.c
r2406 r2462 705 705 706 706 /** 707 * Determine the size (in KB) of @p dev in the mountlist in <tt>tmpdir</tt>/mountlist.txt.707 * Determine the size (in KB) of @p dev in the mountlist in mountlist.txt. 708 708 * @param tmpdir The tempdir where the mountlist is stored. 709 709 * @param dev The device to search for. … … 717 717 long file_len_K; 718 718 719 mr_asprintf(mountlist, "%s/mountlist.txt", tmpdir);720 mr_asprintf(command, "grep \"%s \" %s/mountlist.txt | head -n1 | awk '{print $4}'", dev, tmpdir);719 mr_asprintf(mountlist, "%s/mountlist.txt", MINDI_CACHE); 720 mr_asprintf(command, "grep \"%s \" %s/mountlist.txt | head -n1 | awk '{print $4}'", dev, MINDI_CACHE); 721 721 mr_free(mountlist); 722 722 … … 992 992 * Copy the files that Mondo/Mindi need to run to the scratchdir or tempdir. 993 993 * Currently this includes: copy Mondo's home directory to scratchdir, 994 * copy LAST-FILELIST-NUMBER to scratchdir, copypost-nuke.tgz (if it exists) to tmpdir,994 * copy post-nuke.tgz (if it exists) to tmpdir, 995 995 * and run "hostname > scratchdir/HOSTNAME". 996 996 * @param bkpinfo The backup information structure. Fields used: … … 1020 1020 if (res) { 1021 1021 fatal_error("Failed to copy Mondo's stuff to scratchdir"); 1022 }1023 1024 mr_asprintf(command, "cp -f %s/LAST-FILELIST-NUMBER %s", bkpinfo->tmpdir, bkpinfo->scratchdir);1025 res = run_program_and_log_output(command, FALSE);1026 mr_free(command);1027 1028 if (res) {1029 fatal_error("Failed to copy LAST-FILELIST-NUMBER to scratchdir");1030 1022 } 1031 1023 -
branches/2.2.10/mondo/src/common/libmondo-stream.c
r2405 r2462 856 856 (void) getcwd(old_cwd, MAX_STR_LEN); 857 857 chdir(bkpinfo->tmpdir); 858 mr_asprintf(tmp, "tar -zxf %s . /tmp/mondo-restore.cfg 2> /dev/null", outfname);858 mr_asprintf(tmp, "tar -zxf %s ."MINDI_CACHE"/mondorestore.cfg 2> /dev/null", outfname); 859 859 paranoid_system(tmp); 860 860 mr_free(tmp); 861 861 862 paranoid_system("cp -f tmp/mondo-restore.cfg . 2> /dev/null");862 paranoid_system("cp -f ."MINDI_CACHE"/mondorestore.cfg . 2> /dev/null"); 863 863 chdir(old_cwd); 864 864 unlink(outfname); -
branches/2.2.10/mondo/src/common/libmondo-tools.c
r2444 r2462 1071 1071 /** 1072 1072 * Retrieve the line containing @p label from the config file. 1073 * @param config_file The file to read from, usually @c /tmp/mondo-restore.cfg.1073 * @param config_file The file to read from, usually @c mondorestore.cfg. 1074 1074 * @param label What to read from the file. 1075 1075 * @param value Where to put it. … … 1294 1294 * Write a line to a configuration file. Writes a line of the form, 1295 1295 * @c label @c value. 1296 * @param config_file The file to write to. Usually @c mondo -restore.cfg.1296 * @param config_file The file to write to. Usually @c mondorestore.cfg. 1297 1297 * @param label What to call this bit of data you're writing. 1298 1298 * @param value The bit of data you're writing. -
branches/2.2.10/mondo/src/common/mondostructures.h
r2428 r2462 557 557 558 558 /** 559 * Path to the user's kernel, or "FAILSAFE" or "SUCKS" to use the kernel 560 * included with Mindi. 559 * Path to the user's kernel included with Mindi. 561 560 */ 562 561 char *kernel_path; -
branches/2.2.10/mondo/src/include/my-stuff.h
r2420 r2462 74 74 * The location where mindi media images are stored. 75 75 */ 76 #define MINDI_CACHE "/var/cache/mindi" 76 #define MINDI_CACHE_REL "var/cache/mindi" /* Should be coherent with mindi */ 77 #define MINDI_CACHE "/"MINDI_CACHE_REL 77 78 78 79 /** -
branches/2.2.10/mondo/src/mondorestore/mondo-prep.c
r2405 r2462 1573 1573 if (pout_to_fdisk) { 1574 1574 // mark relevant partition as bootable 1575 tmp1 = call_program_and_get_last_line_of_output ("make-me-bootable /tmp/mountlist.txt dummy");1575 tmp1 = call_program_and_get_last_line_of_output ("make-me-bootable "MINDI_CACHE"/mountlist.txt dummy"); 1576 1576 mr_asprintf(tmp, "a\n%s\n", tmp1); 1577 1577 mr_free(tmp1); -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-compare.c
r2420 r2462 649 649 chdir(bkpinfo->restore_path); 650 650 651 mr_asprintf(command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp", bkpinfo->restore_path);652 run_program_and_log_output(command, FALSE);653 mr_free(command);654 655 651 mvaddstr_and_log_it(g_currentY, 656 652 0, "Verifying archives against filesystem"); … … 705 701 getcwd(dir, MAX_STR_LEN); 706 702 chdir(bkpinfo->restore_path); 707 mr_asprintf(command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp", bkpinfo->restore_path);708 run_program_and_log_output(command, FALSE);709 mr_free(command);710 703 711 704 mvaddstr_and_log_it(g_currentY, -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c
r2451 r2462 26 26 * The mountlist stub (appended to the directory where all.tar.gz was unpacked). 27 27 */ 28 #define MOUNTLIST_FNAME_STUB "tmp/mountlist.txt"29 30 /** 31 * The mondo -restore.cfg stub (appended to the directory where all.tar.gz was unpacked).28 #define MOUNTLIST_FNAME_STUB MINDI_CACHE_REL"/mountlist.txt" 29 30 /** 31 * The mondorestore.cfg stub (appended to the directory where all.tar.gz was unpacked). 32 32 */ 33 #define MONDO_CFG_FILE_STUB "tmp/mondo-restore.cfg"33 #define MONDO_CFG_FILE_STUB MINDI_CACHE_REL"/mondorestore.cfg" 34 34 /** 35 35 * The i-want-my-lvm stub … … 157 157 158 158 /** 159 * Extract @c mondo -restore.cfg and @c mountlist.txt from @p ramdisk_fname.159 * Extract @c mondorestore.cfg and @c mountlist.txt from @p ramdisk_fname. 160 160 * @param bkpinfo The backup information structure. @c tmpdir is the only field used. 161 161 * @param ramdisk_fname The filename of the @b compressed ramdisk to look in. … … 167 167 168 168 /** 169 * Keep trying to get mondo -restore.cfg from the archive, until the user gives up.169 * Keep trying to get mondorestore.cfg from the archive, until the user gives up. 170 170 */ 171 171 void get_cfg_file_from_archive_or_bust() … … 678 678 /** 679 679 * Fill out @p bkpinfo based on @p cfg_file. 680 * @param cfg_file The mondo -restore.cfg file to read into @p bkpinfo.680 * @param cfg_file The mondorestore.cfg file to read into @p bkpinfo. 681 681 * @param bkpinfo The backup information structure to fill out with information 682 682 * from @p cfg_file. … … 1574 1574 if (!run_program_and_log_output("which grub-MR", FALSE)) { 1575 1575 log_msg(1, "Yay! grub-MR found..."); 1576 mr_asprintf(command, "grub-MR %s /tmp/mountlist.txt", boot_device);1576 mr_asprintf(command, "grub-MR %s "MINDI_CACHE"/mountlist.txt", boot_device); 1577 1577 log_msg(1, "command = %s", command); 1578 1578 } else { … … 1872 1872 } else { 1873 1873 /* nuke mode */ 1874 mr_asprintf(command, "raw-MR %s /tmp/mountlist.txt", boot_device);1874 mr_asprintf(command, "raw-MR %s "MINDI_CACHE"/mountlist.txt", boot_device); 1875 1875 log_msg(2, "run_raw_mbr() --- command='%s'", command); 1876 1876 … … 2128 2128 2129 2129 /** 2130 * Extract mondo -restore.cfg and the mountlist from the tape inserted2130 * Extract mondorestore.cfg and the mountlist from the tape inserted 2131 2131 * to the ./tmp/ directory. 2132 2132 * @param dev The tape device to read from. … … 2261 2261 mr_free(tmp); 2262 2262 2263 if (!does_file_exist( "tmp/mondo-restore.cfg")) {2263 if (!does_file_exist(MINDI_CACHE_REL"/mondorestore.cfg")) { 2264 2264 log_to_screen("Cannot find config info on media"); 2265 2265 return (1); … … 2345 2345 } 2346 2346 2347 log_to_screen("Recovered mondo -restore.cfg");2347 log_to_screen("Recovered mondorestore.cfg"); 2348 2348 if (!does_file_exist(MOUNTLIST_FNAME_STUB)) { 2349 2349 log_to_screen("...but not mountlist.txt - a pity, really..."); -
branches/2.2.10/mondo/src/mondorestore/mondorestore.c
r2405 r2462 102 102 103 103 /** 104 * The location of 'mondo -restore.cfg', containing the metadata104 * The location of 'mondorestore.cfg', containing the metadata 105 105 * information for this backup. 106 106 */ … … 162 162 assert(raidlist != NULL); 163 163 if (!bkpinfo->disaster_recovery) { 164 strcpy(g_mountlist_fname, "/tmp/mountlist.txt");164 strcpy(g_mountlist_fname, MINDI_CACHE"/mountlist.txt"); 165 165 log_msg(2, "I guess you're testing edit_mountlist()"); 166 166 } … … 2074 2074 2075 2075 mvaddstr_and_log_it(g_currentY, 0, "Restoring from archives"); 2076 log_msg(2, "Insisting on 1st CD , so that I can have a look at LAST-FILELIST-NUMBER");2076 log_msg(2, "Insisting on 1st CD"); 2077 2077 if (g_current_media_number != 1) { 2078 2078 log_msg(3, "OK, that's jacked up."); … … 2695 2695 load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME); 2696 2696 if (!does_file_exist(g_mountlist_fname)) { 2697 strcpy(g_mountlist_fname, "/tmp/mountlist.txt");2697 strcpy(g_mountlist_fname, MINDI_CACHE"/mountlist.txt"); 2698 2698 } 2699 2699 res = let_user_edit_the_mountlist(mountlist, raidlist); … … 2795 2795 log_msg(0, "Partitioning only."); 2796 2796 load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME); 2797 strcpy(g_mountlist_fname, "/tmp/mountlist.txt");2797 strcpy(g_mountlist_fname, MINDI_CACHE"/mountlist.txt"); 2798 2798 load_mountlist(mountlist, g_mountlist_fname); 2799 2799 res = partition_everything(mountlist); … … 2804 2804 log_msg(0, "Formatting only."); 2805 2805 load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME); 2806 strcpy(g_mountlist_fname, "/tmp/mountlist.txt");2806 strcpy(g_mountlist_fname, MINDI_CACHE"/mountlist.txt"); 2807 2807 load_mountlist(mountlist, g_mountlist_fname); 2808 2808 res = format_everything(mountlist, FALSE, raidlist); … … 2813 2813 log_msg(0, "Stopping LVM and RAID"); 2814 2814 load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME); 2815 strcpy(g_mountlist_fname, "/tmp/mountlist.txt");2815 strcpy(g_mountlist_fname, MINDI_CACHE"/mountlist.txt"); 2816 2816 load_mountlist(mountlist, g_mountlist_fname); 2817 2817 res = do_my_funky_lvm_stuff(TRUE, FALSE); -
branches/2.2.10/mondo/src/restore-scripts/mondo/format-and-kludge-vfat
r2186 r2462 115 115 umount /mnt/tmpK || Die "Can't unmount /mnt/tmpK" 116 116 117 ideal_size=`grep "$device " /tmp/mountlist.txt | tr -s ' ' ' ' | cut -d' ' -f4`117 ideal_size=`grep "$device " $MINI_CACHE/mountlist.txt | tr -s ' ' ' ' | cut -d' ' -f4` 118 118 if [ "$ideal_size" = "" ]; then 119 119 LogIt "format-and-kludge-vfat --- can't find $device in mountlist" 1 -
branches/2.2.10/mondo/src/restore-scripts/mondo/grub-MR
r2451 r2462 93 93 94 94 if [ "$#" -ne "2" ] ; then 95 Die "grub-MR <MBR drive> <mountlist filename>; e.g. grub-MR /dev/hda /tmp/mountlist.txt"95 Die "grub-MR <MBR drive> <mountlist filename>; e.g. grub-MR /dev/hda $MINDI_CACHE/mountlist.txt" 96 96 fi 97 97 [ ! -f "$2" ] && Die "mountlist file not found" -
branches/2.2.10/mondo/src/restore-scripts/mondo/label-partitions-as-necessary
r2172 r2462 55 55 LogIt "Identifying your drives with tune2fs" 56 56 if [ "$#" -ne "1" ] ; then 57 LogIt "label-partitions-as-necessary /tmp/mountlist.txt < /tmp/fstab.new" 157 LogIt "label-partitions-as-necessary $MINDI_CACHE/mountlist.txt < /tmp/fstab.new" 1 58 58 exit 1 59 59 fi -
branches/2.2.10/mondo/src/restore-scripts/mondo/mount-me
r680 r2462 1 1 #!/bin/sh 2 2 3 mountlist= /tmp/mountlist.txt3 mountlist=$MINDI_CACHE/mountlist.txt 4 4 5 5 if [ "$#" -ne "0" ] ;then -
branches/2.2.10/mondo/src/restore-scripts/mondo/stabelilo-me
r1567 r2462 122 122 123 123 WhatIsFirstDriveCalled() { 124 cut -d' ' -f1 /tmp/mountlist.txt \124 cut -d' ' -f1 $MINDI_CACHE/mountlist.txt \ 125 125 | sed s/[0-9]// | sed s/[0-9]// \ 126 126 | sort -u | head -n 1 … … 133 133 LocateOldFstab 134 134 LocateOldElilo 135 old_mountlist= /tmp/mountlist.original136 new_mountlist= /tmp/mountlist.txt135 old_mountlist=$MINDI_CACHE/mountlist.original 136 new_mountlist=$MINDI_CACHE/mountlist.txt 137 137 QuitIfNotFound $old_mountlist 138 138 QuitIfNotFound $new_mountlist -
branches/2.2.10/mondo/src/restore-scripts/mondo/stabgrub-me
r2451 r2462 116 116 LocateOldFstab 117 117 LocateOldGrub 118 old_mountlist= /tmp/mountlist.original119 new_mountlist= /tmp/mountlist.txt118 old_mountlist=$MINDI_CACHE/mountlist.original 119 new_mountlist=$MINDI_CACHE/mountlist.txt 120 120 QuitIfNotFound $old_mountlist 121 121 QuitIfNotFound $new_mountlist -
branches/2.2.10/mondo/src/restore-scripts/mondo/stablilo-me
r567 r2462 91 91 92 92 WhatIsFirstDriveCalled() { 93 cut -d' ' -f1 /tmp/mountlist.txt \93 cut -d' ' -f1 $MINDI_CACHE/mountlist.txt \ 94 94 | sed s/[0-9]// | sed s/[0-9]// \ 95 95 | sort -u | head -n 1 … … 101 101 LogIt "stablilo-me --- starting" 102 102 LocateOldFstab 103 old_mountlist= /tmp/mountlist.original104 new_mountlist= /tmp/mountlist.txt103 old_mountlist=$MINDI_CACHE/mountlist.original 104 new_mountlist=$MINDI_CACHE/mountlist.txt 105 105 QuitIfNotFound $old_mountlist 106 106 QuitIfNotFound $new_mountlist -
branches/2.2.10/mondo/src/restore-scripts/mondo/stabraw-me
r1315 r2462 82 82 LogIt "stabraw-me --- starting" 83 83 LocateOldFstab 84 old_mountlist= /tmp/mountlist.original85 new_mountlist= /tmp/mountlist.txt84 old_mountlist=$MINDI_CACHE/mountlist.original 85 new_mountlist=$MINDI_CACHE/mountlist.txt 86 86 QuitIfNotFound $old_mountlist 87 87 QuitIfNotFound $new_mountlist -
branches/2.2.10/mondo/src/restore-scripts/mondo/unmount-me
r567 r2462 1 1 #!/bin/sh 2 2 3 mountlist= /tmp/mountlist.txt3 mountlist=$MINDI_CACHE/mountlist.txt 4 4 5 5 if [ "$#" -ne "0" ] ;then -
branches/2.2.10/mondo/test/test-mountlist.c
r2421 r2462 68 68 69 69 setup_newt_stuff(); 70 mr_asprintf(g_mountlist_fname, "/tmp/mountlist.txt");70 mr_asprintf(g_mountlist_fname, MINDI_CACHE"/mountlist.txt"); 71 71 log_it("before mountlist"); 72 72 load_mountlist(mountlist, g_mountlist_fname);
Note:
See TracChangeset
for help on using the changeset viewer.