Changeset 539 in MondoRescue for trunk/mondo/mondo/common/libmondo-archive.c


Ignore:
Timestamp:
May 13, 2006, 7:38:44 PM (18 years ago)
Author:
bcornec
Message:

merge -r 534:538 $SVN_M/branches/stable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mondo/mondo/common/libmondo-archive.c

    r507 r539  
    419419 * @ingroup archiveGroup
    420420 */
    421 int backup_data(struct s_bkpinfo *bkpinfo)
     421int backup_data(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf)
    422422{
    423423    int retval = 0, res = 0;
     
    485485    run_program_and_log_output(tmp, 1);
    486486    paranoid_free(tmp);
    487     retval += make_those_afios_phase(bkpinfo);  // backup regular files
    488487    retval += make_those_slices_phase(bkpinfo); // backup BIG files
    489488    retval += do_that_final_phase(bkpinfo); // clean up
     
    876875    if (!res) {
    877876        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/");
    879878        log_msg(2, command);
    880879        run_program_and_log_output(command, FALSE);
     
    882881
    883882        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",
    885884                 bkpinfo->scratchdir);
    886885        log_msg(2, command);
     
    11071106 * @ingroup MLarchiveGroup
    11081107 */
    1109 int do_that_final_phase(struct s_bkpinfo *bkpinfo)
     1108int do_that_final_phase(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf)
    11101109{
    11111110
     
    11261125    } else {
    11271126        /* write final ISO */
    1128         res = write_final_iso_if_necessary(bkpinfo);
     1127        res = write_final_iso_if_necessary(bkpinfo, mrconf);
    11291128        retval += res;
    11301129        if (res) {
     
    14061405 * @return The number of errors encountered (0 for success)
    14071406 */
    1408 int make_afioballs_and_images(struct s_bkpinfo *bkpinfo)
     1407int make_afioballs_and_images(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf)
    14091408{
    14101409
     
    15481547                                         NULL);
    15491548            } 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);
    15541554            }
    15551555            paranoid_free(storing_filelist_fname);
     
    16281628 * @return The number of errors encountered (0 for success)
    16291629 */
    1630 int make_iso_fs(struct s_bkpinfo *bkpinfo, char *destfile)
     1630int make_iso_fs(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, char *destfile)
    16311631{
    16321632    /*@ int ********************************************** */
     
    18221822#ifdef __IA64__
    18231823                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);
    18241825                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,
    18281827                                            destfile,
    18291828                                            g_current_media_number,
     
    18331832// FIXME --- change mkisofs string to MONDO_MKISOFS_REGULAR_SYSLINUX/LILO depending on bkpinfo->make_cd_usE_lilo
    18341833// and add ' .' at end
     1834                paranoid_free(tmp2);
    18351835                log_msg(1, "Non-ia64 --> lilo");
    18361836                res = eval_call_to_make_ISO(bkpinfo,
     
    19561956 */
    19571957int
    1958 make_slices_and_images(struct s_bkpinfo *bkpinfo, char *biggielist_fname)
     1958make_slices_and_images(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, char *biggielist_fname)
    19591959{
    19601960
     
    20292029        } else {
    20302030            // 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);
    20322032            use_ntfsprog = FALSE;
    20332033            if (!strncmp(bigfile_fname, "/dev/", 5)
     
    20762076            }
    20772077            res =
    2078                 slice_up_file_etc(bkpinfo, bigfile_fname,
     2078                slice_up_file_etc(bkpinfo, mrconf, bigfile_fname,
    20792079                                  ntfsprog_fifo, biggie_file_number,
    20802080                                  noof_biggie_files, use_ntfsprog);
     
    21252125 * @see make_afioballs_and_images
    21262126 */
    2127 int make_afioballs_and_images_OLD(struct s_bkpinfo *bkpinfo)
     2127int make_afioballs_and_images_OLD(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf)
    21282128{
    21292129
     
    21982198            res = move_files_to_stream(bkpinfo, curr_afioball_fname, NULL);
    21992199        } 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);
    22042205        }
    22052206        retval += res;
     
    22462247 * @ingroup MLarchiveGroup
    22472248 */
    2248 int make_those_afios_phase(struct s_bkpinfo *bkpinfo)
     2249int make_those_afios_phase(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf)
    22492250{
    22502251    /*@ int ******************************************* */
     
    22632264        log_msg(1,
    22642265                "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);
    22662267#else
    2267         res = make_afioballs_and_images_OLD(bkpinfo);
     2268        res = make_afioballs_and_images_OLD(bkpinfo, mrconf);
    22682269#endif
    22692270        write_header_block_to_stream(0, "stop-afioballs",
    22702271                                     BLK_STOP_AFIOBALLS);
    22712272    } else {
    2272         res = make_afioballs_and_images(bkpinfo);
     2273        res = make_afioballs_and_images(bkpinfo, mrconf);
    22732274    }
    22742275
     
    23762377 * transfer files over the network) or leave it as is.
    23772378 */
    2378 int (*move_files_to_cd) (struct s_bkpinfo *, char *, ...) =
     2379int (*move_files_to_cd) (struct s_bkpinfo *, struct s_mrconf *mrconf, char *, ...) =
    23792380    _move_files_to_cd;
    23802381
     
    23972398 * @return The number of errors encountered (0 for success)
    23982399 */
    2399 int _move_files_to_cd(struct s_bkpinfo *bkpinfo, char *files_to_add, ...)
     2400int _move_files_to_cd(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, char *files_to_add, ...)
    24002401{
    24012402
     
    24362437    if (would_occupy / 1024 > bkpinfo->media_size[g_current_media_number]) {
    24372438        /* 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);
    24392440        retval += res;
    24402441        if (res) {
     
    24802481 * @c backup_media_type field is used in this function.
    24812482 * @param imagesdir The directory containing the floppy images (usually
    2482  * /root/images/mindi).
     2483 * /var/cache/mindi).
    24832484 *
    24842485 * @return The number of errors encountered (0 for success)
     
    26532654    if (!bkpinfo->nonbootable_backup) {
    26542655#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"))
    26562657#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"))
    26592662#endif
    26602663        {
    26612664            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")) {
    26632666                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.");
    26652668                res++;
    26662669            }
    26672670        } else {
    2668             offer_to_write_floppies(bkpinfo, "/root/images/mindi");
     2671            offer_to_write_floppies(bkpinfo, "/var/cache/mindi");
    26692672            mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    26702673        }
     
    30043007 */
    30053008int
    3006 slice_up_file_etc(struct s_bkpinfo *bkpinfo, char *biggie_filename,
     3009slice_up_file_etc(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, char *biggie_filename,
    30073010                  char *ntfsprog_fifo, long biggie_file_number,
    30083011                  long noof_biggie_files, bool use_ntfsprog)
     
    31273130                                               bkpinfo->tmpdir, ""), NULL);
    31283131    } 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);
    31323136    }
    31333137    i = bkpinfo->optimal_set_size / 256;
     
    32433247            res = move_files_to_stream(bkpinfo, file_to_archive, NULL);
    32443248        } else {
    3245             res = move_files_to_cd(bkpinfo, file_to_archive, NULL);
     3249            res = move_files_to_cd(bkpinfo, mrconf, file_to_archive, NULL);
    32463250        }
    32473251        paranoid_free(file_to_archive);
     
    33393343 * however, this occurs rarely.
    33403344 */
    3341 int write_final_iso_if_necessary(struct s_bkpinfo *bkpinfo)
     3345int write_final_iso_if_necessary(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf)
    33423346{
    33433347    /*@ int ***************************************************** */
     
    33623366#endif
    33633367    paranoid_free(tmp);
    3364     res = write_iso_and_go_on(bkpinfo, TRUE);
     3368    res = write_iso_and_go_on(bkpinfo, mrconf, TRUE);
    33653369#ifndef _XWIN
    33663370    if (!g_text_mode) {
     
    33903394 * @see make_iso_fs
    33913395 */
    3392 int write_iso_and_go_on(struct s_bkpinfo *bkpinfo, bool last_cd)
     3396int write_iso_and_go_on(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, bool last_cd)
    33933397{
    33943398    /*@ pointers **************************************************** */
     
    34683472             g_current_media_number);
    34693473    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);
    34713475        if (g_current_media_number == 1 && !res
    34723476            && (bkpinfo->backup_media_type == cdr
     
    37533757setenv("MONDO_SHARE", MONDO_SHARE, 1);
    37543758}
     3759
     3760void 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(&param, &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.