Changeset 539 in MondoRescue for trunk/mondo/mondo/common/libmondo-archive.c
- Timestamp:
- May 13, 2006, 7:38:44 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mondo/mondo/common/libmondo-archive.c
r507 r539 419 419 * @ingroup archiveGroup 420 420 */ 421 int backup_data(struct s_bkpinfo *bkpinfo )421 int backup_data(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf) 422 422 { 423 423 int retval = 0, res = 0; … … 485 485 run_program_and_log_output(tmp, 1); 486 486 paranoid_free(tmp); 487 retval += make_those_afios_phase(bkpinfo); // backup regular files488 487 retval += make_those_slices_phase(bkpinfo); // backup BIG files 489 488 retval += do_that_final_phase(bkpinfo); // clean up … … 876 875 if (!res) { 877 876 log_to_screen("Boot+data disks were created OK"); 878 asprintf(&command, "mkdir -p / root/images/mindi/");877 asprintf(&command, "mkdir -p /var/cache/mindi/"); 879 878 log_msg(2, command); 880 879 run_program_and_log_output(command, FALSE); … … 882 881 883 882 asprintf(&command, 884 "cp -f %s/images/mindi.iso / root/images/mindi/mondorescue.iso",883 "cp -f %s/images/mindi.iso /var/cache/mindi/mondorescue.iso", 885 884 bkpinfo->scratchdir); 886 885 log_msg(2, command); … … 1107 1106 * @ingroup MLarchiveGroup 1108 1107 */ 1109 int do_that_final_phase(struct s_bkpinfo *bkpinfo )1108 int do_that_final_phase(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf) 1110 1109 { 1111 1110 … … 1126 1125 } else { 1127 1126 /* write final ISO */ 1128 res = write_final_iso_if_necessary(bkpinfo );1127 res = write_final_iso_if_necessary(bkpinfo, mrconf); 1129 1128 retval += res; 1130 1129 if (res) { … … 1406 1405 * @return The number of errors encountered (0 for success) 1407 1406 */ 1408 int make_afioballs_and_images(struct s_bkpinfo *bkpinfo )1407 int make_afioballs_and_images(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf) 1409 1408 { 1410 1409 … … 1548 1547 NULL); 1549 1548 } else { 1550 res = move_files_to_cd(bkpinfo, storing_filelist_fname, 1551 curr_xattr_list_fname, 1552 curr_acl_list_fname, 1553 storing_afioball_fname, NULL); 1549 res = 1550 move_files_to_cd(bkpinfo, mrconf, storing_filelist_fname, 1551 curr_xattr_list_fname, 1552 curr_acl_list_fname, 1553 storing_afioball_fname, NULL); 1554 1554 } 1555 1555 paranoid_free(storing_filelist_fname); … … 1628 1628 * @return The number of errors encountered (0 for success) 1629 1629 */ 1630 int make_iso_fs(struct s_bkpinfo *bkpinfo, char *destfile)1630 int make_iso_fs(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, char *destfile) 1631 1631 { 1632 1632 /*@ int ********************************************** */ … … 1822 1822 #ifdef __IA64__ 1823 1823 log_msg(1, "IA64 --> elilo"); 1824 asprintf(&tmp2,"mkisofs -no-emul-boot -b images/mindi-bootroot.%s.img -c boot.cat -o _ISO_ -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", mrconf->ia64_boot_size); 1824 1825 res = eval_call_to_make_ISO(bkpinfo, 1825 "mkisofs -no-emul-boot -b images/mindi-bootroot." 1826 IA64_BOOT_SIZE 1827 ".img -c boot.cat -o _ISO_ -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", 1826 tmp2, 1828 1827 destfile, 1829 1828 g_current_media_number, … … 1833 1832 // FIXME --- change mkisofs string to MONDO_MKISOFS_REGULAR_SYSLINUX/LILO depending on bkpinfo->make_cd_usE_lilo 1834 1833 // and add ' .' at end 1834 paranoid_free(tmp2); 1835 1835 log_msg(1, "Non-ia64 --> lilo"); 1836 1836 res = eval_call_to_make_ISO(bkpinfo, … … 1956 1956 */ 1957 1957 int 1958 make_slices_and_images(struct s_bkpinfo *bkpinfo, char *biggielist_fname)1958 make_slices_and_images(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, char *biggielist_fname) 1959 1959 { 1960 1960 … … 2029 2029 } else { 2030 2030 // Call ntfsclone (formerly partimagehack) if it's a /dev entry (i.e. a partition to be imaged) 2031 log_msg(2, "bigfile_fname = %s", bigfile_fname);2031 log_msg(2, "bigfile_fname = '%s'", bigfile_fname); 2032 2032 use_ntfsprog = FALSE; 2033 2033 if (!strncmp(bigfile_fname, "/dev/", 5) … … 2076 2076 } 2077 2077 res = 2078 slice_up_file_etc(bkpinfo, bigfile_fname,2078 slice_up_file_etc(bkpinfo, mrconf, bigfile_fname, 2079 2079 ntfsprog_fifo, biggie_file_number, 2080 2080 noof_biggie_files, use_ntfsprog); … … 2125 2125 * @see make_afioballs_and_images 2126 2126 */ 2127 int make_afioballs_and_images_OLD(struct s_bkpinfo *bkpinfo )2127 int make_afioballs_and_images_OLD(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf) 2128 2128 { 2129 2129 … … 2198 2198 res = move_files_to_stream(bkpinfo, curr_afioball_fname, NULL); 2199 2199 } else { 2200 res = move_files_to_cd(bkpinfo, curr_filelist_fname, 2201 curr_xattr_list_fname, 2202 curr_acl_list_fname, 2203 curr_afioball_fname, NULL); 2200 res = 2201 move_files_to_cd(bkpinfo, mrconf, curr_filelist_fname, 2202 curr_xattr_list_fname, 2203 curr_acl_list_fname, curr_afioball_fname, 2204 NULL); 2204 2205 } 2205 2206 retval += res; … … 2246 2247 * @ingroup MLarchiveGroup 2247 2248 */ 2248 int make_those_afios_phase(struct s_bkpinfo *bkpinfo )2249 int make_those_afios_phase(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf) 2249 2250 { 2250 2251 /*@ int ******************************************* */ … … 2263 2264 log_msg(1, 2264 2265 "Using single-threaded make_afioballs_and_images() to suit b0rken FreeBSD 5.0"); 2265 res = make_afioballs_and_images_OLD(bkpinfo );2266 res = make_afioballs_and_images_OLD(bkpinfo, mrconf); 2266 2267 #else 2267 res = make_afioballs_and_images_OLD(bkpinfo );2268 res = make_afioballs_and_images_OLD(bkpinfo, mrconf); 2268 2269 #endif 2269 2270 write_header_block_to_stream(0, "stop-afioballs", 2270 2271 BLK_STOP_AFIOBALLS); 2271 2272 } else { 2272 res = make_afioballs_and_images(bkpinfo );2273 res = make_afioballs_and_images(bkpinfo, mrconf); 2273 2274 } 2274 2275 … … 2376 2377 * transfer files over the network) or leave it as is. 2377 2378 */ 2378 int (*move_files_to_cd) (struct s_bkpinfo *, char *, ...) =2379 int (*move_files_to_cd) (struct s_bkpinfo *, struct s_mrconf *mrconf, char *, ...) = 2379 2380 _move_files_to_cd; 2380 2381 … … 2397 2398 * @return The number of errors encountered (0 for success) 2398 2399 */ 2399 int _move_files_to_cd(struct s_bkpinfo *bkpinfo, char *files_to_add, ...)2400 int _move_files_to_cd(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, char *files_to_add, ...) 2400 2401 { 2401 2402 … … 2436 2437 if (would_occupy / 1024 > bkpinfo->media_size[g_current_media_number]) { 2437 2438 /* FALSE because this is not the last CD we'll write */ 2438 res = write_iso_and_go_on(bkpinfo, FALSE);2439 res = write_iso_and_go_on(bkpinfo, mrconf, FALSE); 2439 2440 retval += res; 2440 2441 if (res) { … … 2480 2481 * @c backup_media_type field is used in this function. 2481 2482 * @param imagesdir The directory containing the floppy images (usually 2482 * / root/images/mindi).2483 * /var/cache/mindi). 2483 2484 * 2484 2485 * @return The number of errors encountered (0 for success) … … 2653 2654 if (!bkpinfo->nonbootable_backup) { 2654 2655 #ifdef __FreeBSD__ 2655 if (!does_file_exist("/ root/images/mindi/mindi-kern.1722.img"))2656 if (!does_file_exist("/var/cache/mindi/mindi-kern.1722.img")) 2656 2657 #else 2657 if (!does_file_exist("/root/images/mindi/mindi-bootroot.1722.img") 2658 && !does_file_exist("/root/images/mindi/mindi-boot.1440.img")) 2658 if (!does_file_exist("/var/cache/mindi/mindi-bootroot.1722.img") 2659 && !does_file_exist("/var/cache/mindi/mindi-boot.1440.img") 2660 && !does_file_exist("/var/cache/mindi/mindi-boot.2880.img") 2661 && !does_file_exist("/var/cache/mindi/mindi-boot.5760.img")) 2659 2662 #endif 2660 2663 { 2661 2664 mvaddstr_and_log_it(g_currentY++, 74, "No Imgs"); 2662 if (does_file_exist("/ root/images/mindi/mondorescue.iso")) {2665 if (does_file_exist("/var/cache/mindi/mondorescue.iso")) { 2663 2666 popup_and_OK 2664 ("Boot+data floppy creation failed.\nHowever, you may burn / root/images/mindi/mondorescue.iso to a CD\nand boot from that instead if you wish.");2667 ("Boot+data floppy creation failed.\nHowever, you may burn /var/cache/mindi/mondorescue.iso to a CD\nand boot from that instead if you wish."); 2665 2668 res++; 2666 2669 } 2667 2670 } else { 2668 offer_to_write_floppies(bkpinfo, "/ root/images/mindi");2671 offer_to_write_floppies(bkpinfo, "/var/cache/mindi"); 2669 2672 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 2670 2673 } … … 3004 3007 */ 3005 3008 int 3006 slice_up_file_etc(struct s_bkpinfo *bkpinfo, char *biggie_filename,3009 slice_up_file_etc(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, char *biggie_filename, 3007 3010 char *ntfsprog_fifo, long biggie_file_number, 3008 3011 long noof_biggie_files, bool use_ntfsprog) … … 3127 3130 bkpinfo->tmpdir, ""), NULL); 3128 3131 } else { 3129 res = move_files_to_cd(bkpinfo, 3130 slice_fname(biggie_file_number, 0, 3131 bkpinfo->tmpdir, ""), NULL); 3132 res = 3133 move_files_to_cd(bkpinfo, mrconf, 3134 slice_fname(biggie_file_number, 0, 3135 bkpinfo->tmpdir, ""), NULL); 3132 3136 } 3133 3137 i = bkpinfo->optimal_set_size / 256; … … 3243 3247 res = move_files_to_stream(bkpinfo, file_to_archive, NULL); 3244 3248 } else { 3245 res = move_files_to_cd(bkpinfo, file_to_archive, NULL);3249 res = move_files_to_cd(bkpinfo, mrconf, file_to_archive, NULL); 3246 3250 } 3247 3251 paranoid_free(file_to_archive); … … 3339 3343 * however, this occurs rarely. 3340 3344 */ 3341 int write_final_iso_if_necessary(struct s_bkpinfo *bkpinfo )3345 int write_final_iso_if_necessary(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf) 3342 3346 { 3343 3347 /*@ int ***************************************************** */ … … 3362 3366 #endif 3363 3367 paranoid_free(tmp); 3364 res = write_iso_and_go_on(bkpinfo, TRUE);3368 res = write_iso_and_go_on(bkpinfo, mrconf, TRUE); 3365 3369 #ifndef _XWIN 3366 3370 if (!g_text_mode) { … … 3390 3394 * @see make_iso_fs 3391 3395 */ 3392 int write_iso_and_go_on(struct s_bkpinfo *bkpinfo, bool last_cd)3396 int write_iso_and_go_on(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, bool last_cd) 3393 3397 { 3394 3398 /*@ pointers **************************************************** */ … … 3468 3472 g_current_media_number); 3469 3473 for (that_one_was_ok = FALSE; !that_one_was_ok;) { 3470 res = make_iso_fs(bkpinfo, isofile);3474 res = make_iso_fs(bkpinfo, mrconf, isofile); 3471 3475 if (g_current_media_number == 1 && !res 3472 3476 && (bkpinfo->backup_media_type == cdr … … 3753 3757 setenv("MONDO_SHARE", MONDO_SHARE, 1); 3754 3758 } 3759 3760 void mrarchive_init_conf(struct s_mrconf *mrconf) { 3761 char *command = NULL; 3762 FILE *conffd = NULL; 3763 FILE *fin = NULL; 3764 int n = 0; 3765 char *param = NULL; 3766 3767 mrconf = (struct s_mrconf *)malloc(sizeof(struct s_mrconf)); 3768 if (mrconf == NULL) { 3769 fatal_error("Unable to malloc mrconf"); 3770 } 3771 /* Default for everything int : 0 char * : NULL */ 3772 3773 /* mindi conf parameters also needed in mondo */ 3774 mrconf->ia64_boot_size = 0; 3775 3776 asprintf(&command, "mindi -printvar IA64_BOOT_SIZE"); 3777 fin = popen(command, "r"); 3778 getline(¶m, &n, fin); 3779 pclose(fin); 3780 paranoid_free(command); 3781 mrconf->ia64_boot_size = atoi(param); 3782 paranoid_free(param); 3783 3784 mrconf->iso_creation_cmd = NULL; 3785 3786 /* Finds mondo conf file */ 3787 mrconf_open(MONDO_CONF_DIR"/mondo.conf"); 3788 3789 /* mondo conf parameters needed */ 3790 mrconf->iso_creation_cmd = mrconf_sread(iso_creation_cmd); 3791 3792 mrconf_close();
Note:
See TracChangeset
for help on using the changeset viewer.