Changeset 538 in MondoRescue for branches/stable/mondo/mondo/common/libmondo-archive.c
- Timestamp:
- May 13, 2006, 6:39:55 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/mondo/common/libmondo-archive.c
r501 r538 580 580 * @ingroup archiveGroup 581 581 */ 582 int backup_data(struct s_bkpinfo *bkpinfo )582 int backup_data(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf) 583 583 { 584 584 int retval = 0, res = 0; … … 643 643 sprintf(tmp, "rm -f %s/images/*.iso", bkpinfo->scratchdir); 644 644 run_program_and_log_output(tmp, 1); 645 retval += make_those_afios_phase(bkpinfo ); // backup regular files645 retval += make_those_afios_phase(bkpinfo,mrconf); // backup regular files 646 646 retval += make_those_slices_phase(bkpinfo); // backup BIG files 647 647 retval += do_that_final_phase(bkpinfo); // clean up … … 1014 1014 if (!res) { 1015 1015 log_to_screen("Boot+data disks were created OK"); 1016 sprintf(command, "mkdir -p / root/images/mindi/");1016 sprintf(command, "mkdir -p /var/cache/mindi/"); 1017 1017 log_msg(2, command); 1018 1018 run_program_and_log_output(command, FALSE); 1019 1019 sprintf(command, 1020 "cp -f %s/images/mindi.iso / root/images/mindi/mondorescue.iso",1020 "cp -f %s/images/mindi.iso /var/cache/mindi/mondorescue.iso", 1021 1021 bkpinfo->scratchdir); 1022 1022 log_msg(2, command); … … 1252 1252 * @ingroup MLarchiveGroup 1253 1253 */ 1254 int do_that_final_phase(struct s_bkpinfo *bkpinfo )1254 int do_that_final_phase(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf) 1255 1255 { 1256 1256 … … 1273 1273 /* write final ISO */ 1274 1274 { 1275 res = write_final_iso_if_necessary(bkpinfo );1275 res = write_final_iso_if_necessary(bkpinfo, mrconf); 1276 1276 retval += res; 1277 1277 if (res) { … … 1563 1563 * @return The number of errors encountered (0 for success) 1564 1564 */ 1565 int make_afioballs_and_images(struct s_bkpinfo *bkpinfo )1565 int make_afioballs_and_images(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf) 1566 1566 { 1567 1567 … … 1707 1707 } else { 1708 1708 res = 1709 move_files_to_cd(bkpinfo, storing_filelist_fname,1709 move_files_to_cd(bkpinfo, mrconf, storing_filelist_fname, 1710 1710 curr_xattr_list_fname, 1711 1711 curr_acl_list_fname, … … 1785 1785 * @return The number of errors encountered (0 for success) 1786 1786 */ 1787 int make_iso_fs(struct s_bkpinfo *bkpinfo, char *destfile)1787 int make_iso_fs(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, char *destfile) 1788 1788 { 1789 1789 /*@ int ********************************************** */ … … 2005 2005 #ifdef __IA64__ 2006 2006 log_msg(1, "IA64 --> elilo"); 2007 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); 2007 2008 res = eval_call_to_make_ISO(bkpinfo, 2008 2009 //-b images/mindi-boot.2880.img 2009 "mkisofs -no-emul-boot -b images/mindi-bootroot." 2010 IA64_BOOT_SIZE 2011 ".img -c boot.cat -o _ISO_ -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", 2010 tmp2, 2012 2011 destfile, 2013 2012 g_current_media_number, … … 2017 2016 // FIXME --- change mkisofs string to MONDO_MKISOFS_REGULAR_SYSLINUX/LILO depending on bkpinfo->make_cd_usE_lilo 2018 2017 // and add ' .' at end 2018 paranoid_free(tmp2); 2019 2019 log_msg(1, "Non-ia64 --> lilo"); 2020 2020 res = … … 2150 2150 */ 2151 2151 int 2152 make_slices_and_images(struct s_bkpinfo *bkpinfo, char *biggielist_fname)2152 make_slices_and_images(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, char *biggielist_fname) 2153 2153 { 2154 2154 … … 2223 2223 } else { 2224 2224 // Call ntfsclone (formerly partimagehack) if it's a /dev entry (i.e. a partition to be imaged) 2225 log_msg(2, "bigfile_fname = %s", bigfile_fname);2225 log_msg(2, "bigfile_fname = '%s'", bigfile_fname); 2226 2226 use_ntfsprog = FALSE; 2227 2227 if (!strncmp(bigfile_fname, "/dev/", 5) … … 2269 2269 } 2270 2270 res = 2271 slice_up_file_etc(bkpinfo, bigfile_fname,2271 slice_up_file_etc(bkpinfo, mrconf, bigfile_fname, 2272 2272 ntfsprog_fifo, biggie_file_number, 2273 2273 noof_biggie_files, use_ntfsprog); … … 2321 2321 * @see make_afioballs_and_images 2322 2322 */ 2323 int make_afioballs_and_images_OLD(struct s_bkpinfo *bkpinfo )2323 int make_afioballs_and_images_OLD(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf) 2324 2324 { 2325 2325 … … 2403 2403 } else { 2404 2404 res = 2405 move_files_to_cd(bkpinfo, curr_filelist_fname,2405 move_files_to_cd(bkpinfo, mrconf, curr_filelist_fname, 2406 2406 curr_xattr_list_fname, 2407 2407 curr_acl_list_fname, curr_afioball_fname, … … 2448 2448 * @ingroup MLarchiveGroup 2449 2449 */ 2450 int make_those_afios_phase(struct s_bkpinfo *bkpinfo )2450 int make_those_afios_phase(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf) 2451 2451 { 2452 2452 /*@ int ******************************************* */ … … 2465 2465 log_msg(1, 2466 2466 "Using single-threaded make_afioballs_and_images() to suit b0rken FreeBSD 5.0"); 2467 res = make_afioballs_and_images_OLD(bkpinfo );2467 res = make_afioballs_and_images_OLD(bkpinfo, mrconf); 2468 2468 #else 2469 res = make_afioballs_and_images_OLD(bkpinfo );2469 res = make_afioballs_and_images_OLD(bkpinfo, mrconf); 2470 2470 #endif 2471 2471 write_header_block_to_stream(0, "stop-afioballs", 2472 2472 BLK_STOP_AFIOBALLS); 2473 2473 } else { 2474 res = make_afioballs_and_images(bkpinfo );2474 res = make_afioballs_and_images(bkpinfo, mrconf); 2475 2475 } 2476 2476 … … 2575 2575 * transfer files over the network) or leave it as is. 2576 2576 */ 2577 int (*move_files_to_cd) (struct s_bkpinfo *, char *, ...) =2577 int (*move_files_to_cd) (struct s_bkpinfo *, struct s_mrconf *mrconf, char *, ...) = 2578 2578 _move_files_to_cd; 2579 2579 … … 2596 2596 * @return The number of errors encountered (0 for success) 2597 2597 */ 2598 int _move_files_to_cd(struct s_bkpinfo *bkpinfo, char *files_to_add, ...)2598 int _move_files_to_cd(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, char *files_to_add, ...) 2599 2599 { 2600 2600 … … 2635 2635 } 2636 2636 if (would_occupy / 1024 > bkpinfo->media_size[g_current_media_number]) { 2637 res = write_iso_and_go_on(bkpinfo, FALSE); /* FALSE because this is not the last CD we'll write */2637 res = write_iso_and_go_on(bkpinfo, struct s_mrconf *mrconf, FALSE); /* FALSE because this is not the last CD we'll write */ 2638 2638 retval += res; 2639 2639 if (res) { … … 2685 2685 * @c backup_media_type field is used in this function. 2686 2686 * @param imagesdir The directory containing the floppy images (usually 2687 * / root/images/mindi).2687 * /var/cache/mindi). 2688 2688 * 2689 2689 * @return The number of errors encountered (0 for success) … … 2864 2864 if (!bkpinfo->nonbootable_backup) { 2865 2865 #ifdef __FreeBSD__ 2866 if (!does_file_exist("/ root/images/mindi/mindi-kern.1722.img"))2866 if (!does_file_exist("/var/cache/mindi/mindi-kern.1722.img")) 2867 2867 #else 2868 if (!does_file_exist("/root/images/mindi/mindi-bootroot.1722.img") 2869 && !does_file_exist("/root/images/mindi/mindi-boot.1440.img")) 2868 if (!does_file_exist("/var/cache/mindi/mindi-bootroot.1722.img") 2869 && !does_file_exist("/var/cache/mindi/mindi-boot.1440.img") 2870 && !does_file_exist("/var/cache/mindi/mindi-boot.2880.img") 2871 && !does_file_exist("/var/cache/mindi/mindi-boot.5760.img")) 2870 2872 #endif 2871 2873 { 2872 2874 mvaddstr_and_log_it(g_currentY++, 74, "No Imgs"); 2873 if (does_file_exist("/ root/images/mindi/mondorescue.iso")) {2875 if (does_file_exist("/var/cache/mindi/mondorescue.iso")) { 2874 2876 popup_and_OK 2875 ("Boot+data floppy creation failed. However, FYI, you may burn / root/images/mindi/mondorescue.iso to a CD and boot from that instead if you wish.");2877 ("Boot+data floppy creation failed. However, FYI, you may burn /var/cache/mindi/mondorescue.iso to a CD and boot from that instead if you wish."); 2876 2878 res++; 2877 2879 } 2878 2880 } else { 2879 offer_to_write_floppies(bkpinfo, "/ root/images/mindi");2881 offer_to_write_floppies(bkpinfo, "/var/cache/mindi"); 2880 2882 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 2881 2883 } … … 3277 3279 */ 3278 3280 int 3279 slice_up_file_etc(struct s_bkpinfo *bkpinfo, char *biggie_filename,3281 slice_up_file_etc(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, char *biggie_filename, 3280 3282 char *ntfsprog_fifo, long biggie_file_number, 3281 3283 long noof_biggie_files, bool use_ntfsprog) … … 3407 3409 } else { 3408 3410 res = 3409 move_files_to_cd(bkpinfo, 3411 move_files_to_cd(bkpinfo, mrconf, 3410 3412 slice_fname(biggie_file_number, 0, 3411 3413 bkpinfo->tmpdir, ""), NULL); … … 3509 3511 res = move_files_to_stream(bkpinfo, file_to_archive, NULL); 3510 3512 } else { 3511 res = move_files_to_cd(bkpinfo, file_to_archive, NULL);3513 res = move_files_to_cd(bkpinfo, mrconf, file_to_archive, NULL); 3512 3514 } 3513 3515 retval += res; … … 3601 3603 * however, this occurs rarely. 3602 3604 */ 3603 int write_final_iso_if_necessary(struct s_bkpinfo *bkpinfo )3605 int write_final_iso_if_necessary(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf) 3604 3606 { 3605 3607 /*@ int ***************************************************** */ … … 3622 3624 } 3623 3625 #endif 3624 res = write_iso_and_go_on(bkpinfo, TRUE);3626 res = write_iso_and_go_on(bkpinfo, struct s_mrconf *mrconf, TRUE); 3625 3627 #ifndef _XWIN 3626 3628 if (!g_text_mode) { … … 3651 3653 * @see make_iso_fs 3652 3654 */ 3653 int write_iso_and_go_on(struct s_bkpinfo *bkpinfo, bool last_cd)3655 int write_iso_and_go_on(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, bool last_cd) 3654 3656 { 3655 3657 /*@ pointers **************************************************** */ … … 3727 3729 g_current_media_number); 3728 3730 for (that_one_was_ok = FALSE; !that_one_was_ok;) { 3729 res = make_iso_fs(bkpinfo, isofile);3731 res = make_iso_fs(bkpinfo, mrconf, isofile); 3730 3732 if (g_current_media_number == 1 && !res 3731 3733 && (bkpinfo->backup_media_type == cdr … … 4029 4031 setenv("MONDO_SHARE", MONDO_SHARE, 1); 4030 4032 } 4033 4034 void mrarchive_init_conf(struct s_mrconf *mrconf) { 4035 char *command = NULL; 4036 FILE *conffd = NULL; 4037 FILE *fin = NULL; 4038 int n = 0; 4039 char *param = NULL; 4040 4041 mrconf = (struct s_mrconf *)malloc(sizeof(struct s_mrconf)); 4042 if (mrconf == NULL) { 4043 fatal_error("Unable to malloc mrconf"); 4044 } 4045 /* Default for everything int : 0 char * : NULL */ 4046 4047 /* mindi conf parameters also needed in mondo */ 4048 mrconf->ia64_boot_size = 0; 4049 4050 asprintf(&command, "mindi -printvar IA64_BOOT_SIZE"); 4051 fin = popen(command, "r"); 4052 getline(¶m, &n, fin); 4053 pclose(fin); 4054 paranoid_free(command); 4055 mrconf->ia64_boot_size = atoi(param); 4056 paranoid_free(param); 4057 4058 mrconf->iso_creation_cmd = NULL; 4059 4060 /* Finds mondo conf file */ 4061 mrconf_open(MONDO_CONF_DIR"/mondo.conf"); 4062 4063 /* mondo conf parameters needed */ 4064 mrconf->iso_creation_cmd = mrconf_sread(iso_creation_cmd); 4065 4066 mrconf_close();
Note:
See TracChangeset
for help on using the changeset viewer.