Changeset 1693 in MondoRescue for branches/stable/mondo


Ignore:
Timestamp:
Oct 21, 2007, 3:06:22 AM (17 years ago)
Author:
Bruno Cornec
Message:
  • Remove useless copy from mindi to mondo at end of USB handling
  • Fix PB macro vs tools/*2build issue
  • make_usb_fs change of interface (doesn't need a parameter)
  • Fix USB support in mondo to avoid multiple copies of files
  • Use first partiion in mondo for USB device
  • Fixes for USB CLI for both mondo/mindi
  • Try to add USB support for mondoarchive with new functions
  • du => deb for similarity with other distro type under pbconf
  • migrate gento build files under pb
  • remove now obsolete rpm spec file and gentoo build files from distributions
  • Remove DOCDIR usage in mindi + various build fixes

(merge -r1680:1692 $SVN_M/branches/2.2.5)

Location:
branches/stable/mondo
Files:
1 deleted
6 edited

Legend:

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

    r1671 r1693  
    533533    /*@ buffer ************************************************************ */
    534534    char *tmp = NULL;
     535    char *tmp1 = NULL;
     536    char *tmp2 = NULL;
    535537    char *command = NULL;
    536538    char *bootldr_str = NULL;
     
    15341536    }
    15351537    close_evalcall_form();
     1538}
     1539
     1540
     1541/**
     1542 * Create a USB image in @c destfile, from files in @c bkpinfo->scratchdir.
     1543 *
     1544 * @param bkpinfo The backup information structure. Fields used:
     1545 * - @c backup_media_type
     1546 * - @c nonbootable_backup
     1547 * - @c scratchdir
     1548 *
     1549 * @param destfile Where to put the generated USB image.
     1550 * @return The number of errors encountered (0 for success)
     1551 */
     1552int make_usb_fs()
     1553{
     1554    /*@ int ********************************************** */
     1555    int retval = 0;
     1556    int res;
     1557
     1558    /*@ buffers ****************************************** */
     1559    char *tmp = NULL;
     1560    char *tmp1 = NULL;
     1561    char *result_sz = NULL;
     1562    char *message_to_screen = NULL;
     1563    char *old_pwd;
     1564
     1565    malloc_string(old_pwd);
     1566    assert(bkpinfo != NULL);
     1567
     1568    log_msg(2, "make_usb_fs --- scratchdir=%s", bkpinfo->scratchdir);
     1569    (void) getcwd(old_pwd, MAX_STR_LEN - 1);
     1570    asprintf(&tmp, "chmod 755 %s", bkpinfo->scratchdir);
     1571    run_program_and_log_output(tmp, FALSE);
     1572    paranoid_free(tmp);
     1573    chdir(bkpinfo->scratchdir);
     1574
     1575    asprintf(&message_to_screen, "Copying data to make %s #%d",
     1576                media_descriptor_string(bkpinfo->backup_media_type),
     1577                g_current_media_number);
     1578    log_msg(1, message_to_screen);
     1579
     1580    if (is_this_device_mounted(bkpinfo->media_device)) {
     1581        log_msg(1, "USB device mounted. Remounting it at the right place");
     1582        asprintf(&tmp, "umount %s", bkpinfo->media_device);
     1583        run_program_and_log_output(tmp, FALSE);
     1584        paranoid_free(tmp);
     1585    }
     1586    log_msg(1, "Mounting USB device.");
     1587    asprintf(&tmp1, "%s/usb", bkpinfo->tmpdir);
     1588    asprintf(&tmp, "mkdir -p %s", tmp1);
     1589    run_program_and_log_output(tmp, FALSE);
     1590    paranoid_free(tmp);
     1591    /* Mindi always create one single parition on the USB dev */
     1592    asprintf(&tmp, "mount %s1 %s", bkpinfo->media_device, tmp1);
     1593    run_program_and_log_output(tmp, FALSE);
     1594    paranoid_free(tmp);
     1595
     1596    if (bkpinfo->nonbootable_backup) {
     1597        log_msg(1, "Making nonbootable USB backup not implemented yet");
     1598    } else {
     1599        log_msg(1, "Making bootable backup");
     1600
     1601        /* Command to execute */
     1602        asprintf(&tmp,"mv %s/.??* %s/* %s", bkpinfo->scratchdir, bkpinfo->scratchdir, tmp1);
     1603        res = eval_call_to_make_USB(tmp, message_to_screen);
     1604        if (res) {
     1605            asprintf(&result_sz, "%s ...failed",tmp);
     1606        } else {
     1607            asprintf(&result_sz, "%s ...OK",tmp);
     1608        }
     1609        log_to_screen(result_sz);
     1610        paranoid_free(result_sz);
     1611        paranoid_free(tmp);
     1612        retval += res;
     1613    }
     1614    paranoid_free(message_to_screen);
     1615    paranoid_free(tmp1);
     1616
     1617    if (is_this_device_mounted(bkpinfo->media_device)) {
     1618        asprintf(&tmp, "umount %s1", bkpinfo->media_device);
     1619        run_program_and_log_output(tmp, FALSE);
     1620        paranoid_free(tmp);
     1621    }
     1622
     1623    chdir(old_pwd);
     1624    if (retval) {
     1625        log_msg(1, "WARNING - make_usb_fs returned an error");
     1626    }
     1627    paranoid_free(old_pwd);
     1628    return (retval);
    15361629}
    15371630
     
    31543247            res = make_iso_fs(isofile);
    31553248        } else {
     3249            res = make_usb_fs();
    31563250        }
    31573251        if (g_current_media_number == 1 && !res
  • branches/stable/mondo/src/common/libmondo-fork-EXT.h

    r1663 r1693  
    55                                         char *what_i_am_doing);
    66extern int run_program_and_log_output(char *program, int);
     7extern int eval_call_to_make_USB(char *call,
     8                                 char *what_i_am_doing);
    79extern int eval_call_to_make_ISO(char *basic_call, char *isofile,
    810                                 int cd_no, char *logstub,
  • branches/stable/mondo/src/common/libmondo-fork.c

    r1663 r1693  
    179179
    180180/**
     181 * Call copy of data to create an USB image.
     182 * @param bkpinfo The backup information structure. Fields used:
     183 * - @c bkpinfo->backup_media_type
     184 * @return Exit code of @c copy (0 is success, anything else indicates failure).
     185 */
     186int
     187eval_call_to_make_USB(char *command, char *what_i_am_doing) {
     188
     189    /*@ int's  *** */
     190    int retval = 0;
     191
     192
     193/*@***********   End Variables ***************************************/
     194
     195    log_msg(3, "Starting");
     196    assert(bkpinfo != NULL);
     197
     198    log_to_screen
     199        ("Please be patient. Do not be alarmed by on-screen inactivity.");
     200    log_msg(4, "Calling open_evalcall_form() with what_i_am_doing='%s'",
     201            what_i_am_doing);
     202
     203    if (!g_text_mode) {
     204        newtSuspend();
     205    }
     206    log_msg(1, "command = '%s'", command);
     207    if (!g_text_mode) {
     208        retval = run_external_binary_with_percentage_indicator_NEW
     209            (what_i_am_doing, command);
     210    } else {
     211        retval += system(command);
     212    }
     213    if (!g_text_mode) {
     214        newtResume();
     215    }
     216
     217    return (retval);
     218}
     219
     220
     221
     222
     223/**
    181224 * Run a program and log its output (stdout and stderr) to the logfile.
    182225 * @param program The program to run. Passed to the shell, so you can use pipes etc.
  • branches/stable/mondo/src/common/libmondo-fork.h

    r1663 r1693  
    88int run_program_and_log_to_screen(char *basic_call, char *what_i_am_doing);
    99int run_program_and_log_output(char *program, int);
     10int eval_call_to_make_USB(char *call, char *what_i_am_doing);
    1011int eval_call_to_make_ISO(char *basic_call, char *isofile,
    1112                          int cd_no, char *logstub, char *what_i_am_doing);
  • branches/stable/mondo/src/common/libmondo-string.c

    r1663 r1693  
    929929       }
    930930
    931        switch (type_of_bkp) {
    932        case dvd:
    933                strcpy(type_of_backup, "DVD");
    934                break;
    935        case cdr:
    936                strcpy(type_of_backup, "CDR");
    937                break;
    938        case cdrw:
    939                strcpy(type_of_backup, "CDRW");
    940                break;
    941        case tape:
    942                strcpy(type_of_backup, "tape");
    943                break;
    944        case cdstream:
    945                strcpy(type_of_backup, "CDR");
    946                break;
    947        case udev:
    948                strcpy(type_of_backup, "udev");
    949                break;
    950        case iso:
    951                strcpy(type_of_backup, "ISO");
    952                break;
    953        case nfs:
    954                strcpy(type_of_backup, "nfs");
    955                break;
    956        case usb:
    957                strcpy(type_of_backup, "USB");
    958                break;
    959        default:
    960                strcpy(type_of_backup, "ISO");
    961        }
    962        return (type_of_backup);
    963 }
    964 
     931        switch (type_of_bkp) {
     932        case dvd:
     933            strcpy(type_of_backup, "DVD");
     934            break;
     935        case cdr:
     936            strcpy(type_of_backup, "CDR");
     937            break;
     938        case cdrw:
     939            strcpy(type_of_backup, "CDRW");
     940            break;
     941        case tape:
     942            strcpy(type_of_backup, "tape");
     943            break;
     944        case cdstream:
     945            strcpy(type_of_backup, "CDR");
     946            break;
     947        case udev:
     948            strcpy(type_of_backup, "udev");
     949            break;
     950        case iso:
     951            strcpy(type_of_backup, "ISO");
     952            break;
     953        case nfs:
     954            strcpy(type_of_backup, "nfs");
     955            break;
     956        case usb:
     957            strcpy(type_of_backup, "USB");
     958            break;
     959        default:
     960            strcpy(type_of_backup, "ISO");
     961    }
     962    return (type_of_backup);
     963}
  • branches/stable/mondo/src/include/my-stuff.h

    r1670 r1693  
    227227#ifdef __FreeBSD__
    228228#define VANILLA_SCSI_TAPE   "/dev/sa"
     229#define VANILLA_USB_DEVICE  "tobegivenbybsdguru"
    229230#define DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE  "/dev/vinum/"
    230231#define RAID_DEVICE_STUB    DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE
     
    235236#else
    236237#define VANILLA_SCSI_TAPE   "/dev/st0"
     238#define VANILLA_USB_DEVICE  "/dev/hda"
    237239#define DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE  "/dev/md"
    238240#define RAID_DEVICE_STUB    DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE
Note: See TracChangeset for help on using the changeset viewer.