Changeset 3883 in MondoRescue


Ignore:
Timestamp:
Mar 10, 2024, 12:58:41 AM (3 months ago)
Author:
Bruno Cornec
Message:

Remove the possibility to have non bootable media

Location:
branches/3.3/mondo/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3/mondo/src/common/libmondo-archive.c

    r3882 r3883  
    370370 * @param bkpinfo The backup information structure. Fields used:
    371371 * - @c backup_media_type
    372  * - @c nonbootable_backup
    373372 * - @c scratchdir
    374373 *
     
    431430    mr_free(tmp);
    432431
    433     if (bkpinfo->nonbootable_backup) {
    434         log_msg(1, "Making nonbootable USB backup not implemented yet");
    435     } else {
    436         log_msg(1, "Making bootable backup");
    437 
    438         /* Command to execute */
    439         mr_asprintf(tmp,"cd %s ; rm -fr %s/syslinux ; mv * %s", bkpinfo->scratchdir, tmp1, tmp1);
    440         res = eval_call_to_make_USB(tmp, message_to_screen);
    441         if (res) {
    442             mr_asprintf(result_sz, "%s ...failed",tmp);
    443         } else {
    444             mr_asprintf(result_sz, "%s ...OK",tmp);
    445         }
    446         log_to_screen(result_sz);
    447         mr_free(result_sz);
    448         mr_free(tmp);
    449         retval += res;
    450 
    451         /* Recreate the required structure under the scratch dir */
    452         mr_asprintf(tmp,"mkdir %s/archive", bkpinfo->scratchdir);
    453         run_program_and_log_output(tmp, FALSE);
    454         mr_free(tmp);
    455     }
     432    log_msg(1, "Making bootable backup");
     433
     434    /* Command to execute */
     435    mr_asprintf(tmp,"cd %s ; rm -fr %s/syslinux ; mv * %s", bkpinfo->scratchdir, tmp1, tmp1);
     436    res = eval_call_to_make_USB(tmp, message_to_screen);
     437    if (res) {
     438        mr_asprintf(result_sz, "%s ...failed",tmp);
     439    } else {
     440        mr_asprintf(result_sz, "%s ...OK",tmp);
     441    }
     442    log_to_screen(result_sz);
     443    mr_free(result_sz);
     444    mr_free(tmp);
     445    retval += res;
     446
     447    /* Recreate the required structure under the scratch dir */
     448    mr_asprintf(tmp,"mkdir %s/archive", bkpinfo->scratchdir);
     449    run_program_and_log_output(tmp, FALSE);
     450    mr_free(tmp);
    456451    paranoid_free(message_to_screen);
    457452
     
    690685 * - @c make_cd_use_lilo
    691686 * - @c manual_cd_tray
    692  * - @c nonbootable_backup
    693687 * - @c scratchdir
    694688 *
     
    850844        }
    851845        mr_free(tmp);
    852         if (bkpinfo->nonbootable_backup) {
    853             log_msg(1, "Making nonbootable backup");
    854             mr_asprintf(full_isofs_cmd, "%s%s-o '_ISO_' .",isofs_cmd,MONDO_MKISOFS);
     846        log_msg(1, "Making bootable backup");
     847
     848#ifdef __FreeBSD__
     849        bkpinfo->make_cd_use_lilo = TRUE;
     850#endif
     851
     852
     853        log_msg(1, "make_cd_use_lilo is actually %d", bkpinfo->make_cd_use_lilo);
     854        if (bkpinfo->make_cd_use_lilo) {
     855            log_msg(1, "make_cd_use_lilo = TRUE");
     856#ifdef __IA64__
     857            log_msg(1, "IA64 --> elilo");
     858            mr_asprintf(full_isofs_cmd, "%s%s-o '_ISO_' .",isofs_cmd,MONDO_MKISOFS_REGULAR_ELILO);
    855859            res = eval_call_to_make_ISO(full_isofs_cmd, destfile, g_current_media_number, message_to_screen);
    856860            mr_free(full_isofs_cmd);
     861#else
     862            log_msg(1, "Non-ia64 --> lilo");
     863            mr_asprintf(full_isofs_cmd, "%s%s-b images/mindi-bootroot.img -c images/boot.cat -o '_ISO_' .",isofs_cmd,MONDO_MKISOFS);
     864            // FIXME: fixed boot size probably wrong. lilo to be removed
     865            res = eval_call_to_make_ISO(full_isofs_cmd, destfile, g_current_media_number, message_to_screen);
     866            mr_free(full_isofs_cmd);
     867#endif
    857868        } else {
    858             log_msg(1, "Making bootable backup");
    859 
    860 #ifdef __FreeBSD__
    861             bkpinfo->make_cd_use_lilo = TRUE;
    862 #endif
    863 
    864 
    865             log_msg(1, "make_cd_use_lilo is actually %d", bkpinfo->make_cd_use_lilo);
    866             if (bkpinfo->make_cd_use_lilo) {
    867                 log_msg(1, "make_cd_use_lilo = TRUE");
    868 #ifdef __IA64__
    869                 log_msg(1, "IA64 --> elilo");
    870                 mr_asprintf(full_isofs_cmd, "%s%s-o '_ISO_' .",isofs_cmd,MONDO_MKISOFS_REGULAR_ELILO);
    871                 res = eval_call_to_make_ISO(full_isofs_cmd, destfile, g_current_media_number, message_to_screen);
    872                 mr_free(full_isofs_cmd);
    873 #else
    874                 log_msg(1, "Non-ia64 --> lilo");
    875                 mr_asprintf(full_isofs_cmd, "%s%s-b images/mindi-bootroot.img -c images/boot.cat -o '_ISO_' .",isofs_cmd,MONDO_MKISOFS);
    876                 // FIXME: fixed boot size probably wrong. lilo to be removed
    877                 res = eval_call_to_make_ISO(full_isofs_cmd, destfile, g_current_media_number, message_to_screen);
    878                 mr_free(full_isofs_cmd);
    879 #endif
     869            log_msg(1, "make_cd_use_lilo = FALSE");
     870            log_msg(1, "Isolinux");
     871            if (bkpinfo->boot_type == UEFI) {
     872                if (strstr(isofs_cmd,"xorriso")) {
     873                    /*  xorriso needs another '-' before efi-boot */
     874                    mr_asprintf(uefistr, "%s -%s", MONDO_UEFI_PREFIX, MONDO_MKISOFS_UEFI);
     875                } else {
     876                    mr_asprintf(uefistr, "%s %s", MONDO_UEFI_PREFIX, MONDO_MKISOFS_UEFI);
     877                }
    880878            } else {
    881                 log_msg(1, "make_cd_use_lilo = FALSE");
    882                 log_msg(1, "Isolinux");
    883                 if (bkpinfo->boot_type == UEFI) {
    884                     if (strstr(isofs_cmd,"xorriso")) {
    885                         /*  xorriso needs another '-' before efi-boot */
    886                         mr_asprintf(uefistr, "%s -%s", MONDO_UEFI_PREFIX, MONDO_MKISOFS_UEFI);
    887                     } else {
    888                         mr_asprintf(uefistr, "%s %s", MONDO_UEFI_PREFIX, MONDO_MKISOFS_UEFI);
    889                     }
    890                 } else {
    891                     mr_asprintf(uefistr, "%s",MONDO_MKISOFS_CMS);
    892                 }
    893                 mr_asprintf(full_isofs_cmd, "%s%s%s-o '_ISO_' .",isofs_cmd,MONDO_MKISOFS_REGULAR_SYSLINUX,uefistr);
    894                 mr_free(uefistr);
    895 
    896                 res = eval_call_to_make_ISO(full_isofs_cmd, destfile, g_current_media_number, message_to_screen);
    897                 mr_free(full_isofs_cmd);
    898             }
     879                mr_asprintf(uefistr, "%s",MONDO_MKISOFS_CMS);
     880            }
     881            mr_asprintf(full_isofs_cmd, "%s%s%s-o '_ISO_' .",isofs_cmd,MONDO_MKISOFS_REGULAR_SYSLINUX,uefistr);
     882            mr_free(uefistr);
     883
     884            res = eval_call_to_make_ISO(full_isofs_cmd, destfile, g_current_media_number, message_to_screen);
     885            mr_free(full_isofs_cmd);
    899886        }
    900887        mr_free(isofs_cmd);
     
    25722559 * - @c media_device
    25732560 * - @c media_size
    2574  * - @c nonbootable_backup
    25752561 * - @c scratchdir
    25762562 * - @c tmpdir
     
    27052691
    27062692    update_evalcall_form(2);
    2707     if (!bkpinfo->nonbootable_backup && (bkpinfo->boot_loader == '\0' || bkpinfo->boot_device == NULL)) {
     2693    if ((bkpinfo->boot_loader == '\0') || (bkpinfo->boot_device == NULL)) {
    27082694
    27092695#ifdef __FreeBSD__
     
    27622748           bkpinfo->boot_loader != 'E' &&
    27632749#endif
    2764            bkpinfo->boot_loader != 'L' && bkpinfo->boot_loader != 'G' && bkpinfo->boot_loader != 'R' && !bkpinfo->nonbootable_backup) {
     2750           bkpinfo->boot_loader != 'L' && bkpinfo->boot_loader != 'G' && bkpinfo->boot_loader != 'R') {
    27652751        fatal_error("Please specify your boot loader and device, e.g. -l GRUB -f /dev/hda. Type 'man mondoarchive' to read the manual.");
    27662752    }
     
    29782964    mr_free(value);
    29792965
    2980     /* This parameter is always the last one and optional */
    2981     if (bkpinfo->nonbootable_backup) {
    2982         mr_strcat(command, " NONBOOTABLE");
    2983     }
    29842966    log_msg(2, command);
    29852967
     
    29962978    log_msg(1, "End of call to mindi");
    29972979
    2998     if (bkpinfo->nonbootable_backup) {
    2999         res = 0;
    3000     }                           // hack
    30012980    if (!res) {
    30022981        log_to_screen("Boot+data disks were created OK");
    30032982
    3004         if (bkpinfo->nonbootable_backup) {
    3005             mr_asprintf(command, "cp -f %s/all.tar.gz %s/images", bkpinfo->tmpdir, bkpinfo->scratchdir);
    3006             if (system(command)) {
    3007                 mr_free(command);
    3008                 fatal_error("Unable to create temporary all tarball");
    3009             }
    3010             mr_free(command);
    3011         }
    30122983        /* For USB we already have everything on the key */
    30132984        if (bkpinfo->backup_media_type == usb) {
  • branches/3.3/mondo/src/common/libmondo-cli.c

    r3882 r3883  
    260260        }
    261261        mr_free(tmp);
    262     }
    263 
    264     if ((flag_set['W']) && (! bkpinfo->restore_data)) {
    265         bkpinfo->nonbootable_backup = TRUE;
    266         log_to_screen("Warning - you have opted for non-bootable backup");
    267         if (flag_set['f'] || flag_set['l']) {
    268             log_to_screen
    269                 ("You don't need to specify bootloader or bootdevice");
    270         }
    271262    }
    272263
  • branches/3.3/mondo/src/common/libmondo-devices.c

    r3882 r3883  
    20102010    malloc_string(tmp1);
    20112011    assert(bkpinfo != NULL);
    2012     bkpinfo->nonbootable_backup = FALSE;
    20132012
    20142013    // Tape, CD, NETFS, ...?
     
    21002099
    21012100            mr_asprintf(comment, "How much data (in Megabytes) will each %s store?", mds);
    2102             tmp1 = popup_and_get_string("Size", comment, sz_size, 5)) {
     2101            tmp1 = mr_popup_and_get_string("Size", comment, sz_size);
    21032102            if (!tmp1) {
    21042103                log_to_screen("User has chosen not to backup the machine");
  • branches/3.3/mondo/src/common/libmondo-tools.c

    r3882 r3883  
    352352 * - Used: @c bkpinfo->media_device
    353353 * - Used: @c bkpinfo->netfs_mount
    354  * - Used: @c bkpinfo->nonbootable_backup
    355354 * - Used: @c bkpinfo->scratchdir
    356355 * - Used: @c bkpinfo->tmpdir
     
    437436            fatal_error("Please install growisofs.");
    438437        }
    439         if (bkpinfo->nonbootable_backup) {
    440             mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_NONBOOT);
    441         } else if
     438        if
    442439#ifdef __FreeBSD__
    443440            (TRUE)
     
    506503        mr_free(tmp);
    507504
    508         if (bkpinfo->nonbootable_backup) {
    509             mr_asprintf(mondo_mkisofs_sz, "%s%s", isofs_cmd, MONDO_MKISOFS);
    510         } else if
     505        if
    511506#ifdef __FreeBSD__
    512507            (TRUE)
     
    990985    bkpinfo->please_dont_eject = FALSE;
    991986    bkpinfo->manual_cd_tray = FALSE;
    992     bkpinfo->nonbootable_backup = FALSE;
    993987    bkpinfo->make_cd_use_lilo = FALSE;
    994988    bkpinfo->use_obdr = FALSE;
  • branches/3.3/mondo/src/common/mondostructures.h

    r3882 r3883  
    618618   */
    619619    bool manual_cd_tray;
    620 
    621   /**
    622    * If TRUE, do not make the first CD bootable. This is dangerous but it saves a minute
    623    * or so. It is useful in testing. Use with care.
    624    */
    625     bool nonbootable_backup;
    626620
    627621  /**
  • branches/3.3/mondo/src/include/my-stuff.h

    r3882 r3883  
    218218     */
    219219#define MONDO_GROWISOFS_REGULAR_LILO     "growisofs "MONDO_MKISOFS_REGULAR_SYSLINUX
    220 
    221 /**
    222  * @c growisofs command to generate a nonbootable DVD, except for the directory to image.
    223  */
    224 #define MONDO_GROWISOFS_NONBOOT          "growisofs -use-the-force-luke "MONDO_MKISOFS
    225220
    226221/**
Note: See TracChangeset for help on using the changeset viewer.